Skip to content

Commit c7ad6b1

Browse files
committed
Add shorthand constants back to GPIO module and fix example
1 parent 08293b5 commit c7ad6b1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ In `CMakeLists.txt`, make sure the line `PRIV_REQUIRES` includes the `driver` co
2121
2222
## Example
2323
```ruby
24+
include ESP32::Constants
2425
include ESP32::GPIO
2526
2627
led = GPIO_NUM_4

mrblib/gpio.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ module ESP32
22
include Constants
33

44
module GPIO
5+
INPUT_PULLUP = ESP32::GPIO_MODE_INPUT_PULLUP
6+
INPUT_PULLDOWN = ESP32::GPIO_MODE_INPUT_PULLDOWN
7+
INPUT = ESP32::GPIO_MODE_INPUT
8+
OUTPUT = ESP32::GPIO_MODE_OUTPUT
9+
INPUT_OUTPUT = ESP32::GPIO_MODE_INPUT_OUTPUT
10+
511
class << self
612
alias :digital_write :digitalWrite
713
alias :digital_read :digitalRead

0 commit comments

Comments
 (0)