Skip to content

Commit

Permalink
Make heartbeat LED a shorter pulse (since we're using the blue LED)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarop committed Dec 16, 2015
1 parent 9b4ddd7 commit ea109d6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fw/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#include "dac.h"
#include "pwm.h"

#define BLINK_DELAY_MS (500)
#define LED_ON_MS (10)
#define LED_OFF_MS (990)

volatile uint32_t tickMs = 0;
__ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END;
Expand All @@ -42,17 +43,19 @@ int main(void) {
// Disable line buffering on stdout
setbuf(stdout, NULL);

nextBlink = tickMs + BLINK_DELAY_MS;
nextBlink = tickMs + LED_OFF_MS;
for(;;) {

consoleProcess();

if(tickMs > nextBlink) {
nextBlink = tickMs + BLINK_DELAY_MS;

if(blinkState) {
GPIO_SetBits(GPIOD, GPIO_Pin_15);
nextBlink = tickMs + LED_ON_MS;
} else {
GPIO_ResetBits(GPIOD, GPIO_Pin_15);
nextBlink = tickMs + LED_OFF_MS;
}
blinkState ^= 1;
}
Expand Down

0 comments on commit ea109d6

Please sign in to comment.