tm4c1294-launchpad: Use bmi160 driver for boostxl-sensors.
Use the preexisting bmi160 driver for the boostxl-sensors boosterpack. Add macros to allow the bluetooth module to be used with UART6.
This commit is contained in:
parent
71d7028c4a
commit
4ff4562401
@ -110,4 +110,20 @@ config TM4C1294_LAUNCHPAD_UART2_TX_D5
|
||||
|
||||
endchoice # UART2 Tx pin selection
|
||||
|
||||
choice
|
||||
prompt "Sensors selection"
|
||||
depends on TIVA_I2C
|
||||
default BOOSTXL_SENSORS_NONE
|
||||
|
||||
config BOOSTXL_SENSORS_NONE
|
||||
bool "None"
|
||||
|
||||
config BOOSTXL_SENSORS_1
|
||||
bool "BOOSTXL-SENSORS on BOOSTERPACK1"
|
||||
depends on TIVA_I2C0
|
||||
|
||||
config BOOSTXL_SENSORS_2
|
||||
bool "BOOSTXL-SENSORS on BOOSTERPACK2"
|
||||
depends on TIVA_I2C2
|
||||
endchoice
|
||||
endif # ARCH_BOARD_TM4C1294_LAUNCHPAD
|
||||
|
@ -202,19 +202,40 @@
|
||||
#define GPIO_UART2_TX GPIO_UART2_TX_1
|
||||
#endif
|
||||
|
||||
/* Control pins for BOOST-CC2564MODA plugged into BoosterPack1
|
||||
/* Control pins for BOOST-CC2564MODA plugged into BoosterPack 1 or 2.
|
||||
*
|
||||
* --- ------------
|
||||
* Pin Pin Function
|
||||
* --- ------------
|
||||
* PM3 NSHUTD
|
||||
* PG0 RTS
|
||||
* PL4 CTS
|
||||
* --- ------------
|
||||
* BoosterPack1 BoosterPack2
|
||||
*
|
||||
* --- ------------ --- ------------
|
||||
* Pin Pin Function Pin Pin Function
|
||||
* --- ------------ --- ------------
|
||||
* PM3 NSHUTD PM7 NSHUTD
|
||||
* PG0 RTS PM0 RTS
|
||||
* PL4 CTS PM1 CTS
|
||||
* --- ------------ --- ------------
|
||||
*/
|
||||
|
||||
#define UART7_GPIO_NSHUTD (GPIO_FUNC_OUTPUT | GPIO_PORTM | GPIO_PIN_3)
|
||||
#define UART7_GPIO_RTS (GPIO_FUNC_OUTPUT | GPIO_PORTG | GPIO_PIN_0)
|
||||
#define UART7_GPIO_CTS (GPIO_FUNC_INPUT | GPIO_PORTL | GPIO_PIN_4)
|
||||
|
||||
#define UART6_GPIO_NSHUTD (GPIO_FUNC_OUTPUT | GPIO_PORTM | GPIO_PIN_7)
|
||||
#define UART6_GPIO_RTS (GPIO_FUNC_OUTPUT | GPIO_PORTM | GPIO_PIN_0)
|
||||
#define UART6_GPIO_CTS (GPIO_FUNC_INPUT | GPIO_PORTM | GPIO_PIN_1)
|
||||
|
||||
/* Pins for I2C.
|
||||
*
|
||||
* BoosterPack1 I2C0 BoosterPack2 I2C2
|
||||
*
|
||||
* --- ------------ --- ------------
|
||||
* Pin Pin Function Pin Pin Function
|
||||
* --- ------------ --- ------------
|
||||
* PB2 SCL PN5 SCL
|
||||
* PB3 SDA PN4 SDA
|
||||
* --- ------------ --- ------------
|
||||
*/
|
||||
|
||||
#define GPIO_I2C2_SCL GPIO_I2C2_SCL_3
|
||||
#define GPIO_I2C2_SDA GPIO_I2C2_SDA_2
|
||||
|
||||
#endif /* __BOARDS_ARM_TIVA_TM4C1294_LAUNCHPAD_INCLUDE_BOARD_H */
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/bmi160.h>
|
||||
#include <nuttx/sensors/qencoder.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
@ -151,6 +152,46 @@ static void tm4c_i2ctool(void)
|
||||
# define tm4c_i2ctool()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tm4c_bmi160_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the bmi160 sensor.
|
||||
*
|
||||
* Input Parameters:
|
||||
* bus - A number identifying the I2C bus.
|
||||
*
|
||||
* Returned Value:
|
||||
* On success, zero (OK) is returned. On failure, a negated errno value
|
||||
* is returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMI160
|
||||
static int tm4c_bmi160_setup(int bus)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_master_s *i2c;
|
||||
|
||||
/* Initialize i2c device */
|
||||
|
||||
i2c = tiva_i2cbus_initialize(bus);
|
||||
if (!i2c)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize i2c%d.\n", bus);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = bmi160_register("/dev/accel0", i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Error registering BMI160\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tm4c_pwm_register
|
||||
*
|
||||
@ -306,6 +347,25 @@ int tm4c_bringup(void)
|
||||
|
||||
tm4c_i2ctool();
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMI160
|
||||
#if defined(CONFIG_BOOSTXL_SENSORS_1)
|
||||
|
||||
ret = tm4c_bmi160_setup(0);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: BMI160 on 1 failed %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_BOOSTXL_SENSORS_2)
|
||||
|
||||
ret = tm4c_bmi160_setup(2);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: BMI160 on 2 failed %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user