Update to latest CCxxwares: Launchpad drivers

This commit is contained in:
George Oikonomou 2016-06-11 19:42:00 +01:00
parent c42cb2b0cb
commit 5de7b1bbac
2 changed files with 17 additions and 17 deletions

View File

@ -83,7 +83,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 {
@ -104,7 +104,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 {
@ -122,19 +122,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:
@ -164,7 +164,7 @@ status(int type, uint32_t key_io_id)
switch(type) {
case SENSORS_ACTIVE:
case SENSORS_READY:
if(ti_lib_ioc_port_configure_get(key_io_id) & IOC_INT_ENABLE) {
if(ti_lib_rom_ioc_port_configure_get(key_io_id) & IOC_INT_ENABLE) {
return 1;
}
break;
@ -178,7 +178,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;
@ -190,7 +190,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;

View File

@ -55,7 +55,7 @@ leds_arch_init(void)
ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_LED_1);
ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_LED_2);
ti_lib_gpio_pin_write(BOARD_LED_ALL, 0);
ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL);
}
/*---------------------------------------------------------------------------*/
unsigned char
@ -68,13 +68,13 @@ void
leds_arch_set(unsigned char leds)
{
c = leds;
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);
}
}
/*---------------------------------------------------------------------------*/