Skip to content

Commit 461e812

Browse files
committed
Run gpio_init() and ensure GPIO2 is toggled in Blinky.
Previously the if-statement was inverted so never actually changed anything.
1 parent 118aef2 commit 461e812

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

blinky/user/user_main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,21 @@
99
os_event_t user_procTaskQueue[user_procTaskQueueLen];
1010
static void user_procTask(os_event_t *events);
1111

12-
extern uint32_t PIN_OUT;
13-
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
14-
1512
static volatile os_timer_t some_timer;
1613

1714

1815
void some_timerfunc(void *arg)
1916
{
2017
//Do blinky stuff
21-
if (CHECK_BIT(PIN_OUT,2))
18+
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & BIT2)
2219
{
23-
//Set GPIO2 to HIGH
24-
gpio_output_set(BIT2, 0, BIT2, 0);
20+
//Set GPIO2 to LOW
21+
gpio_output_set(0, BIT2, BIT2, 0);
2522
}
2623
else
2724
{
28-
//Set GPIO2 to LOW
29-
gpio_output_set(0, BIT2, BIT2, 0);
25+
//Set GPIO2 to HIGH
26+
gpio_output_set(BIT2, 0, BIT2, 0);
3027
}
3128
}
3229

@@ -41,6 +38,9 @@ user_procTask(os_event_t *events)
4138
void ICACHE_FLASH_ATTR
4239
user_init()
4340
{
41+
// Initialize the GPIO subsystem.
42+
gpio_init();
43+
4444
//Set GPIO2 to output mode
4545
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
4646

0 commit comments

Comments
 (0)