From 8de8135f2d84a0a01cec39e8aa12c74142508506 Mon Sep 17 00:00:00 2001 From: Conor Date: Wed, 16 Mar 2016 20:30:42 -0400 Subject: [PATCH] button pcb --- firmware/inc/bsp.h | 2 ++ firmware/src/main.c | 26 +++++++++----------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/firmware/inc/bsp.h b/firmware/inc/bsp.h index 15e71ee..c940840 100644 --- a/firmware/inc/bsp.h +++ b/firmware/inc/bsp.h @@ -25,6 +25,8 @@ extern SI_SEGMENT_VARIABLE(myUsbDevice, USBD_Device_TypeDef, MEM_MODEL_SEG); SI_SBIT(LED_G, SFR_P0, 0); SI_SBIT(LED_R, SFR_P0, 1); SI_SBIT(LED_B, SFR_P0, 2); +SI_SBIT(U2F_BUTTON, SFR_P1, 0); +SI_SBIT(U2F_BUTTON_VAL, SFR_P0, 7); void u2f_delay(int16_t ms); diff --git a/firmware/src/main.c b/firmware/src/main.c index ed24c6a..f3104bc 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -25,6 +25,7 @@ static void init(struct APP_DATA* ap) atecc_idle(); // eeprom_init(); u2f_init(); + U2F_BUTTON_VAL = 1; } void set_app_error(APP_ERROR_CODE ec) @@ -76,6 +77,7 @@ int16_t main(void) { data uint16_t ms_wink; data uint8_t winks = 0; uint8_t leds = 0; + uint16_t button = 0; enter_DefaultMode_from_RESET(); init(&appdata); @@ -94,31 +96,19 @@ int16_t main(void) { while (1) { - if (ms_since(ms_heart,1500)) + if (ms_since(ms_heart,500)) { u2f_printl("ms ", 1, get_ms()); - - test_app(); - switch(leds++ % 3) - { - case 0: - LED_R = !LED_R; - break; - case 1: - LED_G = !LED_G; - break; - case 2: - LED_B = !LED_B; - break; - } - + button = U2F_BUTTON; + u2f_printx("button: ",1,button); + LED_G = !LED_G; } if (!USBD_EpIsBusy(EP1OUT) && !USBD_EpIsBusy(EP1IN) && appdata.state != APP_HID_MSG) { USBD_Read(EP1OUT, hidmsgbuf, sizeof(hidmsgbuf), true); - u2f_prints("read added\r\n"); + // u2f_prints("read added\r\n"); } switch(appdata.state) @@ -136,6 +126,8 @@ int16_t main(void) { appdata.state = _APP_WINK; break; case _APP_WINK: + LED_G = 1; + LED_R = 1; if (ms_since(ms_wink,150)) { LED_B = !LED_B;