Update to latest CCxxwares: Sensortag drivers

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

View File

@ -75,7 +75,7 @@ shutdown_handler(uint8_t mode)
SENSORS_DEACTIVATE(tmp_007_sensor);
SENSORS_DEACTIVATE(hdc_1000_sensor);
SENSORS_DEACTIVATE(mpu_9250_sensor);
ti_lib_gpio_pin_clear(BOARD_MPU_POWER);
ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER);
}
/* In all cases, stop the I2C */
@ -111,7 +111,7 @@ configure_unused_pins(void)
/* Digital Microphone */
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_MIC_POWER);
ti_lib_gpio_pin_clear((1 << BOARD_IOID_MIC_POWER));
ti_lib_gpio_clear_dio(BOARD_IOID_MIC_POWER);
ti_lib_ioc_io_drv_strength_set(BOARD_IOID_MIC_POWER, IOC_CURRENT_2MA,
IOC_STRENGTH_MIN);

View File

@ -86,7 +86,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 {
@ -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_RIGHT) == 0) {
if(ti_lib_gpio_read_dio(BOARD_IOID_KEY_RIGHT) == 0) {
right_timer.start = clock_time();
right_timer.duration = 0;
} else {
@ -132,19 +132,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:
@ -225,7 +225,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;
@ -237,7 +237,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);
}
}
/*---------------------------------------------------------------------------*/

View File

@ -505,7 +505,7 @@ initialise(void *not_used)
static void
power_up(void)
{
ti_lib_gpio_pin_write(BOARD_MPU_POWER, 1);
ti_lib_gpio_set_dio(BOARD_IOID_MPU_POWER);
state = SENSOR_STATE_BOOTING;
ctimer_set(&startup_timer, SENSOR_BOOT_DELAY, initialise, NULL);
@ -608,7 +608,7 @@ configure(int type, int enable)
ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_MPU_POWER);
ti_lib_ioc_io_drv_strength_set(BOARD_IOID_MPU_POWER, IOC_CURRENT_4MA,
IOC_STRENGTH_MAX);
ti_lib_gpio_pin_clear(BOARD_MPU_POWER);
ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER);
elements = MPU_9250_SENSOR_TYPE_NONE;
break;
case SENSORS_ACTIVE:
@ -629,7 +629,7 @@ configure(int type, int enable)
sensor_sleep();
while(ti_lib_i2c_master_busy(I2C0_BASE));
state = SENSOR_STATE_DISABLED;
ti_lib_gpio_pin_clear(BOARD_MPU_POWER);
ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER);
}
}
break;

View File

@ -74,7 +74,7 @@ reed_interrupt_handler(uint8_t ioid)
static int
value(int type)
{
return (int)ti_lib_gpio_pin_read(1 << BOARD_IOID_REED_RELAY);
return (int)ti_lib_gpio_read_dio(BOARD_IOID_REED_RELAY);
}
/*---------------------------------------------------------------------------*/
/**
@ -91,7 +91,7 @@ configure(int type, int value)
switch(type) {
case SENSORS_HW_INIT:
ti_lib_ioc_int_disable(BOARD_IOID_REED_RELAY);
ti_lib_gpio_event_clear(1 << BOARD_IOID_REED_RELAY);
ti_lib_gpio_clear_event_dio(BOARD_IOID_REED_RELAY);
/* Enable the GPIO clock when the CM3 is running */
ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO);