Update to latest CCxxwares: Srf06+EM drivers

This commit is contained in:
George Oikonomou 2016-06-11 19:43:04 +01:00
parent f6437b6086
commit 01590088d3
4 changed files with 33 additions and 33 deletions

View file

@ -59,18 +59,18 @@ config(int type, int enable)
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR);
break; break;
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR);
ti_lib_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO, ti_lib_rom_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO,
IOC_STD_OUTPUT); IOC_STD_OUTPUT);
ti_lib_gpio_dir_mode_set(BOARD_ALS_OUT, GPIO_DIR_MODE_IN); ti_lib_rom_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT);
if(enable) { 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); aux_ctrl_register_consumer(&als_aux);
ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7); ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7);
clock_delay_usec(2000); clock_delay_usec(2000);
} else { } 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); aux_ctrl_unregister_consumer(&als_aux);
} }
break; break;

View file

@ -50,7 +50,7 @@ lpm_handler(uint8_t mode)
{ {
/* Ambient light sensor (off, output low) */ /* Ambient light sensor (off, output low) */
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); 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_pin_type_gpio_input(BOARD_IOID_ALS_OUT);
ti_lib_ioc_io_port_pull_set(BOARD_IOID_ALS_OUT, IOC_NO_IOPULL); 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) */ /* Turn off 3.3-V domain (lcd/sdcard power, output low) */
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_3V3_EN); 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) */ /* Accelerometer (PWR output low, CSn output, high) */
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ACC_PWR); 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 void

View file

@ -87,7 +87,7 @@ button_press_handler(uint8_t ioid)
* Start press duration counter on press (falling), notify on release * Start press duration counter on press (falling), notify on release
* (rising) * (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.start = clock_time();
sel_timer.duration = 0; sel_timer.duration = 0;
} else { } else {
@ -107,7 +107,7 @@ button_press_handler(uint8_t ioid)
* Start press duration counter on press (falling), notify on release * Start press duration counter on press (falling), notify on release
* (rising) * (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.start = clock_time();
left_timer.duration = 0; left_timer.duration = 0;
} else { } else {
@ -128,7 +128,7 @@ button_press_handler(uint8_t ioid)
* Start press duration counter on press (falling), notify on release * Start press duration counter on press (falling), notify on release
* (rising) * (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.start = clock_time();
right_timer.duration = 0; right_timer.duration = 0;
} else { } else {
@ -151,7 +151,7 @@ button_press_handler(uint8_t ioid)
* Start press duration counter on press (falling), notify on release * Start press duration counter on press (falling), notify on release
* (rising) * (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.start = clock_time();
up_timer.duration = 0; up_timer.duration = 0;
} else { } else {
@ -171,7 +171,7 @@ button_press_handler(uint8_t ioid)
* Start press duration counter on press (falling), notify on release * Start press duration counter on press (falling), notify on release
* (rising) * (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.start = clock_time();
down_timer.duration = 0; down_timer.duration = 0;
} else { } else {
@ -193,19 +193,19 @@ config_buttons(int type, int c, uint32_t key)
{ {
switch(type) { switch(type) {
case SENSORS_HW_INIT: case SENSORS_HW_INIT:
ti_lib_gpio_event_clear(1 << key); ti_lib_gpio_clear_event_dio(key);
ti_lib_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); ti_lib_rom_ioc_pin_type_gpio_input(key);
ti_lib_gpio_dir_mode_set((1 << key), GPIO_DIR_MODE_IN); ti_lib_rom_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG);
gpio_interrupt_register_handler(key, button_press_handler); gpio_interrupt_register_handler(key, button_press_handler);
break; break;
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
if(c) { if(c) {
ti_lib_gpio_event_clear(1 << key); ti_lib_gpio_clear_event_dio(key);
ti_lib_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG); ti_lib_rom_ioc_pin_type_gpio_input(key);
ti_lib_gpio_dir_mode_set((1 << key), GPIO_DIR_MODE_IN); ti_lib_rom_ioc_port_configure_set(key, IOC_PORT_GPIO, BUTTON_GPIO_CFG);
ti_lib_ioc_int_enable(key); ti_lib_rom_ioc_int_enable(key);
} else { } else {
ti_lib_ioc_int_disable(key); ti_lib_rom_ioc_int_disable(key);
} }
break; break;
default: default:
@ -327,7 +327,7 @@ static int
value_select(int type) value_select(int type)
{ {
if(type == BUTTON_SENSOR_VALUE_STATE) { 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; BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED;
} else if(type == BUTTON_SENSOR_VALUE_DURATION) { } else if(type == BUTTON_SENSOR_VALUE_DURATION) {
return (int)sel_timer.duration; return (int)sel_timer.duration;
@ -339,7 +339,7 @@ static int
value_left(int type) value_left(int type)
{ {
if(type == BUTTON_SENSOR_VALUE_STATE) { 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; BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED;
} else if(type == BUTTON_SENSOR_VALUE_DURATION) { } else if(type == BUTTON_SENSOR_VALUE_DURATION) {
return (int)left_timer.duration; return (int)left_timer.duration;
@ -351,7 +351,7 @@ static int
value_right(int type) value_right(int type)
{ {
if(type == BUTTON_SENSOR_VALUE_STATE) { 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; BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED;
} else if(type == BUTTON_SENSOR_VALUE_DURATION) { } else if(type == BUTTON_SENSOR_VALUE_DURATION) {
return (int)right_timer.duration; return (int)right_timer.duration;
@ -363,7 +363,7 @@ static int
value_up(int type) value_up(int type)
{ {
if(type == BUTTON_SENSOR_VALUE_STATE) { 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; BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED;
} else if(type == BUTTON_SENSOR_VALUE_DURATION) { } else if(type == BUTTON_SENSOR_VALUE_DURATION) {
return (int)up_timer.duration; return (int)up_timer.duration;
@ -375,7 +375,7 @@ static int
value_down(int type) value_down(int type)
{ {
if(type == BUTTON_SENSOR_VALUE_STATE) { 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; BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED;
} else if(type == BUTTON_SENSOR_VALUE_DURATION) { } else if(type == BUTTON_SENSOR_VALUE_DURATION) {
return (int)down_timer.duration; return (int)down_timer.duration;

View file

@ -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_3);
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_4); 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 unsigned char
@ -71,19 +71,19 @@ leds_arch_set(unsigned char leds)
c = leds; c = leds;
/* Clear everything */ /* 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) { 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) { 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) { 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) { if((leds & LEDS_ORANGE) == LEDS_ORANGE) {
ti_lib_gpio_pin_write(BOARD_LED_4, 1); ti_lib_gpio_set_dio(BOARD_IOID_LED_4);
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/