Skip to content

Commit a752255

Browse files
authored
Merge pull request #79 from wnienhaus/fix_blink_example
Fix blink example by correctly toggling output
2 parents 8fa7070 + c165035 commit a752255

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: examples/blink.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
#define RTC_IO_TOUCH_PAD2_REG (DR_REG_RTCIO_BASE + 0x9c)
3131
#define RTC_IO_TOUCH_PAD2_MUX_SEL_M (BIT(19))
3232
#define RTC_GPIO_OUT_REG (DR_REG_RTCIO_BASE + 0x0)
33-
#define RTC_GPIO_ENABLE_W1TS_REG (DR_REG_RTCIO_BASE + 0x10)
34-
#define RTC_GPIO_ENABLE_W1TC_REG (DR_REG_RTCIO_BASE + 0x14)
35-
#define RTC_GPIO_ENABLE_W1TS_S 14
36-
#define RTC_GPIO_ENABLE_W1TC_S 14
33+
#define RTC_GPIO_ENABLE_REG (DR_REG_RTCIO_BASE + 0xc)
34+
#define RTC_GPIO_ENABLE_S 14
3735
#define RTC_GPIO_OUT_DATA_S 14
3836
3937
# constants from:
@@ -62,8 +60,8 @@
6260
# connect GPIO to ULP (0: GPIO connected to digital GPIO module, 1: GPIO connected to analog RTC module)
6361
WRITE_RTC_REG(RTC_IO_TOUCH_PAD2_REG, RTC_IO_TOUCH_PAD2_MUX_SEL_M, 1, 1);
6462
65-
# GPIO shall be output, not input
66-
WRITE_RTC_REG(RTC_GPIO_OUT_REG, RTC_GPIO_OUT_DATA_S + gpio, 1, 1);
63+
# GPIO shall be output, not input (this also enables a pull-down by default)
64+
WRITE_RTC_REG(RTC_GPIO_ENABLE_REG, RTC_GPIO_ENABLE_S + gpio, 1, 1)
6765
6866
# store that we're done with initialisation
6967
move r0, magic
@@ -83,12 +81,12 @@
8381
8482
on:
8583
# turn on led (set GPIO)
86-
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TS_REG, RTC_GPIO_ENABLE_W1TS_S + gpio, 1, 1)
84+
WRITE_RTC_REG(RTC_GPIO_OUT_REG, RTC_GPIO_OUT_DATA_S + gpio, 1, 1)
8785
jump exit
8886
8987
off:
9088
# turn off led (clear GPIO)
91-
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TC_REG, RTC_GPIO_ENABLE_W1TC_S + gpio, 1, 1)
89+
WRITE_RTC_REG(RTC_GPIO_OUT_REG, RTC_GPIO_OUT_DATA_S + gpio, 1, 0)
9290
jump exit
9391
9492
exit:

0 commit comments

Comments
 (0)