From 2707e8aff66be3ff78929cfe9528ada068f0bd10 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 7 Jul 2014 15:03:34 +0200 Subject: [PATCH] move APPVER guards from includes to app code --- demo/demo.c | 2 ++ firmware/trezor.c | 4 ++++ oled.h | 4 ---- setup.c | 6 ++++++ setup.h | 5 +---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/demo/demo.c b/demo/demo.c index 77dc3b5f1..ff3b9b7f0 100644 --- a/demo/demo.c +++ b/demo/demo.c @@ -241,8 +241,10 @@ void usbInit(void) int main(void) { +#ifndef APPVER setup(); oledInit(); +#endif usbInit(); passlen = strlen((char *)pass); diff --git a/firmware/trezor.c b/firmware/trezor.c index 9298285ae..969eb4ffe 100644 --- a/firmware/trezor.c +++ b/firmware/trezor.c @@ -29,8 +29,12 @@ int main(void) { +#ifndef APPVER setup(); oledInit(); +#else + setupApp(); +#endif // __stack_chk_guard_setup(); #if DEBUG_LINK oledSetDebug(1); diff --git a/oled.h b/oled.h index f23728cfd..0823b7a1a 100644 --- a/oled.h +++ b/oled.h @@ -29,11 +29,7 @@ #define OLED_HEIGHT 64 #define OLED_BUFSIZE (OLED_WIDTH * OLED_HEIGHT / 8) -#ifdef APPVER -#define oledInit() do{}while(0) -#else void oledInit(void); -#endif void oledClear(void); void oledRefresh(void); diff --git a/setup.c b/setup.c index 117a5b5cc..cb6ad1bf0 100644 --- a/setup.c +++ b/setup.c @@ -66,3 +66,9 @@ void setup(void) gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12); gpio_set_af(GPIOA, GPIO_AF10, GPIO11 | GPIO12); } + +void setupApp(void) +{ + // hotfix for old bootloader + gpio_mode_setup(GPIOA, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO9); +} diff --git a/setup.h b/setup.h index a54c81b95..ece89a52c 100644 --- a/setup.h +++ b/setup.h @@ -20,10 +20,7 @@ #ifndef __SETUP_H__ #define __SETUP_H__ -#ifdef APPVER -#define setup() do{}while(0) -#else void setup(void); -#endif +void setupApp(void); #endif