From 3f2869824cac0c4cfcb27ee91cdf5ececed23445 Mon Sep 17 00:00:00 2001 From: Mikhail Gaivoronskii Date: Fri, 20 Feb 2015 21:28:26 +0500 Subject: [PATCH] Uncrustified platform/cc2538dk/dev/button-sensor.c --- platform/cc2538dk/dev/button-sensor.c | 28 ++++++++++----------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/platform/cc2538dk/dev/button-sensor.c b/platform/cc2538dk/dev/button-sensor.c index ba45e20c3..ca6b88280 100644 --- a/platform/cc2538dk/dev/button-sensor.c +++ b/platform/cc2538dk/dev/button-sensor.c @@ -103,25 +103,17 @@ btn_callback(uint8_t port, uint8_t pin) } timer_set(&debouncetimer, CLOCK_SECOND / 8); - if(port == GPIO_A_NUM) { + + if((port == BUTTON_SELECT_PORT) && (pin == BUTTON_SELECT_PIN)) { sensors_changed(&button_select_sensor); - } else if(port == GPIO_C_NUM) { - switch(pin) { - case BUTTON_LEFT_PIN: - sensors_changed(&button_left_sensor); - break; - case BUTTON_RIGHT_PIN: - sensors_changed(&button_right_sensor); - break; - case BUTTON_UP_PIN: - sensors_changed(&button_up_sensor); - break; - case BUTTON_DOWN_PIN: - sensors_changed(&button_down_sensor); - break; - default: - return; - } + } else if((port == BUTTON_LEFT_PORT) && (pin == BUTTON_LEFT_PIN)) { + sensors_changed(&button_left_sensor); + } else if((port == BUTTON_RIGHT_PORT) && (pin == BUTTON_RIGHT_PIN)) { + sensors_changed(&button_right_sensor); + } else if((port == BUTTON_UP_PORT) && (pin == BUTTON_UP_PIN)) { + sensors_changed(&button_up_sensor); + } else if((port == BUTTON_DOWN_PORT) && (pin == BUTTON_DOWN_PIN)) { + sensors_changed(&button_down_sensor); } } /*---------------------------------------------------------------------------*/