Skip to content

Commit 9ec475d

Browse files
committed
Initialize.
0 parents  commit 9ec475d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# mruby-esp32-spi
2+
3+
SPI library for mruby-esp32.
4+
5+
## Installation
6+
7+
You need [esp-idf v5.0](https://docs.espressif.com/projects/esp-idf/en/release-v5.0/esp32/index.html) to use this mrbgems.
8+
9+
Add the line below to your `build_config.rb`:
10+
11+
```ruby
12+
conf.gem :github => 'yuuu/mruby-esp32-spi'
13+
```
14+
15+
## Examples
16+
17+
```ruby
18+
spi = SPI.new
19+
spi = SPI.new(unit: 1, mode: 0, frequency:10_000_000, first_bit: SPI::MSB_FIRST)
20+
21+
spi.setmode(unit: 1, mode: 0, frequency:10_000_000, first_bit: SPI::MSB_FIRST)
22+
23+
spi.write(0x30, 0x20, 0x00)
24+
spi.write("\x30\xa2")
25+
spi.write(0x30)
26+
27+
data = spi.read( 32 )
28+
29+
s = spi.transfer([0x30, 0x20], 1)
30+
31+
```
32+
33+
## LICENSE
34+
35+
MIT License.

0 commit comments

Comments
 (0)