From 708e9eb417ddf41ec345f2be70c4a32721608e4c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 29 Jan 2015 11:29:43 +0100 Subject: Replace enums with uint8_t Saves a few bytes, since enums are 16 bit --- ui.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index e45acaf..c7a2364 100644 --- a/ui.c +++ b/ui.c @@ -34,30 +34,30 @@ #define FLASH_CONFIRM_FINE_OFF FLASH_ENTER_FINE_OFF #define FLASH_CONFIRM_FINE_NUM (2) -typedef enum { - /* initialize */ - UIMODE_INIT = 0, - /* deep sleep */ - UIMODE_SLEEP, - /* select time */ - UIMODE_SELECT_COARSE, - UIMODE_SELECT_FINE, - /* idle */ - UIMODE_IDLE, - /* count time */ - UIMODE_RUN, - /* flash leds */ - UIMODE_FLASH_ON, - UIMODE_FLASH_OFF, -} uimode; - -typedef enum { - FLASH_NONE = 0, - FLASH_ALARM, - FLASH_ENTER_COARSE, - FLASH_CONFIRM_COARSE, - FLASH_CONFIRM_FINE, -} flashmode; +/* UI modes, enum would take 16 bits */ +typedef uint8_t uimode; +/* initialize */ +#define UIMODE_INIT 0 +/* deep sleep */ +#define UIMODE_SLEEP 1 +/* select time */ +#define UIMODE_SELECT_COARSE 2 +#define UIMODE_SELECT_FINE 3 +/* idle */ +#define UIMODE_IDLE 4 +/* count time */ +#define UIMODE_RUN 5 +/* flash leds */ +#define UIMODE_FLASH_ON 6 +#define UIMODE_FLASH_OFF 7 + +/* flash modes */ +typedef uint8_t flashmode; +#define FLASH_NONE 0 +#define FLASH_ALARM 1 +#define FLASH_ENTER_COARSE 2 +#define FLASH_CONFIRM_COARSE 3 +#define FLASH_CONFIRM_FINE 4 /* nextmode is used for deciding which mode _FLASH transitions into */ static uimode mode = UIMODE_INIT; -- cgit v1.2.3