gpio toggle works
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
#include "Timer.h"
|
||||
#include "BlinkLed.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "driver.h"
|
||||
|
||||
// Keep the LED on for 2/3 of a second.
|
||||
#define BLINK_ON_TICKS (TIMER_FREQUENCY_HZ * 3 / 4)
|
||||
#define BLINK_OFF_TICKS (TIMER_FREQUENCY_HZ - BLINK_ON_TICKS)
|
||||
@@ -26,12 +29,16 @@ int main(int argc, char* argv[])
|
||||
trace_puts("Hello ARM World!");
|
||||
trace_printf("System clock: %u Hz\n", SystemCoreClock);
|
||||
timer_start();
|
||||
blink_led_init();
|
||||
// blink_led_init();
|
||||
uint32_t seconds = 0;
|
||||
drv_open(&gpio_d12);
|
||||
drv_write(&gpio_d12, "1", 1);
|
||||
while(1) {
|
||||
blink_led_on();
|
||||
// blink_led_on();
|
||||
drv_write(&gpio_d12, "1", 1);
|
||||
timer_sleep(seconds == 0 ? TIMER_FREQUENCY_HZ : BLINK_ON_TICKS);
|
||||
blink_led_off();
|
||||
// blink_led_off();
|
||||
drv_write(&gpio_d12, "0", 1);
|
||||
timer_sleep(BLINK_OFF_TICKS);
|
||||
++seconds;
|
||||
trace_printf("Second %u\n", seconds);
|
||||
|
Reference in New Issue
Block a user