Skip to content

Commit

Permalink
Update demo app for new GPIO
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed Mar 9, 2020
1 parent c4921bc commit bbfc899
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions sw/swervolf_zephyr_demo/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ void main(void)

printk("Now proceeding to blink the LED\n");

u16_t leds = 1;
u16_t gpio_old = sys_read16(0x80001012);
u16_t gpio_new = sys_read16(0x80001012);
while (1) {
sys_write8(1, 0x80001010);
k_sleep(1000);
sys_write8(0, 0x80001010);
k_sleep(1000);
sys_write16(leds, 0x80001010);
leds = (leds << 1) | (leds >> 15);
gpio_new = sys_read16(0x80001012);
if (gpio_old != gpio_new) {
printk("GPIO is now %04x\n", gpio_new);
gpio_old = gpio_new;
}
k_sleep(100);
}
}

0 comments on commit bbfc899

Please sign in to comment.