From f4e089227c3748cb8ffdc54c9bb04bd0966a8b87 Mon Sep 17 00:00:00 2001 From: Wintermute Date: Thu, 10 Oct 2013 17:12:36 +0200 Subject: [PATCH] r0ket-Code mit Buttons an HB0, HB1 --- Makefile | 2 +- badge/main.c | 18 ++++++++++++------ badge/ui/event.c | 4 ++-- r0ketports.h | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 9bf3e37..affa70b 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ SRAM_USB = 384 # Set DEBUGBUILD to 'TRUE' for full debugging (larger, slower binaries), # or to 'FALSE' for release builds (smallest, fastest binaries) -DEBUGBUILD = TRUE +DEBUGBUILD = FALSE ########################################################################## # IDE Flags (Keeps various IDEs happy) diff --git a/badge/main.c b/badge/main.c index 33c2a6b..00b0982 100644 --- a/badge/main.c +++ b/badge/main.c @@ -87,6 +87,11 @@ void backlightInit(void) { } void rbInit() { + RB_HB0_IO &= ~IOCON_SWDIO_PIO1_3_FUNC_MASK; + RB_HB0_IO |= IOCON_SWDIO_PIO1_3_FUNC_GPIO; + RB_HB1_IO &= ~IOCON_JTAG_TCK_PIO0_10_FUNC_MASK; + RB_HB1_IO |= IOCON_JTAG_TCK_PIO0_10_FUNC_GPIO; + struct { int port; int pin; @@ -97,8 +102,8 @@ void rbInit() { { RB_BTN2 , &RB_BTN2_IO }, { RB_BTN3 , &RB_BTN3_IO }, { RB_BTN4 , &RB_BTN4_IO }, - { RB_HB3 , &RB_HB3_IO }, - { RB_HB4 , &RB_HB4_IO }, + { RB_HB0 , &RB_HB0_IO }, + { RB_HB1 , &RB_HB1_IO }, { RB_PWR_CHRG, &RB_PWR_CHRG_IO } }; @@ -130,9 +135,9 @@ void rbInit() { { RB_SPI_SS4 , 1 }, { RB_SPI_SS5 , 1 }, { RB_LCD_BL , 0 }, - { RB_HB0 , 1 }, - { RB_HB1 , 1 }, { RB_HB2 , 1 }, + { RB_HB3 , 1 }, + { RB_HB4 , 1 }, { RB_HB5 , 1 } }; @@ -166,9 +171,10 @@ int main(void) cpuInit(); systickInit(CFG_SYSTICK_DELAY_IN_MS); -// pmuInit(); -// adcInit(); + // pmuInit(); + // adcInit(); rbInit(); + usbMSCInit(); badge_display_init(); diff --git a/badge/ui/event.c b/badge/ui/event.c index 6e9ab35..21fe821 100644 --- a/badge/ui/event.c +++ b/badge/ui/event.c @@ -22,8 +22,8 @@ static uint8_t badge_input_raw(void) { if (gpioGetValue(RB_BTN0) == 0) { result |= BADGE_EVENT_KEY_LEFT ; } if (gpioGetValue(RB_BTN1) == 0) { result |= BADGE_EVENT_KEY_RIGHT ; } // TODO: Knöpfe. - if (gpioGetValue(RB_HB3) == 0) { result |= BADGE_EVENT_KEY_UP ; } - if (gpioGetValue(RB_HB4) == 0) { result |= BADGE_EVENT_KEY_UP ; } + if (gpioGetValue(RB_HB0) == 0) { result |= BADGE_EVENT_KEY_UP ; } + if (gpioGetValue(RB_HB1) == 0) { result |= BADGE_EVENT_KEY_UP ; } return result; } diff --git a/r0ketports.h b/r0ketports.h index 099d9c7..5b708b5 100644 --- a/r0ketports.h +++ b/r0ketports.h @@ -86,10 +86,10 @@ // Hackerbus #define RB_HB0 1,3 -#define RB_HB0_IO IOCON_PIO1_3 +#define RB_HB0_IO IOCON_SWDIO_PIO1_3 #define RB_HB1 0,10 -#define RB_HB1_IO IOCON_PIO0_10 +#define RB_HB1_IO IOCON_JTAG_TCK_PIO0_10 #define RB_HB2 1,1 #define RB_HB2_IO IOCON_PIO1_1 -- 2.20.1