Fixed CC2650STK board files, and leds-arch for sensortag

This commit is contained in:
Edvard Pettersen 2018-05-31 18:21:14 +02:00
parent 40227d0817
commit 2d69241381
15 changed files with 353 additions and 228 deletions

View File

@ -33,7 +33,7 @@ RF_Mode RF_ieeeMode =
// RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient)
// See the Technical Reference Manual for further details about the "txPower" Command field.
// The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
RF_TxPowerTable_Entry txPowerTable[14] =
RF_TxPowerTable_Entry ieeeTxPowerTable[14] =
{
{ -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 6) },
{ -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 6) },
@ -53,7 +53,7 @@ RF_TxPowerTable_Entry txPowerTable[14] =
// Overrides for CMD_RADIO_SETUP
uint32_t pOverrides[] =
uint32_t pIeeeOverrides[] =
{
// override_synth_ieee_15_4.xml
HW_REG_OVERRIDE(0x4038,0x0035), // Synth: Set recommended RTRIM to 5
@ -101,12 +101,12 @@ rfc_CMD_RADIO_SETUP_t RF_cmdRadioSetup =
.config.analogCfgMode = 0x0,
.config.bNoFsPowerUp = 0x0,
.txPower = 0x9330,
.pRegOverride = pOverrides,
.pRegOverride = pIeeeOverrides,
};
// CMD_FS
// Frequency Synthesizer Programming Command
rfc_CMD_FS_t RF_cmdFs =
rfc_CMD_FS_t RF_cmdIeeeFs =
{
.commandNo = 0x0803,
.status = 0x0000,

View File

@ -20,17 +20,17 @@ extern RF_Mode RF_ieeeMode;
// TX Power Table
extern RF_TxPowerTable_Entry txPowerTable[14];
extern RF_TxPowerTable_Entry ieeeTxPowerTable[14];
// RF Core API commands
extern rfc_CMD_RADIO_SETUP_t RF_cmdRadioSetup;
extern rfc_CMD_FS_t RF_cmdFs;
extern rfc_CMD_FS_t RF_cmdIeeeFs;
extern rfc_CMD_IEEE_TX_t RF_cmdIeeeTx;
extern rfc_CMD_IEEE_RX_t RF_cmdIeeeRx;
// RF Core API Overrides
extern uint32_t pOverrides[];
extern uint32_t pIeeeOverrides[];
#endif // _IEEE_SETTINGS_H_

View File

@ -38,6 +38,8 @@
#ifndef CONTIKI_CONF_H_
#define CONTIKI_CONF_H_
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
#include PROJECT_CONF_PATH

View File

@ -48,13 +48,17 @@
/*---------------------------------------------------------------------------*/
/* Simplelink SDK includes */
#include <Board.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/Power.h>
#include <driverlib/driverlib_release.h>
#include <driverlib/chipinfo.h>
#include <driverlib/vims.h>
#include <driverlib/interrupt.h>
#include <NoRTOS.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/driverlib_release.h)
#include DeviceFamily_constructPath(driverlib/chipinfo.h)
#include DeviceFamily_constructPath(driverlib/vims.h)
#include DeviceFamily_constructPath(driverlib/interrupt.h)
#include <ti/drivers/GPIO.h>
#include <ti/drivers/I2C.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/SPI.h>
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
@ -135,34 +139,23 @@ platform_init_stage_one(void)
// Configure round robin arbitration and prefetching
VIMSConfigure(VIMS_BASE, true, true);
Board_initGeneral();
GPIO_init();
// NoRTOS_start only enables HWI
NoRTOS_start();
// Board_initGeneral() will call Power_init()
// Board_initGeneral() will call PIN_init(BoardGpioInitTable)
Board_initGeneral();
Board_shutDownExtFlash();
// Contiki drivers init
leds_init();
// ti_lib_int_master_disable();
//
// /* Set the LF XOSC as the LF system clock source */
// oscillators_select_lf_xosc();
//
// lpm_init();
//
fade(LEDS_RED);
//
// /*
// * Disable I/O pad sleep mode and open I/O latches in the AON IOC interface
// * This is only relevant when returning from shutdown (which is what froze
// * latches in the first place. Before doing these things though, we should
// * allow software to first regain control of pins
// */
// ti_lib_pwr_ctrl_io_freeze_disable();
//
// ti_lib_int_master_enable();
//
GPIO_init();
I2C_init();
SPI_init();
fade(LEDS_GREEN);
}
/*---------------------------------------------------------------------------*/

View File

@ -45,6 +45,20 @@ extern "C" {
#define Board_shutDownExtFlash() CC1350STK_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC1350STK_wakeUpExtFlash()
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
*
* Those values are not meant to be modified by the user
* @{
*/
#define LEDS_RED (1 << 0)
#define LEDS_GREEN LEDS_RED
#define LEDS_YELLOW LEDS_RED
#define LEDS_ORANGE LEDS_RED
#define LEDS_CONF_ALL (LEDS_RED)
/*---------------------------------------------------------------------------*/
/* These #defines allow us to reuse TI-RTOS across other device families */
#define Board_BUZZER CC1350STK_BUZZER

View File

@ -50,7 +50,8 @@ extern "C" {
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/ioc.h)
/* Externs */
extern const PIN_Config BoardGpioInitTable[];

View File

@ -6,6 +6,7 @@ DEVICE_FAMILY = CC13X0
DEVICE_LINE = CC13XX
BOARD_SOURCEFILES += CC1350STK.c CC1350STK_fxns.c
BOARD_SOURCEFILES += leds-arch.c
SUPPORTS_PROP_MODE = 1
SUPPORTS_IEEE_MODE = 1

View File

@ -43,17 +43,20 @@
/* Simplelink SDK API */
#include <Board.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/PIN.h>
/*---------------------------------------------------------------------------*/
/* Standard library */
#include <stdbool.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/* Available LED configuration */
static const PIN_Config pin_table[] = {
Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
static PIN_State pin_state;
static PIN_Handle pin_handle;
/* LED */
#define LEDS_ARCH Board_GPIO_LED0
/*---------------------------------------------------------------------------*/
static volatile unsigned char c;
/*---------------------------------------------------------------------------*/
void
@ -63,12 +66,14 @@ leds_arch_init(void)
if(bHasInit) {
return;
}
bHasInit = true;
// GPIO_init will most likely be called in platform.c,
// but call it here to be sure GPIO is initialized.
// Calling GPIO_init multiple times is safe.
GPIO_init();
// PIN_init() called from Board_initGeneral()
pin_handle = PIN_open(&pin_state, pin_table);
if (!pin_handle) {
return;
}
bHasInit = true;
}
/*---------------------------------------------------------------------------*/
unsigned char
@ -77,23 +82,16 @@ leds_arch_get(void)
return c;
}
/*---------------------------------------------------------------------------*/
static inline void
write_led(const bool on, const uint_fast32_t gpioLed)
{
const GPIO_PinConfig pinCfg = (on)
? Board_GPIO_LED_ON
: Board_GPIO_LED_OFF;
GPIO_write(gpioLed, pinCfg);
}
/*---------------------------------------------------------------------------*/
void
leds_arch_set(unsigned char leds)
{
c = leds;
// Green LED
uint_fast32_t gpioOn = (leds & (LEDS_ARCH)) == (LEDS_ARCH);
write_led(gpioOn, LEDS_ARCH);
PIN_setPortOutputValue(pin_handle, 0);
if (leds & LEDS_RED) {
PIN_setOutputValue(pin_handle, Board_PIN_LED0, 1);
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -45,6 +45,20 @@ extern "C" {
#define Board_shutDownExtFlash() CC2650STK_shutDownExtFlash()
#define Board_wakeUpExtFlash() CC2650STK_wakeUpExtFlash()
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
*
* Those values are not meant to be modified by the user
* @{
*/
#define LEDS_RED (1 << 0)
#define LEDS_GREEN (1 << 1)
#define LEDS_YELLOW LEDS_GREEN
#define LEDS_ORANGE LEDS_RED
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
/*---------------------------------------------------------------------------*/
/* These #defines allow us to reuse TI-RTOS across other device families */
#define Board_BUZZER CC2650STK_BUZZER
@ -87,6 +101,8 @@ extern "C" {
#define Board_MPU_POWER_OFF CC2650STK_MPU_POWER_OFF
#define Board_MPU_POWER_ON CC2650STK_MPU_POWER_ON
#define Board_TMP_RDY CC2650STK_TMP_RDY
#define Board_NVSINTERNAL CC2650STK_NVSCC26XX0
#define Board_NVSEXTERNAL CC2650STK_NVSSPI25X0
@ -94,7 +110,7 @@ extern "C" {
#define Board_PIN_BUTTON0 CC2650STK_KEY_LEFT
#define Board_PIN_BUTTON1 CC2650STK_KEY_RIGHT
#define Board_PIN_LED0 CC2650STK_PIN_LED1
#define Board_PIN_LED0 CC2650STK_PIN_LED0
#define Board_PIN_LED1 CC2650STK_PIN_LED1
#define Board_PIN_LED2 CC2650STK_PIN_LED1

View File

@ -43,10 +43,11 @@
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
#include <ti/devices/cc13x0/driverlib/udma.h>
#include <ti/devices/cc13x0/inc/hw_ints.h>
#include <ti/devices/cc13x0/inc/hw_memmap.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/ioc.h)
#include DeviceFamily_constructPath(driverlib/udma.h)
#include DeviceFamily_constructPath(inc/hw_ints.h)
#include DeviceFamily_constructPath(inc/hw_memmap.h)
#include "CC2650STK.h"

View File

@ -30,19 +30,19 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** ============================================================================
* @file CC1350STK.h
* @file CC2650STK.h
*
* @brief CC1350STK Board Specific header file.
* @brief CC2650STK Board Specific header file.
*
* The CC1350STK header file should be included in an application as
* The CC2650STK header file should be included in an application as
* follows:
* @code
* #include "CC1350STK.h"
* #include "CC2650STK.h"
* @endcode
* ============================================================================
*/
#ifndef __CC1350STK_BOARD_H__
#define __CC1350STK_BOARD_H__
#ifndef __CC2650STK_BOARD_H__
#define __CC2650STK_BOARD_H__
#ifdef __cplusplus
extern "C" {
@ -50,119 +50,121 @@ extern "C" {
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/ioc.h)
/* Externs */
extern const PIN_Config BoardGpioInitTable[];
/* Defines */
#define CC1350STK
#define CC2650STK
/* Mapping of pins to board signals using general board aliases
* <board signal alias> <pin mapping>
*/
/* Audio */
#define CC1350STK_MIC_POWER IOID_13
#define CC1350STK_MIC_POWER_ON 1
#define CC1350STK_MIC_POWER_OFF 0
#define CC1350STK_AUDIO_DI IOID_2
#define CC1350STK_AUDIO_CLK IOID_3
#define CC2650STK_MIC_POWER IOID_13
#define CC2650STK_MIC_POWER_ON 1
#define CC2650STK_MIC_POWER_OFF 0
#define CC2650STK_AUDIO_DI IOID_2
#define CC2650STK_AUDIO_CLK IOID_11
/* Buzzer */
#define CC1350STK_BUZZER IOID_21
#define CC1350STK_BUZZER_ON 1
#define CC1350STK_BUZZER_OFF 0
#define CC2650STK_BUZZER IOID_21
#define CC2650STK_BUZZER_ON 1
#define CC2650STK_BUZZER_OFF 0
/* DevPack */
#define CC1350STK_AUDIOFS_TDO IOID_16
#define CC1350STK_AUDIODO IOID_22
#define CC1350STK_DP2 IOID_23
#define CC1350STK_DP1 IOID_24
#define CC1350STK_DP0 IOID_25
#define CC1350STK_DP3 IOID_27
#define CC1350STK_DP4_UARTRX IOID_28
#define CC1350STK_DP5_UARTTX IOID_29
#define CC1350STK_DEVPK_ID IOID_30
#define CC1350STK_SPI_DEVPK_CS IOID_20
#define CC2650STK_AUDIOFS_TDO IOID_16
#define CC2650STK_AUDIODO IOID_22
#define CC2650STK_DP2 IOID_23
#define CC2650STK_DP1 IOID_24
#define CC2650STK_DP0 IOID_25
#define CC2650STK_DP3 IOID_27
#define CC2650STK_DP4_UARTRX IOID_28
#define CC2650STK_DP5_UARTTX IOID_29
#define CC2650STK_DEVPK_ID IOID_30
#define CC2650STK_SPI_DEVPK_CS IOID_20
/* Discrete Outputs */
#define CC1350STK_PIN_LED1 IOID_10
#define CC1350STK_LED_ON 1
#define CC1350STK_LED_OFF 0
#define CC2650STK_PIN_LED0 IOID_10
#define CC2650STK_PIN_LED1 IOID_15
#define CC2650STK_LED_ON 1
#define CC2650STK_LED_OFF 0
/* Discrete Inputs */
#define CC1350STK_KEY_LEFT IOID_15
#define CC1350STK_KEY_RIGHT IOID_4
#define CC1350STK_RELAY IOID_1
#define CC2650STK_KEY_LEFT IOID_0
#define CC2650STK_KEY_RIGHT IOID_4
#define CC2650STK_RELAY IOID_3
/* GPIO */
#define CC1350STK_GPIO_LED_ON 1
#define CC1350STK_GPIO_LED_OFF 0
#define CC2650STK_GPIO_LED_ON 1
#define CC2650STK_GPIO_LED_OFF 0
/* I2C */
#define CC1350STK_I2C0_SDA0 IOID_5
#define CC1350STK_I2C0_SCL0 IOID_6
#define CC1350STK_I2C0_SDA1 IOID_8
#define CC1350STK_I2C0_SCL1 IOID_9
#define CC2650STK_I2C0_SDA0 IOID_5
#define CC2650STK_I2C0_SCL0 IOID_6
#define CC2650STK_I2C0_SDA1 IOID_8
#define CC2650STK_I2C0_SCL1 IOID_9
/* LED-Audio DevPack */
#define CC1350STK_DEVPK_LIGHT_BLUE IOID_23
#define CC1350STK_DEVPK_LIGHT_GREEN IOID_24
#define CC1350STK_DEVPK_LIGHT_WHITE IOID_25
#define CC1350STK_DEVPK_LIGHT_RED IOID_27
#define CC2650STK_DEVPK_LIGHT_BLUE IOID_23
#define CC2650STK_DEVPK_LIGHT_GREEN IOID_24
#define CC2650STK_DEVPK_LIGHT_WHITE IOID_25
#define CC2650STK_DEVPK_LIGHT_RED IOID_27
/* Power */
#define CC1350STK_MPU_POWER IOID_12
#define CC1350STK_MPU_POWER_ON 1
#define CC1350STK_MPU_POWER_OFF 0
#define CC2650STK_MPU_POWER IOID_12
#define CC2650STK_MPU_POWER_ON 1
#define CC2650STK_MPU_POWER_OFF 0
/* PWM */
#define CC1350STK_PWMPIN0 CC1350STK_PIN_LED1
#define CC1350STK_PWMPIN1 CC1350STK_PIN_LED1
#define CC1350STK_PWMPIN2 PIN_UNASSIGNED
#define CC1350STK_PWMPIN3 PIN_UNASSIGNED
#define CC1350STK_PWMPIN4 PIN_UNASSIGNED
#define CC1350STK_PWMPIN5 PIN_UNASSIGNED
#define CC1350STK_PWMPIN6 PIN_UNASSIGNED
#define CC1350STK_PWMPIN7 PIN_UNASSIGNED
#define CC2650STK_PWMPIN0 CC2650STK_PIN_LED1
#define CC2650STK_PWMPIN1 CC2650STK_PIN_LED1
#define CC2650STK_PWMPIN2 PIN_UNASSIGNED
#define CC2650STK_PWMPIN3 PIN_UNASSIGNED
#define CC2650STK_PWMPIN4 PIN_UNASSIGNED
#define CC2650STK_PWMPIN5 PIN_UNASSIGNED
#define CC2650STK_PWMPIN6 PIN_UNASSIGNED
#define CC2650STK_PWMPIN7 PIN_UNASSIGNED
/* Sensors */
#define CC1350STK_MPU_INT IOID_7
#define CC1350STK_TMP_RDY IOID_11
#define CC2650STK_MPU_INT IOID_7
#define CC2650STK_TMP_RDY IOID_1
/* SPI */
#define CC1350STK_SPI_FLASH_CS IOID_14
#define CC1350STK_FLASH_CS_ON 0
#define CC1350STK_FLASH_CS_OFF 1
#define CC2650STK_SPI_FLASH_CS IOID_14
#define CC2650STK_FLASH_CS_ON 0
#define CC2650STK_FLASH_CS_OFF 1
/* SPI Board */
#define CC1350STK_SPI0_MISO IOID_18
#define CC1350STK_SPI0_MOSI IOID_19
#define CC1350STK_SPI0_CLK IOID_17
#define CC1350STK_SPI0_CSN PIN_UNASSIGNED
#define CC1350STK_SPI1_MISO PIN_UNASSIGNED
#define CC1350STK_SPI1_MOSI PIN_UNASSIGNED
#define CC1350STK_SPI1_CLK PIN_UNASSIGNED
#define CC1350STK_SPI1_CSN PIN_UNASSIGNED
#define CC2650STK_SPI0_MISO IOID_18
#define CC2650STK_SPI0_MOSI IOID_19
#define CC2650STK_SPI0_CLK IOID_17
#define CC2650STK_SPI0_CSN PIN_UNASSIGNED
#define CC2650STK_SPI1_MISO PIN_UNASSIGNED
#define CC2650STK_SPI1_MOSI PIN_UNASSIGNED
#define CC2650STK_SPI1_CLK PIN_UNASSIGNED
#define CC2650STK_SPI1_CSN PIN_UNASSIGNED
/* UART */
#define CC1350STK_UART_TX CC1350STK_DP5_UARTTX
#define CC1350STK_UART_RX CC1350STK_DP4_UARTRX
#define CC2650STK_UART_TX CC2650STK_DP5_UARTTX
#define CC2650STK_UART_RX CC2650STK_DP4_UARTRX
/*!
* @brief Initialize the general board specific settings
*
* This function initializes the general board specific settings.
*/
void CC1350STK_initGeneral(void);
void CC2650STK_initGeneral(void);
/*!
* @brief Turn off the external flash on LaunchPads
*
*/
void CC1350STK_shutDownExtFlash(void);
void CC2650STK_shutDownExtFlash(void);
/*!
* @brief Wake up the external flash present on the board files
@ -170,154 +172,154 @@ void CC1350STK_shutDownExtFlash(void);
* This function toggles the chip select for the amount of time needed
* to wake the chip up.
*/
void CC1350STK_wakeUpExtFlash(void);
void CC2650STK_wakeUpExtFlash(void);
/*!
* @def CC1350STK_CryptoName
* @def CC2650STK_CryptoName
* @brief Enum of Crypto names
*/
typedef enum CC1350STK_CryptoName {
CC1350STK_CRYPTO0 = 0,
typedef enum CC2650STK_CryptoName {
CC2650STK_CRYPTO0 = 0,
CC1350STK_CRYPTOCOUNT
} CC1350STK_CryptoName;
CC2650STK_CRYPTOCOUNT
} CC2650STK_CryptoName;
/*!
* @def CC1350STK_GPIOName
* @def CC2650STK_GPIOName
* @brief Enum of GPIO names
*/
typedef enum CC1350STK_GPIOName {
CC1350STK_GPIO_S1 = 0,
CC1350STK_GPIO_S2,
CC1350STK_GPIO_LED0,
CC1350STK_GPIO_SPI_FLASH_CS,
CC1350STK_GPIO_LCD_CS,
CC1350STK_GPIO_LCD_ENABLE,
typedef enum CC2650STK_GPIOName {
CC2650STK_GPIO_S1 = 0,
CC2650STK_GPIO_S2,
CC2650STK_GPIO_LED0,
CC2650STK_GPIO_SPI_FLASH_CS,
CC2650STK_GPIO_LCD_CS,
CC2650STK_GPIO_LCD_ENABLE,
CC1350STK_GPIOCOUNT
} CC1350STK_GPIOName;
CC2650STK_GPIOCOUNT
} CC2650STK_GPIOName;
/*!
* @def CC1350STK_GPTimerName
* @def CC2650STK_GPTimerName
* @brief Enum of GPTimers parts
*/
typedef enum CC1350STK_GPTimerName {
CC1350STK_GPTIMER0A = 0,
CC1350STK_GPTIMER0B,
CC1350STK_GPTIMER1A,
CC1350STK_GPTIMER1B,
CC1350STK_GPTIMER2A,
CC1350STK_GPTIMER2B,
CC1350STK_GPTIMER3A,
CC1350STK_GPTIMER3B,
typedef enum CC2650STK_GPTimerName {
CC2650STK_GPTIMER0A = 0,
CC2650STK_GPTIMER0B,
CC2650STK_GPTIMER1A,
CC2650STK_GPTIMER1B,
CC2650STK_GPTIMER2A,
CC2650STK_GPTIMER2B,
CC2650STK_GPTIMER3A,
CC2650STK_GPTIMER3B,
CC1350STK_GPTIMERPARTSCOUNT
} CC1350STK_GPTimerName;
CC2650STK_GPTIMERPARTSCOUNT
} CC2650STK_GPTimerName;
/*!
* @def CC1350STK_GPTimers
* @def CC2650STK_GPTimers
* @brief Enum of GPTimers
*/
typedef enum CC1350STK_GPTimers {
CC1350STK_GPTIMER0 = 0,
CC1350STK_GPTIMER1,
CC1350STK_GPTIMER2,
CC1350STK_GPTIMER3,
typedef enum CC2650STK_GPTimers {
CC2650STK_GPTIMER0 = 0,
CC2650STK_GPTIMER1,
CC2650STK_GPTIMER2,
CC2650STK_GPTIMER3,
CC1350STK_GPTIMERCOUNT
} CC1350STK_GPTimers;
CC2650STK_GPTIMERCOUNT
} CC2650STK_GPTimers;
/*!
* @def CC1350STK_I2CName
* @def CC2650STK_I2CName
* @brief Enum of I2C names
*/
typedef enum CC1350STK_I2CName {
CC1350STK_I2C0 = 0,
typedef enum CC2650STK_I2CName {
CC2650STK_I2C0 = 0,
CC1350STK_I2CCOUNT
} CC1350STK_I2CName;
CC2650STK_I2CCOUNT
} CC2650STK_I2CName;
/*!
* @def CC1350STK_NVSName
* @def CC2650STK_NVSName
* @brief Enum of NVS names
*/
typedef enum CC1350STK_NVSName {
CC1350STK_NVSCC26XX0 = 0,
CC1350STK_NVSSPI25X0,
typedef enum CC2650STK_NVSName {
CC2650STK_NVSCC26XX0 = 0,
CC2650STK_NVSSPI25X0,
CC1350STK_NVSCOUNT
} CC1350STK_NVSName;
CC2650STK_NVSCOUNT
} CC2650STK_NVSName;
/*!
* @def CC1350STK_PdmName
* @def CC2650STK_PdmName
* @brief Enum of PDM names
*/
typedef enum CC1350STK_PDMName {
CC1350STK_PDM0 = 0,
typedef enum CC2650STK_PDMName {
CC2650STK_PDM0 = 0,
CC1350STK_PDMCOUNT
} CC1350STK_PDMName;
CC2650STK_PDMCOUNT
} CC2650STK_PDMName;
/*!
* @def CC1350STK_PWM
* @def CC2650STK_PWM
* @brief Enum of PWM outputs
*/
typedef enum CC1350STK_PWMName {
CC1350STK_PWM0 = 0,
CC1350STK_PWM1,
CC1350STK_PWM2,
CC1350STK_PWM3,
CC1350STK_PWM4,
CC1350STK_PWM5,
CC1350STK_PWM6,
CC1350STK_PWM7,
typedef enum CC2650STK_PWMName {
CC2650STK_PWM0 = 0,
CC2650STK_PWM1,
CC2650STK_PWM2,
CC2650STK_PWM3,
CC2650STK_PWM4,
CC2650STK_PWM5,
CC2650STK_PWM6,
CC2650STK_PWM7,
CC1350STK_PWMCOUNT
} CC1350STK_PWMName;
CC2650STK_PWMCOUNT
} CC2650STK_PWMName;
/*!
* @def CC1350STK_SPIName
* @def CC2650STK_SPIName
* @brief Enum of SPI names
*/
typedef enum CC1350STK_SPIName {
CC1350STK_SPI0 = 0,
CC1350STK_SPI1,
typedef enum CC2650STK_SPIName {
CC2650STK_SPI0 = 0,
CC2650STK_SPI1,
CC1350STK_SPICOUNT
} CC1350STK_SPIName;
CC2650STK_SPICOUNT
} CC2650STK_SPIName;
/*!
* @def CC1350STK_UARTName
* @def CC2650STK_UARTName
* @brief Enum of UARTs
*/
typedef enum CC1350STK_UARTName {
CC1350STK_UART0 = 0,
typedef enum CC2650STK_UARTName {
CC2650STK_UART0 = 0,
CC1350STK_UARTCOUNT
} CC1350STK_UARTName;
CC2650STK_UARTCOUNT
} CC2650STK_UARTName;
/*!
* @def CC1350STK_UDMAName
* @def CC2650STK_UDMAName
* @brief Enum of DMA buffers
*/
typedef enum CC1350STK_UDMAName {
CC1350STK_UDMA0 = 0,
typedef enum CC2650STK_UDMAName {
CC2650STK_UDMA0 = 0,
CC1350STK_UDMACOUNT
} CC1350STK_UDMAName;
CC2650STK_UDMACOUNT
} CC2650STK_UDMAName;
/*!
* @def CC1350STK_WatchdogName
* @def CC2650STK_WatchdogName
* @brief Enum of Watchdogs
*/
typedef enum CC1350STK_WatchdogName {
CC1350STK_WATCHDOG0 = 0,
typedef enum CC2650STK_WatchdogName {
CC2650STK_WATCHDOG0 = 0,
CC1350STK_WATCHDOGCOUNT
} CC1350STK_WatchdogName;
CC2650STK_WATCHDOGCOUNT
} CC2650STK_WatchdogName;
#ifdef __cplusplus
}
#endif
#endif /* __CC1350STK_BOARD_H__ */
#endif /* __CC2650STK_BOARD_H__ */

View File

@ -38,8 +38,9 @@
#include <stddef.h>
#include <stdint.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
#include <ti/devices/cc13x0/driverlib/cpu.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/ioc.h)
#include DeviceFamily_constructPath(driverlib/cpu.h)
#include "Board.h"

View File

@ -6,6 +6,7 @@ DEVICE_FAMILY = CC26X0
DEVICE_LINE = CC26XX
BOARD_SOURCEFILES += CC2650STK.c CC2650STK_fxns.c
BOARD_SOURCEFILES += leds-arch.c
SUPPORTS_PROP_MODE = 0
SUPPORTS_IEEE_MODE = 1

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-platform
* @{
*
* \file
* Driver for LaunchPad LEDs
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include <contiki.h>
#include <dev/leds.h>
/*---------------------------------------------------------------------------*/
/* Simplelink SDK API */
#include <Board.h>
#include <ti/drivers/PIN.h>
/*---------------------------------------------------------------------------*/
/* Standard library */
#include <stdbool.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
static const PIN_Config pin_table[] = {
Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
static PIN_State pin_state;
static PIN_Handle pin_handle;
static volatile unsigned char c;
/*---------------------------------------------------------------------------*/
void
leds_arch_init(void)
{
static bool bHasInit = false;
if(bHasInit) {
return;
}
// PIN_init() called from Board_initGeneral()
pin_handle = PIN_open(&pin_state, pin_table);
if (!pin_handle) {
return;
}
bHasInit = true;
}
/*---------------------------------------------------------------------------*/
unsigned char
leds_arch_get(void)
{
return c;
}
/*---------------------------------------------------------------------------*/
void
leds_arch_set(unsigned char leds)
{
c = leds;
PIN_setPortOutputValue(pin_handle, 0);
if (leds & LEDS_RED) {
PIN_setOutputValue(pin_handle, Board_PIN_LED0, 1);
}
if (leds & LEDS_GREEN) {
PIN_setOutputValue(pin_handle, Board_PIN_LED1, 1);
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -39,7 +39,6 @@
#include "contiki.h"
/*---------------------------------------------------------------------------*/
#include "Board.h"
#include "ti/drivers/dpl/HwiP.h"
#include "ti/drivers/GPIO.h"
#include "ti/drivers/I2C.h"
#include "ti/drivers/PIN.h"
@ -50,11 +49,8 @@
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
void
board_init()
board_init(void)
{
/* Disable interrupts */
const uintptr_t key = HwiP_disable();
// Board_initGeneral() will call Power_init()
// Board_initGeneral() will call PIN_init(BoardGpioInitTable)
Board_initGeneral();
@ -63,9 +59,6 @@ board_init()
GPIO_init();
I2C_init();
SPI_init();
/* Restore interrupts. */
HwiP_restore(key);
}
/*---------------------------------------------------------------------------*/
/** @} */