From 01590088d390f875aa7eca269c3cdd5c1e4dfcbb Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 11 Jun 2016 19:43:04 +0100 Subject: [PATCH] Update to latest CCxxwares: Srf06+EM drivers --- platform/srf06-cc26xx/srf06/als-sensor.c | 12 +++---- platform/srf06-cc26xx/srf06/board.c | 6 ++-- platform/srf06-cc26xx/srf06/button-sensor.c | 36 ++++++++++----------- platform/srf06-cc26xx/srf06/leds-arch.c | 12 +++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/platform/srf06-cc26xx/srf06/als-sensor.c b/platform/srf06-cc26xx/srf06/als-sensor.c index f149d16a1..3b6fdecb9 100644 --- a/platform/srf06-cc26xx/srf06/als-sensor.c +++ b/platform/srf06-cc26xx/srf06/als-sensor.c @@ -59,18 +59,18 @@ config(int type, int enable) ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); break; case SENSORS_ACTIVE: - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); - ti_lib_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO, - IOC_STD_OUTPUT); - ti_lib_gpio_dir_mode_set(BOARD_ALS_OUT, GPIO_DIR_MODE_IN); + ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); + ti_lib_rom_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO, + IOC_STD_OUTPUT); + ti_lib_rom_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT); if(enable) { - ti_lib_gpio_pin_write(BOARD_ALS_PWR, 1); + ti_lib_gpio_set_dio(BOARD_IOID_ALS_PWR); aux_ctrl_register_consumer(&als_aux); ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7); clock_delay_usec(2000); } else { - ti_lib_gpio_pin_write(BOARD_ALS_PWR, 0); + ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR); aux_ctrl_unregister_consumer(&als_aux); } break; diff --git a/platform/srf06-cc26xx/srf06/board.c b/platform/srf06-cc26xx/srf06/board.c index 15528f79a..ffa77a011 100644 --- a/platform/srf06-cc26xx/srf06/board.c +++ b/platform/srf06-cc26xx/srf06/board.c @@ -50,7 +50,7 @@ lpm_handler(uint8_t mode) { /* Ambient light sensor (off, output low) */ ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); - ti_lib_gpio_pin_write(BOARD_ALS_PWR, 0); + ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR); ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT); ti_lib_ioc_io_port_pull_set(BOARD_IOID_ALS_OUT, IOC_NO_IOPULL); } @@ -77,11 +77,11 @@ configure_unused_pins(void) { /* Turn off 3.3-V domain (lcd/sdcard power, output low) */ ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_3V3_EN); - ti_lib_gpio_pin_write(BOARD_3V3_EN, 0); + ti_lib_gpio_clear_dio(BOARD_IOID_3V3_EN); /* Accelerometer (PWR output low, CSn output, high) */ ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ACC_PWR); - ti_lib_gpio_pin_write(BOARD_ACC_PWR, 0); + ti_lib_gpio_clear_dio(BOARD_IOID_ACC_PWR); } /*---------------------------------------------------------------------------*/ void diff --git a/platform/srf06-cc26xx/srf06/button-sensor.c b/platform/srf06-cc26xx/srf06/button-sensor.c index b397e86f5..23f668355 100644 --- a/platform/srf06-cc26xx/srf06/button-sensor.c +++ b/platform/srf06-cc26xx/srf06/button-sensor.c @@ -87,7 +87,7 @@ button_press_handler(uint8_t ioid) * Start press duration counter on press (falling), notify on release * (rising) */ - if(ti_lib_gpio_pin_read(BOARD_KEY_SELECT) == 0) { + if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_SELECT) == 0) { sel_timer.start = clock_time(); sel_timer.duration = 0; } else { @@ -107,7 +107,7 @@ button_press_handler(uint8_t ioid) * Start press duration counter on press (falling), notify on release * (rising) */ - if(ti_lib_gpio_pin_read(BOARD_KEY_LEFT) == 0) { + if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_LEFT) == 0) { left_timer.start = clock_time(); left_timer.duration = 0; } else { @@ -128,7 +128,7 @@ button_press_handler(uint8_t ioid) * Start press duration counter on press (falling), notify on release * (rising) */ - if(ti_lib_gpio_pin_read(BOARD_KEY_RIGHT) == 0) { + if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_RIGHT) == 0) { right_timer.start = clock_time(); right_timer.duration = 0; } else { @@ -151,7 +151,7 @@ button_press_handler(uint8_t ioid) * Start press duration counter on press (falling), notify on release * (rising) */ - if(ti_lib_gpio_pin_read(BOARD_KEY_UP) == 0) { + if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_UP) == 0) { up_timer.start = clock_time(); up_timer.duration = 0; } else { @@ -171,7 +171,7 @@ button_press_handler(uint8_t ioid) * Start press duration counter on press (falling), notify on release * (rising) */ - if(ti_lib_gpio_pin_read(BOARD_KEY_DOWN) == 0) { + if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_DOWN) == 0) { down_timer.start = clock_time(); down_timer.duration = 0; } else { @@ -193,19 +193,19 @@ config_buttons(int type, int c, uint32_t key) { switch(type) { case SENSORS_HW_INIT: - ti_lib_gpio_event_clear(1 << key); - ti_lib_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); - ti_lib_gpio_dir_mode_set((1 << key), GPIO_DIR_MODE_IN); + ti_lib_gpio_clear_event_dio(key); + ti_lib_rom_ioc_pin_type_gpio_input(key); + ti_lib_rom_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); gpio_interrupt_register_handler(key, button_press_handler); break; case SENSORS_ACTIVE: if(c) { - ti_lib_gpio_event_clear(1 << key); - ti_lib_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); - ti_lib_gpio_dir_mode_set((1 << key), GPIO_DIR_MODE_IN); - ti_lib_ioc_int_enable(key); + ti_lib_gpio_clear_event_dio(key); + ti_lib_rom_ioc_pin_type_gpio_input(key); + ti_lib_rom_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); + ti_lib_rom_ioc_int_enable(key); } else { - ti_lib_ioc_int_disable(key); + ti_lib_rom_ioc_int_disable(key); } break; default: @@ -327,7 +327,7 @@ static int value_select(int type) { if(type == BUTTON_SENSOR_VALUE_STATE) { - return ti_lib_gpio_pin_read(BOARD_KEY_SELECT) == 0 ? + return ti_lib_gpio_read_dio(BOARD_IOID_KEY_SELECT) == 0 ? BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; } else if(type == BUTTON_SENSOR_VALUE_DURATION) { return (int)sel_timer.duration; @@ -339,7 +339,7 @@ static int value_left(int type) { if(type == BUTTON_SENSOR_VALUE_STATE) { - return ti_lib_gpio_pin_read(BOARD_KEY_LEFT) == 0 ? + return ti_lib_gpio_read_dio(BOARD_IOID_KEY_LEFT) == 0 ? BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; } else if(type == BUTTON_SENSOR_VALUE_DURATION) { return (int)left_timer.duration; @@ -351,7 +351,7 @@ static int value_right(int type) { if(type == BUTTON_SENSOR_VALUE_STATE) { - return ti_lib_gpio_pin_read(BOARD_KEY_RIGHT) == 0 ? + return ti_lib_gpio_read_dio(BOARD_IOID_KEY_RIGHT) == 0 ? BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; } else if(type == BUTTON_SENSOR_VALUE_DURATION) { return (int)right_timer.duration; @@ -363,7 +363,7 @@ static int value_up(int type) { if(type == BUTTON_SENSOR_VALUE_STATE) { - return ti_lib_gpio_pin_read(BOARD_KEY_UP) == 0 ? + return ti_lib_gpio_read_dio(BOARD_IOID_KEY_UP) == 0 ? BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; } else if(type == BUTTON_SENSOR_VALUE_DURATION) { return (int)up_timer.duration; @@ -375,7 +375,7 @@ static int value_down(int type) { if(type == BUTTON_SENSOR_VALUE_STATE) { - return ti_lib_gpio_pin_read(BOARD_KEY_DOWN) == 0 ? + return ti_lib_gpio_read_dio(BOARD_IOID_KEY_DOWN) == 0 ? BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; } else if(type == BUTTON_SENSOR_VALUE_DURATION) { return (int)down_timer.duration; diff --git a/platform/srf06-cc26xx/srf06/leds-arch.c b/platform/srf06-cc26xx/srf06/leds-arch.c index 423789350..2a1627005 100644 --- a/platform/srf06-cc26xx/srf06/leds-arch.c +++ b/platform/srf06-cc26xx/srf06/leds-arch.c @@ -56,7 +56,7 @@ leds_arch_init(void) ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_3); ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_4); - ti_lib_gpio_pin_write(BOARD_LED_ALL, 0); + ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL); } /*---------------------------------------------------------------------------*/ unsigned char @@ -71,19 +71,19 @@ leds_arch_set(unsigned char leds) c = leds; /* Clear everything */ - ti_lib_gpio_pin_write(BOARD_LED_ALL, 0); + ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL); if((leds & LEDS_RED) == LEDS_RED) { - ti_lib_gpio_pin_write(BOARD_LED_1, 1); + ti_lib_gpio_set_dio(BOARD_IOID_LED_1); } if((leds & LEDS_YELLOW) == LEDS_YELLOW) { - ti_lib_gpio_pin_write(BOARD_LED_2, 1); + ti_lib_gpio_set_dio(BOARD_IOID_LED_2); } if((leds & LEDS_GREEN) == LEDS_GREEN) { - ti_lib_gpio_pin_write(BOARD_LED_3, 1); + ti_lib_gpio_set_dio(BOARD_IOID_LED_3); } if((leds & LEDS_ORANGE) == LEDS_ORANGE) { - ti_lib_gpio_pin_write(BOARD_LED_4, 1); + ti_lib_gpio_set_dio(BOARD_IOID_LED_4); } } /*---------------------------------------------------------------------------*/