Rehauled doxygen commenting and fixed TI drivers configuration

This commit is contained in:
Edvard Pettersen 2018-07-16 16:39:19 +02:00
parent 8cd6017305
commit f4a8cba371
68 changed files with 2252 additions and 1710 deletions

View File

@ -220,7 +220,7 @@
#endif
#ifndef TI_UART_CONF_UART1_ENABLE
#define TI_UART_CONF_UART1_ENABLE 1
#define TI_UART_CONF_UART1_ENABLE 0
#endif
#ifndef TI_UART_CONF_BAUD_RATE
@ -237,7 +237,7 @@
#endif
#ifndef TI_SPI_CONF_SPI1_ENABLE
#define TI_SPI_CONF_SPI1_ENABLE 1
#define TI_SPI_CONF_SPI1_ENABLE 0
#endif
/* I2C */
@ -245,6 +245,10 @@
#define TI_I2C_CONF_ENABLE 1
#endif
#ifndef TI_I2C_CONF_I2C0_ENABLE
#define TI_I2C_CONF_I2C0_ENABLE TI_I2C_CONF_ENABLE
#endif
/* NVS */
#ifndef TI_NVS_CONF_ENABLE
#define TI_NVS_CONF_ENABLE 1
@ -257,6 +261,31 @@
#ifndef TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define TI_NVS_CONF_NVS_EXTERNAL_ENABLE TI_NVS_CONF_ENABLE
#endif
/* Display */
#ifndef TI_DISPLAY_CONF_ENABLE
#define TI_DISPLAY_CONF_ENABLE 0
#endif
/* UART Display uses UART0 */
#ifndef TI_DISPLAY_CONF_UART_ENABLE
#define TI_DISPLAY_CONF_UART_ENABLE TI_UART_CONF_UART0_ENABLE
#endif
#ifndef TI_DISPLAY_CONF_USE_UART_ANSI
#define TI_DISPLAY_CONF_USE_UART_ANSI 0
#endif
/* LCD Display uses SPI0 */
#ifndef TI_DISPLAY_CONF_LCD_ENABLE
#define TI_DISPLAY_CONF_LCD_ENABLE TI_SPI_CONF_SPI0_ENABLE
#endif
/* SD card */
#ifndef TI_SD_CONF_ENABLE
#define TI_SD_CONF_ENABLE 0
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/**

View File

@ -0,0 +1,16 @@
/**
* \defgroup cc13xx-cc26xx-cpu The TI SimpleLink CC13xx and CC26xx SoC
*
* This group documents the TI CC13xx and CC26xx CPUs. The two CPU families are
* very similar, with the main difference being related to radio capability.
*
* Documentation in this group should be considered to be applicable to both
* families, unless explicitly stated otherwise.
*
* \ingroup cpu
*/
/**
* \defgroup cc13xx-cc26xx-platform TI SimpleLink CC13xx/CC26xx platform
* \ingroup platform
*/

View File

@ -50,7 +50,7 @@
#include <ti/drivers/rf/RF.h>
/*---------------------------------------------------------------------------*/
#include "ieee_settings.h"
#include "ble-settings.h"
/*---------------------------------------------------------------------------*/
/* TI-RTOS RF Mode Object */
RF_Mode rf_ble_mode =

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,27 +28,33 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \addtogroup cc26xx-srf-tag
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \file
* Configuration for the srf06-cc26xx platform
* Configuration for the SimpleLink CC13xx/CC26xx platform.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef CONTIKI_CONF_H_
#define CONTIKI_CONF_H_
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
#include PROJECT_CONF_PATH
#endif /* PROJECT_CONF_PATH */
#endif
/*---------------------------------------------------------------------------*/
/* Include CPU-related configuration */
#include "cc13xx-cc26xx-conf.h"
/*---------------------------------------------------------------------------*/
/* Must be included after cc13xx-cc26xx-conf.h */
#include <Board.h>
/*---------------------------------------------------------------------------*/
#endif /* CONTIKI_CONF_H_ */
/** @} */
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,27 +27,31 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
/**
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
*
* Defines related to LaunchPad peripherals.
* Defines related to configuring LaunchPad peripherals. All LaunchPads
* are identical to a very large extent. Everything documented within this
* group applies to both sensortags
*
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* Header file with definitions related to LaunchPad boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
* \name LED configurations for the dev/leds.h API.
*
* Those values are not meant to be modified by the user
* @{
@ -58,9 +62,26 @@
#define LEDS_CONF_GREEN 1
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Button configurations for the dev/button-hal.h API.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BUTTON_HAL_ID_KEY_LEFT 0
#define BUTTON_HAL_ID_KEY_RIGHT 1
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name LaunchPad does not have any sensors.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BOARD_CONF_HAS_SENSORS 0
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* BOARD_CONF_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,20 +27,22 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
/**
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
*
* Defines related to LaunchPad peripherals.
* Defines related to configuring LaunchPad peripherals. All
* LaunchPads are identical to a very large extent. Everything
* documented within this group applies to all LaunchPads.
*
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* Header file with definitions related to LaunchPad boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_PERIPHERALS_H_
@ -48,8 +50,6 @@
/*---------------------------------------------------------------------------*/
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
#define BOARD_CONF_HAS_SENSORS 0
/*---------------------------------------------------------------------------*/
#endif /* BOARD_PERIPHERALS_H_ */
/*---------------------------------------------------------------------------*/
/**

View File

@ -27,37 +27,41 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup launchpad-button-sensor
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Driver for LaunchPad buttons
* Button HAL definitions for the LaunchPad buttons. Common across
* all CC13xx/CC26xx LaunchPad boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "dev/button-hal.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
/* Key left button, AKA BTN-1 */
BUTTON_HAL_BUTTON(key_left, /**< Name */
"Key Left", /**< Description */
Board_PIN_BTN1, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
/* Key left button, AKA BTN-1. */
BUTTON_HAL_BUTTON(
key_left, /**< Name */
"Key Left", /**< Description */
Board_PIN_BTN1, /**< Board PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
/* Key right button, AKA BTN-2 */
BUTTON_HAL_BUTTON(key_right, /**< Name */
"Key Right", /**< Description */
Board_PIN_BTN2, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
/* Key right button, AKA BTN-2. */
BUTTON_HAL_BUTTON(
key_right, /**< Name */
"Key Right", /**< Description */
Board_PIN_BTN2, /**< Board PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
/*---------------------------------------------------------------------------*/
BUTTON_HAL_BUTTONS(&key_left, &key_right);
/*---------------------------------------------------------------------------*/

View File

@ -253,19 +253,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC1310_LAUNCHXL_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1310_LAUNCHXL_UART0,
@ -275,6 +277,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1310_LAUNCHXL_SPI0,
.csPin = CC1310_LAUNCHXL_GPIO_LCD_CS,
@ -285,27 +303,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -314,7 +323,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -330,7 +339,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -429,9 +438,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1310_LAUNCHXL_GPTIMERPARTSCOUN
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1310_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1310_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -440,19 +452,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1310_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1310_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1310_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1310_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1310_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1310_LAUNCHXL_I2C0]
}
},
#endif
};
const uint_least8_t I2C_count = CC1310_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -464,7 +481,9 @@ const uint_least8_t I2C_count = CC1310_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -514,9 +533,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -542,18 +561,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1310_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -564,6 +583,8 @@ const NVS_Config NVS_config[CC1310_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1310_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -658,6 +679,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1310_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1310_LAUNCHXL_SDCOUNT] = {
@ -677,12 +704,16 @@ const SD_Config SD_config[CC1310_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1310_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPICOUNT];
/*
@ -691,6 +722,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -706,6 +738,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPICOUNT] = {
.csnPin = CC1310_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -720,35 +754,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPICOUNT] = {
.clkPin = CC1310_LAUNCHXL_SPI1_CLK,
.csnPin = CC1310_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1310_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1310_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1310_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1310_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -764,19 +808,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1310_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1310_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1310_LAUNCHXL_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1310_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
@ -267,7 +269,9 @@ typedef enum CC1310_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1310_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1310_LAUNCHXL_I2C0 = 0,
#endif
CC1310_LAUNCHXL_I2CCOUNT
} CC1310_LAUNCHXL_I2CName;
@ -277,10 +281,10 @@ typedef enum CC1310_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1310_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1310_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1310_LAUNCHXL_NVSSPI25X0,
#endif
@ -319,8 +323,12 @@ typedef enum CC1310_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1310_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1310_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1310_LAUNCHXL_SPI1,
#endif
CC1310_LAUNCHXL_SPICOUNT
} CC1310_LAUNCHXL_SPIName;
@ -330,7 +338,9 @@ typedef enum CC1310_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1310_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1310_LAUNCHXL_UART0 = 0,
#endif
CC1310_LAUNCHXL_UARTCOUNT
} CC1310_LAUNCHXL_UARTName;

View File

@ -374,19 +374,21 @@ const uint_least8_t AESECB_count = CC1312R1_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1312R1_LAUNCHXL_UART0,
@ -396,6 +398,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
DisplaySharp_Object displaySharpObject;
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1312R1_LAUNCHXL_SPI0,
.csPin = CC1312R1_LAUNCHXL_GPIO_LCD_CS,
@ -406,27 +424,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -435,7 +444,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -451,7 +460,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -550,9 +559,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1312R1_LAUNCHXL_GPTIMERPARTSCO
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1312R1_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1312R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -561,19 +573,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1312R1_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1312R1_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1312R1_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1312R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1312R1_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1312R1_LAUNCHXL_I2C0]
}
},
#endif
};
const uint_least8_t I2C_count = CC1312R1_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -585,7 +602,9 @@ const uint_least8_t I2C_count = CC1312R1_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x2000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -635,9 +654,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -663,18 +682,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1312R1_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -685,6 +704,8 @@ const NVS_Config NVS_config[CC1312R1_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1312R1_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -779,6 +800,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1312R1_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1312R1_LAUNCHXL_SDCOUNT] = {
@ -798,12 +825,16 @@ const SD_Config SD_config[CC1312R1_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1312R1_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1312R1_LAUNCHXL_SPICOUNT];
/*
@ -812,6 +843,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1312R1_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -827,6 +859,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPICOUNT] = {
.csnPin = CC1312R1_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -841,35 +875,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPICOUNT] = {
.clkPin = CC1312R1_LAUNCHXL_SPI1_CLK,
.csnPin = CC1312R1_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1312R1_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1312R1_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1312R1_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1312R1_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1312R1_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1312R1_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1312R1_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -885,19 +929,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1312R1_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1312R1_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1312R1_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1312R1_LAUNCHXL_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1312R1_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -326,7 +328,9 @@ typedef enum CC1312R1_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1312R1_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1312R1_LAUNCHXL_I2C0 = 0,
#endif
CC1312R1_LAUNCHXL_I2CCOUNT
} CC1312R1_LAUNCHXL_I2CName;
@ -336,10 +340,10 @@ typedef enum CC1312R1_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1312R1_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1312R1_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1312R1_LAUNCHXL_NVSSPI25X0,
#endif
@ -378,8 +382,12 @@ typedef enum CC1312R1_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1312R1_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1312R1_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1312R1_LAUNCHXL_SPI1,
#endif
CC1312R1_LAUNCHXL_SPICOUNT
} CC1312R1_LAUNCHXL_SPIName;
@ -389,7 +397,9 @@ typedef enum CC1312R1_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1312R1_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1312R1_LAUNCHXL_UART0 = 0,
#endif
CC1312R1_LAUNCHXL_UARTCOUNT
} CC1312R1_LAUNCHXL_UARTName;

View File

@ -252,19 +252,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC1350_LAUNCHXL_433_CRYPTOCOUNT] =
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1350_LAUNCHXL_433_UART0,
@ -274,6 +276,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1350_LAUNCHXL_433_SPI0,
.csPin = CC1350_LAUNCHXL_433_GPIO_LCD_CS,
@ -284,27 +302,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -313,7 +322,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -329,7 +338,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -428,6 +437,8 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350_LAUNCHXL_433_GPTIMERPARTS
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1350_LAUNCHXL_433_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350_LAUNCHXL_433_I2CCOUNT] = {
@ -452,6 +463,8 @@ const I2C_Config I2C_config[CC1350_LAUNCHXL_433_I2CCOUNT] = {
const uint_least8_t I2C_count = CC1350_LAUNCHXL_433_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -463,7 +476,9 @@ const uint_least8_t I2C_count = CC1350_LAUNCHXL_433_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -513,9 +528,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -541,18 +556,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1350_LAUNCHXL_433_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -563,6 +578,8 @@ const NVS_Config NVS_config[CC1350_LAUNCHXL_433_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1350_LAUNCHXL_433_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -670,6 +687,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1350_LAUNCHXL_433_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1350_LAUNCHXL_433_SDCOUNT] = {
@ -689,12 +712,16 @@ const SD_Config SD_config[CC1350_LAUNCHXL_433_SDCOUNT] = {
const uint_least8_t SD_count = CC1350_LAUNCHXL_433_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_433_SPICOUNT];
/*
@ -703,6 +730,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_433_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -718,6 +746,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPICOUNT] =
.csnPin = CC1350_LAUNCHXL_433_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -732,35 +762,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPICOUNT] =
.clkPin = CC1350_LAUNCHXL_433_SPI1_CLK,
.csnPin = CC1350_LAUNCHXL_433_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1350_LAUNCHXL_433_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350_LAUNCHXL_433_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350_LAUNCHXL_433_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1350_LAUNCHXL_433_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1350_LAUNCHXL_433_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1350_LAUNCHXL_433_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_433_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -776,19 +816,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_433_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1350_LAUNCHXL_433_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1350_LAUNCHXL_433_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1350_LAUNCHXL_433_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1350_LAUNCHXL_433_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>

View File

@ -253,19 +253,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC1350_LAUNCHXL_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1350_LAUNCHXL_UART0,
@ -275,6 +277,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1350_LAUNCHXL_SPI0,
.csPin = CC1350_LAUNCHXL_GPIO_LCD_CS,
@ -285,27 +303,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -314,7 +323,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -330,7 +339,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -429,9 +438,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350_LAUNCHXL_GPTIMERPARTSCOUN
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1350_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -440,19 +452,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1350_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1350_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1350_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1350_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1350_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1350_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -464,7 +481,9 @@ const uint_least8_t I2C_count = CC1350_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -514,9 +533,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -542,18 +561,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1350_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -564,6 +583,8 @@ const NVS_Config NVS_config[CC1350_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1350_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -671,6 +692,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1350_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1350_LAUNCHXL_SDCOUNT] = {
@ -690,12 +717,16 @@ const SD_Config SD_config[CC1350_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1350_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_SPICOUNT];
/*
@ -704,6 +735,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -719,6 +751,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPICOUNT] = {
.csnPin = CC1350_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -733,35 +767,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPICOUNT] = {
.clkPin = CC1350_LAUNCHXL_SPI1_CLK,
.csnPin = CC1350_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1350_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1350_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1350_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1350_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -777,19 +821,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1350_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1350_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1350_LAUNCHXL_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1350_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x0/driverlib/ioc.h>
@ -270,7 +272,9 @@ typedef enum CC1350_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1350_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1350_LAUNCHXL_I2C0 = 0,
#endif
CC1350_LAUNCHXL_I2CCOUNT
} CC1350_LAUNCHXL_I2CName;
@ -280,10 +284,10 @@ typedef enum CC1350_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1350_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1350_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1350_LAUNCHXL_NVSSPI25X0,
#endif
@ -322,8 +326,12 @@ typedef enum CC1350_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1350_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1350_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1350_LAUNCHXL_SPI1,
#endif
CC1350_LAUNCHXL_SPICOUNT
} CC1350_LAUNCHXL_SPIName;
@ -333,7 +341,9 @@ typedef enum CC1350_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1350_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1350_LAUNCHXL_UART0 = 0,
#endif
CC1350_LAUNCHXL_UARTCOUNT
} CC1350_LAUNCHXL_UARTName;

View File

@ -340,19 +340,21 @@ const uint_least8_t AESECB_count = CC1352P_2_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1352P_2_LAUNCHXL_UART0,
@ -362,6 +364,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1352P_2_LAUNCHXL_SPI0,
.csPin = CC1352P_2_LAUNCHXL_GPIO_LCD_CS,
@ -372,27 +390,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -401,7 +410,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -417,7 +426,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -519,9 +528,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P_2_LAUNCHXL_GPTIMERPARTSC
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -530,19 +542,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1352P_2_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1352P_2_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1352P_2_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1352P_2_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -554,7 +571,9 @@ const uint_least8_t I2C_count = CC1352P_2_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x2000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -604,9 +623,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -632,18 +651,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1352P_2_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -654,6 +673,8 @@ const NVS_Config NVS_config[CC1352P_2_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1352P_2_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -763,6 +784,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1352P_2_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1352P_2_LAUNCHXL_SDCOUNT] = {
@ -782,12 +809,16 @@ const SD_Config SD_config[CC1352P_2_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1352P_2_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P_2_LAUNCHXL_SPICOUNT];
/*
@ -796,6 +827,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P_2_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -811,6 +843,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPICOUNT] =
.csnPin = CC1352P_2_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -825,35 +859,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPICOUNT] =
.clkPin = CC1352P_2_LAUNCHXL_SPI1_CLK,
.csnPin = CC1352P_2_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1352P_2_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P_2_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P_2_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1352P_2_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1352P_2_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -870,6 +914,8 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.baseAddr = UART1_BASE,
.powerMngrId = PowerCC26X2_PERIPH_UART1,
@ -885,24 +931,31 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART0]
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART1],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART1]
},
#endif
};
const uint_least8_t UART_count = CC1352P_2_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -197,8 +199,6 @@ typedef enum CC1352P_2_LAUNCHXL_ADCBuf0ChannelName {
CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL2,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL3,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL4,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL5,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL6,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNELVDDS,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNELDCOUPL,
CC1352P_2_LAUNCHXL_ADCBUF0CHANNELVSS,
@ -216,8 +216,6 @@ typedef enum CC1352P_2_LAUNCHXL_ADCName {
CC1352P_2_LAUNCHXL_ADC2,
CC1352P_2_LAUNCHXL_ADC3,
CC1352P_2_LAUNCHXL_ADC4,
CC1352P_2_LAUNCHXL_ADC5,
CC1352P_2_LAUNCHXL_ADC6,
CC1352P_2_LAUNCHXL_ADCDCOUPL,
CC1352P_2_LAUNCHXL_ADCVSS,
CC1352P_2_LAUNCHXL_ADCVDDS,
@ -338,7 +336,9 @@ typedef enum CC1352P_2_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1352P_2_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1352P_2_LAUNCHXL_I2C0 = 0,
#endif
CC1352P_2_LAUNCHXL_I2CCOUNT
} CC1352P_2_LAUNCHXL_I2CName;
@ -348,10 +348,10 @@ typedef enum CC1352P_2_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1352P_2_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1352P_2_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1352P_2_LAUNCHXL_NVSSPI25X0,
#endif
@ -390,8 +390,12 @@ typedef enum CC1352P_2_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1352P_2_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1352P_2_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1352P_2_LAUNCHXL_SPI1,
#endif
CC1352P_2_LAUNCHXL_SPICOUNT
} CC1352P_2_LAUNCHXL_SPIName;
@ -401,8 +405,12 @@ typedef enum CC1352P_2_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1352P_2_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1352P_2_LAUNCHXL_UART0 = 0,
#endif
#if TI_UART_CONF_UART1_ENABLE
CC1352P_2_LAUNCHXL_UART1,
#endif
CC1352P_2_LAUNCHXL_UARTCOUNT
} CC1352P_2_LAUNCHXL_UARTName;

View File

@ -340,19 +340,21 @@ const uint_least8_t AESECB_count = CC1352P_4_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1352P_4_LAUNCHXL_UART0,
@ -362,6 +364,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1352P_4_LAUNCHXL_SPI0,
.csPin = CC1352P_4_LAUNCHXL_GPIO_LCD_CS,
@ -372,27 +390,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -401,7 +410,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -417,7 +426,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -519,9 +528,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P_4_LAUNCHXL_GPTIMERPARTSC
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1352P_4_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_4_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -530,19 +542,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_4_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1352P_4_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1352P_4_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1352P_4_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1352P_4_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1352P_4_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1352P_4_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -554,7 +571,9 @@ const uint_least8_t I2C_count = CC1352P_4_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x2000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -604,9 +623,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -632,18 +651,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1352P_4_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -654,6 +673,8 @@ const NVS_Config NVS_config[CC1352P_4_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1352P_4_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -763,6 +784,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1352P_4_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1352P_4_LAUNCHXL_SDCOUNT] = {
@ -782,6 +809,8 @@ const SD_Config SD_config[CC1352P_4_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1352P_4_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
@ -790,12 +819,15 @@ const uint_least8_t SD_count = CC1352P_4_LAUNCHXL_SDCOUNT;
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P_4_LAUNCHXL_SPICOUNT];
#if TI_SPI_CONF_ENABLE
/*
* NOTE: The SPI instances below can be used by the SD driver to communicate
* with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -811,6 +843,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPICOUNT] =
.csnPin = CC1352P_4_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -825,35 +859,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPICOUNT] =
.clkPin = CC1352P_4_LAUNCHXL_SPI1_CLK,
.csnPin = CC1352P_4_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1352P_4_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P_4_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P_4_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1352P_4_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1352P_4_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -870,6 +914,8 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UARTCOUNT] = {
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.baseAddr = UART1_BASE,
.powerMngrId = PowerCC26X2_PERIPH_UART1,
@ -885,24 +931,31 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1352P_4_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P_4_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UART0]
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P_4_LAUNCHXL_UART1],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UART1]
},
#endif
};
const uint_least8_t UART_count = CC1352P_4_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -197,8 +199,6 @@ typedef enum CC1352P_4_LAUNCHXL_ADCBuf0ChannelName {
CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL2,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL3,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL4,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL5,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL6,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNELVDDS,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNELDCOUPL,
CC1352P_4_LAUNCHXL_ADCBUF0CHANNELVSS,
@ -216,8 +216,6 @@ typedef enum CC1352P_4_LAUNCHXL_ADCName {
CC1352P_4_LAUNCHXL_ADC2,
CC1352P_4_LAUNCHXL_ADC3,
CC1352P_4_LAUNCHXL_ADC4,
CC1352P_4_LAUNCHXL_ADC5,
CC1352P_4_LAUNCHXL_ADC6,
CC1352P_4_LAUNCHXL_ADCDCOUPL,
CC1352P_4_LAUNCHXL_ADCVSS,
CC1352P_4_LAUNCHXL_ADCVDDS,
@ -338,7 +336,9 @@ typedef enum CC1352P_4_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1352P_4_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1352P_4_LAUNCHXL_I2C0 = 0,
#endif
CC1352P_4_LAUNCHXL_I2CCOUNT
} CC1352P_4_LAUNCHXL_I2CName;
@ -348,10 +348,10 @@ typedef enum CC1352P_4_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1352P_4_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1352P_4_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1352P_4_LAUNCHXL_NVSSPI25X0,
#endif
@ -390,8 +390,12 @@ typedef enum CC1352P_4_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1352P_4_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1352P_4_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1352P_4_LAUNCHXL_SPI1,
#endif
CC1352P_4_LAUNCHXL_SPICOUNT
} CC1352P_4_LAUNCHXL_SPIName;
@ -401,8 +405,12 @@ typedef enum CC1352P_4_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1352P_4_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1352P_4_LAUNCHXL_UART0 = 0,
#endif
#if TI_UART_CONF_UART1_ENABLE
CC1352P_4_LAUNCHXL_UART1,
#endif
CC1352P_4_LAUNCHXL_UARTCOUNT
} CC1352P_4_LAUNCHXL_UARTName;

View File

@ -340,19 +340,21 @@ const uint_least8_t AESECB_count = CC1352P1_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1352P1_LAUNCHXL_UART0,
@ -362,6 +364,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1352P1_LAUNCHXL_SPI0,
.csPin = CC1352P1_LAUNCHXL_GPIO_LCD_CS,
@ -372,27 +390,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -401,7 +410,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -417,7 +426,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -519,9 +528,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P1_LAUNCHXL_GPTIMERPARTSCO
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -530,19 +542,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1352P1_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1352P1_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1352P1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1352P1_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -554,7 +571,9 @@ const uint_least8_t I2C_count = CC1352P1_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x2000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -604,9 +623,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -632,18 +651,18 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1352P1_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -654,6 +673,8 @@ const NVS_Config NVS_config[CC1352P1_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1352P1_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -763,6 +784,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1352P1_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1352P1_LAUNCHXL_SDCOUNT] = {
@ -782,12 +809,16 @@ const SD_Config SD_config[CC1352P1_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1352P1_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P1_LAUNCHXL_SPICOUNT];
/*
@ -796,6 +827,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P1_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -811,6 +843,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPICOUNT] = {
.csnPin = CC1352P1_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -825,35 +859,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPICOUNT] = {
.clkPin = CC1352P1_LAUNCHXL_SPI1_CLK,
.csnPin = CC1352P1_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1352P1_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P1_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1352P1_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1352P1_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1352P1_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -870,6 +914,8 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UARTCOUNT] = {
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.baseAddr = UART1_BASE,
.powerMngrId = PowerCC26X2_PERIPH_UART1,
@ -885,24 +931,31 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1352P1_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART0]
},
#endif
#if TI_UART_CONF_UART1_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART1],
.hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART1]
},
#endif
};
const uint_least8_t UART_count = CC1352P1_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -338,7 +340,9 @@ typedef enum CC1352P1_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1352P1_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1352P1_LAUNCHXL_I2C0 = 0,
#endif
CC1352P1_LAUNCHXL_I2CCOUNT
} CC1352P1_LAUNCHXL_I2CName;
@ -348,10 +352,10 @@ typedef enum CC1352P1_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1352P1_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1352P1_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1352P1_LAUNCHXL_NVSSPI25X0,
#endif
@ -390,8 +394,12 @@ typedef enum CC1352P1_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1352P1_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1352P1_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1352P1_LAUNCHXL_SPI1,
#endif
CC1352P1_LAUNCHXL_SPICOUNT
} CC1352P1_LAUNCHXL_SPIName;
@ -401,8 +409,12 @@ typedef enum CC1352P1_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1352P1_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1352P1_LAUNCHXL_UART0 = 0,
#endif
#if TI_UART_CONF_UART1_ENABLE
CC1352P1_LAUNCHXL_UART1,
#endif
CC1352P1_LAUNCHXL_UARTCOUNT
} CC1352P1_LAUNCHXL_UARTName;

View File

@ -364,19 +364,21 @@ const uint_least8_t AESECB_count = CC1352R1_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1352R1_LAUNCHXL_UART0,
@ -386,6 +388,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1352R1_LAUNCHXL_SPI0,
.csPin = CC1352R1_LAUNCHXL_GPIO_LCD_CS,
@ -396,27 +414,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -425,7 +434,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -441,7 +450,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -545,6 +554,7 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352R1_LAUNCHXL_GPTIMERPARTSCO
I2CCC26XX_Object i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -553,15 +563,18 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1352R1_LAUNCHXL_I2C0_SDA0,
.sclPin = CC1352R1_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1352R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1352R1_LAUNCHXL_I2CCOUNT;
@ -790,6 +803,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1352R1_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1352R1_LAUNCHXL_SDCOUNT] = {
@ -809,6 +828,8 @@ const SD_Config SD_config[CC1352R1_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC1352R1_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -330,7 +332,9 @@ typedef enum CC1352R1_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1352R1_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1352R1_LAUNCHXL_I2C0 = 0,
#endif
CC1352R1_LAUNCHXL_I2CCOUNT
} CC1352R1_LAUNCHXL_I2CName;
@ -340,10 +344,10 @@ typedef enum CC1352R1_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1352R1_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1352R1_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1352R1_LAUNCHXL_NVSSPI25X0,
#endif
@ -382,8 +386,12 @@ typedef enum CC1352R1_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1352R1_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1352R1_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1352R1_LAUNCHXL_SPI1,
#endif
CC1352R1_LAUNCHXL_SPICOUNT
} CC1352R1_LAUNCHXL_SPIName;
@ -393,8 +401,12 @@ typedef enum CC1352R1_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1352R1_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1352R1_LAUNCHXL_UART0 = 0,
#endif
#if TI_UART_CONF_UART1_ENABLE
CC1352R1_LAUNCHXL_UART1,
#endif
CC1352R1_LAUNCHXL_UARTCOUNT
} CC1352R1_LAUNCHXL_UARTName;

View File

@ -252,19 +252,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC2650_LAUNCHXL_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC2650_LAUNCHXL_UART0,
@ -274,6 +276,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC2650_LAUNCHXL_SPI0,
.csPin = CC2650_LAUNCHXL_GPIO_LCD_CS,
@ -284,27 +302,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -313,7 +322,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -329,7 +338,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -428,9 +437,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650_LAUNCHXL_GPTIMERPARTSCOUN
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC2650_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -439,19 +451,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC2650_LAUNCHXL_I2C0_SDA0,
.sclPin = CC2650_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC2650_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC2650_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC2650_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC2650_LAUNCHXL_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -463,7 +480,9 @@ const uint_least8_t I2C_count = CC2650_LAUNCHXL_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -513,9 +532,9 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
@ -545,14 +564,14 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC2650_LAUNCHXL_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
@ -563,6 +582,8 @@ const NVS_Config NVS_config[CC2650_LAUNCHXL_NVSCOUNT] = {
const uint_least8_t NVS_count = CC2650_LAUNCHXL_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -657,6 +678,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC2650_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC2650_LAUNCHXL_SDCOUNT] = {
@ -676,12 +703,16 @@ const SD_Config SD_config[CC2650_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC2650_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650_LAUNCHXL_SPICOUNT];
/*
@ -690,6 +721,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650_LAUNCHXL_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -705,6 +737,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPICOUNT] = {
.csnPin = CC2650_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -719,35 +753,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPICOUNT] = {
.clkPin = CC2650_LAUNCHXL_SPI1_CLK,
.csnPin = CC2650_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC2650_LAUNCHXL_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC2650_LAUNCHXL_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC2650_LAUNCHXL_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC2650_LAUNCHXL_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -763,19 +807,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650_LAUNCHXL_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC2650_LAUNCHXL_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC2650_LAUNCHXL_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC2650_LAUNCHXL_UART0]
},
#endif
};
const uint_least8_t UART_count = CC2650_LAUNCHXL_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc26x0/driverlib/ioc.h>
@ -267,7 +269,9 @@ typedef enum CC2650_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC2650_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC2650_LAUNCHXL_I2C0 = 0,
#endif
CC2650_LAUNCHXL_I2CCOUNT
} CC2650_LAUNCHXL_I2CName;
@ -277,10 +281,10 @@ typedef enum CC2650_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC2650_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC2650_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC2650_LAUNCHXL_NVSSPI25X0,
#endif
@ -319,8 +323,12 @@ typedef enum CC2650_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC2650_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC2650_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC2650_LAUNCHXL_SPI1,
#endif
CC2650_LAUNCHXL_SPICOUNT
} CC2650_LAUNCHXL_SPIName;
@ -330,7 +338,9 @@ typedef enum CC2650_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC2650_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC2650_LAUNCHXL_UART0 = 0,
#endif
CC2650_LAUNCHXL_UARTCOUNT
} CC2650_LAUNCHXL_UARTName;

View File

@ -375,19 +375,21 @@ const uint_least8_t AESECB_count = CC26X2R1_LAUNCHXL_AESECBCOUNT;
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC26X2R1_LAUNCHXL_UART0,
@ -397,6 +399,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC26X2R1_LAUNCHXL_SPI0,
.csPin = CC26X2R1_LAUNCHXL_GPIO_LCD_CS,
@ -407,27 +425,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -436,7 +445,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -452,7 +461,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -556,6 +565,7 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC26X2R1_LAUNCHXL_GPTIMERPARTSCO
I2CCC26XX_Object i2cCC26xxObjects[CC26X2R1_LAUNCHXL_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC26X2R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -564,15 +574,18 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC26X2R1_LAUNCHXL_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC26X2R1_LAUNCHXL_I2C0_SDA0,
.sclPin = CC26X2R1_LAUNCHXL_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC26X2R1_LAUNCHXL_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC26X2R1_LAUNCHXL_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC26X2R1_LAUNCHXL_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC26X2R1_LAUNCHXL_I2CCOUNT;
@ -670,7 +683,7 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC26X2R1_LAUNCHXL_NVSCOUNT] = {
@ -788,6 +801,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC26X2R1_LAUNCHXL_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC26X2R1_LAUNCHXL_SDCOUNT] = {
@ -807,6 +826,8 @@ const SD_Config SD_config[CC26X2R1_LAUNCHXL_SDCOUNT] = {
const uint_least8_t SD_count = CC26X2R1_LAUNCHXL_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc13x2_cc26x2_v1/driverlib/ioc.h>
@ -332,7 +334,9 @@ typedef enum CC26X2R1_LAUNCHXL_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC26X2R1_LAUNCHXL_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC26X2R1_LAUNCHXL_I2C0 = 0,
#endif
CC26X2R1_LAUNCHXL_I2CCOUNT
} CC26X2R1_LAUNCHXL_I2CName;
@ -342,10 +346,10 @@ typedef enum CC26X2R1_LAUNCHXL_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC26X2R1_LAUNCHXL_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC26X2R1_LAUNCHXL_NVSCC26XX0 = 0,
#endif
#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC26X2R1_LAUNCHXL_NVSSPI25X0,
#endif
@ -384,8 +388,12 @@ typedef enum CC26X2R1_LAUNCHXL_SDName {
* @brief Enum of SPI names
*/
typedef enum CC26X2R1_LAUNCHXL_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC26X2R1_LAUNCHXL_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC26X2R1_LAUNCHXL_SPI1,
#endif
CC26X2R1_LAUNCHXL_SPICOUNT
} CC26X2R1_LAUNCHXL_SPIName;
@ -395,8 +403,12 @@ typedef enum CC26X2R1_LAUNCHXL_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC26X2R1_LAUNCHXL_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC26X2R1_LAUNCHXL_UART0 = 0,
#endif
#if TI_UART_CONF_UART1_ENABLE
CC26X2R1_LAUNCHXL_UART1,
#endif
CC26X2R1_LAUNCHXL_UARTCOUNT
} CC26X2R1_LAUNCHXL_UARTName;

View File

@ -27,26 +27,28 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-platform
* \addtogroup launchpad-peripherals
* @{
*
* \file
* Driver for LaunchPad LEDs
* LED HAL definitions for the LaunchPad LEDs. Common across all
* CC13xx/CC26xx LaunchPad LEDs.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "dev/leds.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
/* Standard library */
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
const leds_t leds_arch_leds[] = {
/* Red LED, AKA LED0 */
{ .pin = Board_PIN_LED0, .negative_logic = false },
/* Green LED, AKA LED1 */
{ .pin = Board_PIN_LED1, .negative_logic = false },
};
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,25 +27,32 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc13xx-cc26xx-platforms
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup LaunchPads
*
* This platform supports a number of different boards:
* - The TI CC1310 LaunchPad
* - The TI CC1350 LaunchPad
* - The TI CC2640 LaunchPad
* - The TI CC2650 LaunchPad
* - The TI CC1312R1 LaunchPad
* - The TI CC1352R1 LaunchPad
* - The TI CC1352P1 LaunchPad
* - The TI CC26X2R1 LaunchPad
* @{
* \file
* Setup the SimpleLink CC13xx/CC26xx ecosystem with the
* Contiki environment.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "contiki-net.h"
#include "sys/clock.h"
#include "sys/rtimer.h"
#include "sys/node-id.h"
#include "sys/platform.h"
#include "dev/button-hal.h"
#include "dev/gpio-hal.h"
#include "dev/serial-line.h"
#include "dev/leds.h"
#include "net/mac/framer/frame802154.h"
#include "lib/random.h"
#include "lib/sensors.h"
/*---------------------------------------------------------------------------*/
/* Simplelink SDK includes */
#include <Board.h>
#include <NoRTOS.h>
@ -64,20 +71,6 @@
#include <ti/drivers/SPI.h>
#include <ti/drivers/UART.h>
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "contiki-net.h"
#include "sys/clock.h"
#include "sys/rtimer.h"
#include "sys/node-id.h"
#include "sys/platform.h"
#include "dev/button-hal.h"
#include "dev/gpio-hal.h"
#include "dev/serial-line.h"
#include "dev/leds.h"
#include "net/mac/framer/frame802154.h"
#include "lib/sensors.h"
/*---------------------------------------------------------------------------*/
/* Arch driver implementations */
#include "board-peripherals.h"
#include "uart0-arch.h"
@ -85,7 +78,6 @@
#include "ieee-addr.h"
#include "rf-core.h"
#include "rf-ble-beacond.h"
#include "lib/random.h"
#include "button-sensor.h"
/*---------------------------------------------------------------------------*/
#include <stdio.h>
@ -93,14 +85,12 @@
/*---------------------------------------------------------------------------*/
/* Log configuration */
#include "sys/log.h"
#define LOG_MODULE "CC26xx/CC13xx"
#define LOG_MODULE "CC13xx/CC26xx"
#define LOG_LEVEL LOG_LEVEL_DBG
/*---------------------------------------------------------------------------*/
unsigned short g_nodeId = 0;
/*---------------------------------------------------------------------------*/
/*
* Board-specific initialization function.
* This function is defined in the file <BOARD>_fxns.c
* Board-specific initialization function. This function is defined in
* the <BOARD>_fxns.c file.
*/
extern void Board_initHook(void);
/*---------------------------------------------------------------------------*/
@ -110,37 +100,41 @@ extern void Board_initHook(void);
#define BOARD_HAS_SENSORS 1
#endif
/*---------------------------------------------------------------------------*/
/* Fade a specified LED */
static void
fade(unsigned char l)
{
volatile int i;
for(int k = 0; k < 800; ++k) {
int j = k > 400 ? 800 - k : k;
int k;
int j;
for(k = 0; k < 800; ++k) {
j = (k > 400) ? 800 - k : k;
leds_on(l);
leds_single_on(l);
for(i = 0; i < j; ++i) { __asm("nop"); }
leds_off(l);
leds_single_off(l);
for(i = 0; i < 400 - j; ++i) { __asm("nop"); }
}
}
/*---------------------------------------------------------------------------*/
/* Configure RF params for the radio driver */
static void
set_rf_params(void)
{
uint8_t ext_addr[8];
uint16_t short_addr;
memset(ext_addr, 0x0, sizeof(ext_addr));
ieee_addr_cpy_to(ext_addr, sizeof(ext_addr));
uint16_t short_addr = (ext_addr[7] << 0)
| (ext_addr[6] << 8);
/* Short address is the last two bytes of the MAC address */
short_addr = ((uint16_t)ext_addr[7] << 0)
| ((uint16_t)ext_addr[6] << 8);
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, sizeof(ext_addr));
/* also set the global node id */
g_nodeId = short_addr;
}
/*---------------------------------------------------------------------------*/
void
@ -155,8 +149,12 @@ platform_init_stage_one(void)
Power_init();
/* BoardGpioInitTable declared in Board.h */
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
/* Error with PIN_init */
/*
* Something is seriously wrong if PIN initialization of the Board GPIO
* table fails.
*/
while (1);
}
@ -172,7 +170,6 @@ platform_init_stage_one(void)
/* TI Drivers init */
#if TI_UART_CONF_ENABLE
UART_init();
uart0_init();
#endif
#if TI_I2C_CONF_ENABLE
I2C_init();
@ -186,7 +183,7 @@ platform_init_stage_one(void)
fade(LEDS_GREEN);
/* NoRTOS should be called last */
/* NoRTOS must be called last */
NoRTOS_start();
}
/*---------------------------------------------------------------------------*/
@ -195,6 +192,10 @@ platform_init_stage_two(void)
{
serial_line_init();
#if TI_UART_CONF_UART0_ENABLE
uart0_init();
#endif
#if BUILD_WITH_SHELL
uart0_set_callback(serial_line_input_byte);
#endif
@ -216,7 +217,8 @@ platform_init_stage_three(void)
rf_ble_beacond_init();
#endif
radio_value_t chan = 0, pan = 0;
radio_value_t chan = 0;
radio_value_t pan = 0;
set_rf_params();
@ -225,10 +227,10 @@ platform_init_stage_three(void)
LOG_DBG("With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP,
DRIVERLIB_RELEASE_BUILD);
LOG_DBG("IEEE 802.15.4: %s, Sub-GHz: %s, BLE: %s\n",
LOG_DBG("IEEE 802.15.4: %s, Sub-1 GHz: %s, BLE: %s\n",
ChipInfo_SupportsIEEE_802_15_4() ? "Yes" : "No",
ChipInfo_SupportsPROPRIETARY() ? "Yes" : "No",
ChipInfo_SupportsBLE() ? "Yes" : "No");
ChipInfo_SupportsPROPRIETARY() ? "Yes" : "No",
ChipInfo_SupportsBLE() ? "Yes" : "No");
#if (RF_MODE == RF_MODE_SUB_1_GHZ)
LOG_INFO("Operating frequency on Sub-1 GHz\n");
@ -236,7 +238,7 @@ platform_init_stage_three(void)
LOG_INFO("Operating frequency on 2.4 GHz\n");
#endif
LOG_INFO("RF: Channel %d, PANID 0x%04X\n", chan, pan);
LOG_INFO("Node ID: %d\n", g_nodeId);
LOG_INFO("Node ID: %d\n", node_id);
#if BOARD_HAS_SENSORS
process_start(&sensors_process, NULL);
@ -253,6 +255,5 @@ platform_idle(void)
}
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -7,7 +7,7 @@ PLATFORM_HAS_BUTTON = 1
# leds-arch.c/h etc.
BOARD_SOURCEFILES += sensortag-sensors.c
BOARD_SOURCEFILES += button-sensor-arch.c ext-flash.c
BOARD_SOURCEFILES += button-sensor-arch.c
BOARD_SOURCEFILES += bmp-280-sensor.c hdc-1000-sensor.c
BOARD_SOURCEFILES += mpu-9250-sensor.c opt-3001-sensor.c
BOARD_SOURCEFILES += tmp-007-sensor.c buzzer.c

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-bmp-sensor
* \addtogroup sensortag-bmp-sensor
* @{
*
* \file
* Driver for the Sensortag BMP280 Altimeter / Pressure Sensor
* Driver for the Sensortag BMP280 Altimeter / Pressure Sensor
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -41,6 +42,7 @@
#include "sys/ctimer.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/drivers/I2C.h>
/*---------------------------------------------------------------------------*/
#include "bmp-280-sensor.h"
@ -57,7 +59,7 @@
#endif
/*---------------------------------------------------------------------------*/
#ifndef Board_BMP280_ADDR
# error "Board file doesn't define I2C address Board_BMP280_ADDR"
# error "Board file doesn't define I2C address Board_BMP280_ADDR"
#endif
/* Sensor I2C address */
#define BMP280_I2C_ADDRESS Board_BMP280_ADDR
@ -127,7 +129,7 @@ typedef struct {
/*---------------------------------------------------------------------------*/
static BMP_280_Calibration calib_data;
/*---------------------------------------------------------------------------*/
static I2C_Handle i2cHandle;
static I2C_Handle i2c_handle;
/*---------------------------------------------------------------------------*/
typedef enum {
SENSOR_STATUS_DISABLED,
@ -163,48 +165,53 @@ i2c_write_read(void *writeBuf, size_t writeCount, void *readBuf, size_t readCoun
.slaveAddress = BMP280_I2C_ADDRESS,
};
return I2C_transfer(i2cHandle, &i2cTransaction);
return I2C_transfer(i2c_handle, &i2cTransaction);
}
#define i2c_write(writeBuf, writeCount) i2c_write_read(writeBuf, writeCount, NULL, 0)
#define i2c_read(readBuf, readCount) i2c_write_read(NULL, 0, readBuf, readCount)
/*---------------------------------------------------------------------------*/
/**
* \brief Initalise the sensor
*
* @return true if success; else, false on error
* \brief Initalise the sensor.
* \return Boolean Value descibing whether initialization were
* successful or not.
* \retval true Successful initialization
* \retval false Error during initialization
*/
static bool
init(void)
{
if (i2cHandle) {
if (i2c_handle) {
return true;
}
I2C_Params i2cParams;
I2C_Params_init(&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_400kHz;
i2cHandle = I2C_open(Board_I2C0, &i2cParams);
if (i2cHandle == NULL) {
i2c_handle = I2C_open(Board_I2C0, &i2cParams);
if (i2c_handle == NULL) {
return false;
}
uint8_t reset_data[] = { ADDR_RESET, VAL_RESET_EXECUTE };
/* Read and store calibration data */
uint8_t calib_reg = ADDR_CALIB;
/* Read and store calibration data */
return i2c_write_read(&calib_reg, sizeof(calib_reg), &calib_data, sizeof(calib_data))
/* then reset the sensor */
&& i2c_write(reset_data, sizeof(reset_data));
}
/*---------------------------------------------------------------------------*/
/**
* \brief Enable/disable measurements
* \param enable 0: disable, enable otherwise
*
* @return none
* \brief Enable/disable measurements.
* \param enable Enable if true; else, disable.
* \return Boolean Value descibing whether initialization were
* successful or not.
* \retval true Successful initialization
* \retval false Error during initialization
*/
static bool
enable_sensor(bool enable)
@ -218,10 +225,13 @@ enable_sensor(bool enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Read temperature and pressure data
* \param data Pointer to a buffer where temperature and pressure will be
* written (6 bytes)
* \return True if valid data could be retrieved
* \brief Read temperature and pressure data.
* \param data Pointer to a buffer where temperature and pressure will be
* written (6 bytes).
* \return Boolean Value descibing whether initialization were
* successful or not.
* \retval true Successful initialization
* \retval false Error during initialization
*/
static bool
read_data(uint8_t *data, size_t count)
@ -231,12 +241,13 @@ read_data(uint8_t *data, size_t count)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Convert raw data to values in degrees C (temp) and Pascal (pressure)
* \param data Pointer to a buffer that holds raw sensor data
* \param temp Pointer to a variable where the converted temperature will be
* written
* \brief Convert raw data to values in degrees C (temp) and Pascal
* (pressure).
* \param data Pointer to a buffer that holds raw sensor data.
* \param temp Pointer to a variable where the converted temperature will
* be written.
* \param press Pointer to a variable where the converted pressure will be
* written
* written.
*/
static void
convert(uint8_t *data, int32_t *temp, uint32_t *press)
@ -337,9 +348,11 @@ convert(uint8_t *data, int32_t *temp, uint32_t *press)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns a reading from the sensor
* \param type BMP_280_SENSOR_TYPE_TEMP or BMP_280_SENSOR_TYPE_PRESS
* \return Temperature (centi degrees C) or Pressure (Pascal).
* \brief Returns a reading from the sensor.
* \param type Parameter of type BMP_280_SENSOR_TYPE, choosing between either
* measuring temperature or pressure.
* \return Sensor data of either Temperature (centi degrees C) or
* Pressure (Pascal).
*/
static int
value(int type)
@ -384,14 +397,12 @@ value(int type)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Configuration function for the BMP280 sensor.
*
* \param type Activate, enable or disable the sensor. See below
* \param enable
*
* When type == SENSORS_HW_INIT we turn on the hardware
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor
* \brief Configuration function for the BMP280 sensor.
* \param type Activate, enable or disable the sensor. See below
* \param enable Disable sensor if 0; else, enable sensor otherwise.
* When type == SENSORS_HW_INIT we turn on the hardware.
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor.
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor.
*/
static int
configure(int type, int enable)
@ -429,9 +440,9 @@ configure(int type, int enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the status of the sensor
* \param type SENSORS_ACTIVE or SENSORS_READY
* \return 1 if the sensor is enabled
* \brief Returns the status of the sensor.
* \param type SENSORS_ACTIVE or SENSORS_READY.
* \return Current status of the sensor.
*/
static int
status(int type)
@ -441,9 +452,8 @@ status(int type)
case SENSORS_READY:
return sensor_status;
default:
break;
return SENSOR_STATUS_DISABLED;
}
return SENSOR_STATUS_DISABLED;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(bmp_280_sensor, "BMP280", value, configure, status);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,12 +27,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-bmp-sensor SensorTag 2.0 Pressure Sensor
* \defgroup sensortag-bmp-sensor SensorTag Pressure Sensor
*
* Due to the time required for the sensor to startup, this driver is meant to
* be used in an asynchronous fashion. The caller must first activate the
@ -49,14 +48,22 @@
* @{
*
* \file
* Header file for the Sensortag BMP280 Altimeter / Pressure Sensor
* Header file for the Sensortag BMP280 Altimeter / Pressure Sensor
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef BMP_280_SENSOR_H_
#define BMP_280_SENSOR_H_
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "lib/sensors.h"
/*---------------------------------------------------------------------------*/
/* The BMP-280 driver uses the I2C0 peripheral to access the senssor */
#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0)
# error "The BMP280 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)"
#endif
/*---------------------------------------------------------------------------*/
typedef enum {
BMP_280_SENSOR_TYPE_TEMP,
BMP_280_SENSOR_TYPE_PRESS

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,32 +27,48 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
/**
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup sensortag-cc26xx-peripherals Sensortag CC1350/CC2650 common
* \defgroup sensortag-peripherals Sensortag peripherals
*
* Defines related to Sensortag sensors. The two sensortags are identical to a
* very large extent. Everything documented within this group applies to both
* sensortags.
* Defines related to configuring SensorTag peripherals. The two sensortags,
* CC1350STK and CC2650STK, are identical to a very large extent.
* Everything documented within this group applies to both sensortags.
*
* @{
*
* \file
* Header file with definitions related to the sensors on the Sensortags
*
* \note Do not include this file directly.
* Header file with definitions related to the sensors on the Sensortags
* \author
* Edvard Pettersen <e.pettersen@ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
#include "leds-arch.h"
/*---------------------------------------------------------------------------*/
/**
* \name Button configurations for the dev/button-hal.h API.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BUTTON_HAL_ID_KEY_LEFT 0
#define BUTTON_HAL_ID_KEY_RIGHT 1
#define BUTTON_HAL_ID_REED_RELAY 2
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name SensorTag does have sensors.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BOARD_CONF_HAS_SENSORS 1
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* BOARD_CONF_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,38 +27,35 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
/**
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup sensortag-cc26xx-peripherals Sensortag CC1350/CC2650 common
* \defgroup sensortag-peripherals Sensortag peripherals
*
* Defines related to Sensortag sensors. The two sensortags are identical to a
* very large extent. Everything documented within this group applies to both
* sensortags.
* Defines related to configuring SensorTag peripherals. The two sensortags,
* CC1350STK and CC2650STK, are identical to a very large extent.
* Everything documented within this group applies to both sensortags.
*
* @{
*
* \file
* Header file with definitions related to the sensors on the Sensortags
*
* \note Do not include this file directly.
* Header file with definitions related to the sensors on the Sensortags
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_PERIPHERALS_H_
#define BOARD_PERIPHERALS_H_
/*---------------------------------------------------------------------------*/
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
#include "bmp-280-sensor.h"
#include "tmp-007-sensor.h"
#include "opt-3001-sensor.h"
#include "hdc-1000-sensor.h"
#include "mpu-9250-sensor.h"
#include "buzzer.h"
#include "ext-flash.h"
/*---------------------------------------------------------------------------*/
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
#define BOARD_CONF_HAS_SENSORS 1
/*---------------------------------------------------------------------------*/
#endif /* BOARD_PERIPHERALS_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -27,45 +27,51 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup launchpad-button-sensor
* \addtogroup sensortag-peripherals
* @{
*
* \file
* Driver for LaunchPad buttons
* Button HAL definitions for the SensorTag buttons. Common across
* all CC13xx/CC26xx SensorTag boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "dev/button-hal.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
/* Key left button, AKA BTN-1 */
BUTTON_HAL_BUTTON(key_left, /**< Name */
"Key Left", /**< Description */
Board_KEY_LEFT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_left, /**< Name */
"Key Left", /**< Description */
Board_KEY_LEFT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
/* Key right button, AKA BTN-2 */
BUTTON_HAL_BUTTON(key_right, /**< Name */
"Key Right", /**< Description */
Board_KEY_RIGHT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_right, /**< Name */
"Key Right", /**< Description */
Board_KEY_RIGHT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(reed_relay, /**< Name */
"Reed Relay", /**< Description */
Board_RELAY, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLDOWN |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_REED_RELAY, /**< Unique ID */
true); /**< Negative logic */
/* Reed Relay button */
BUTTON_HAL_BUTTON(
reed_relay, /**< Name */
"Reed Relay", /**< Description */
Board_RELAY, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLDOWN |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_REED_RELAY, /**< Unique ID */
true); /**< Negative logic */
/*---------------------------------------------------------------------------*/
BUTTON_HAL_BUTTONS(&key_left, &key_right, &reed_relay);
/*---------------------------------------------------------------------------*/

View File

@ -29,11 +29,13 @@
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-buzzer
* \addtogroup sensortag-buzzer
* @{
*
* \file
* Driver for the Sensortag Buzzer
* Driver for the Sensortag Buzzer.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -78,13 +80,13 @@ buzzer_init()
GPTimerCC26XX_Params gpt_params;
GPTimerCC26XX_Params_init(&gpt_params);
gpt_params.mode = GPT_CONFIG_16BIT;
gpt_params.mode = GPT_MODE_PERIODIC_UP;
gpt_params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
gpt_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &gpt_params);
if (!gpt_handle) {
PIN_close(pin_handle);
return false;
}
@ -120,7 +122,7 @@ buzzer_start(uint32_t freq)
return false;
}
Power_setDependency(PowerCC26XX_XOSC_HF );
Power_setDependency(PowerCC26XX_XOSC_HF);
PINCC26XX_setMux(pin_handle, BUZZER_PIN, GPT_PIN_0A);
@ -145,10 +147,12 @@ buzzer_stop()
return;
}
Power_releaseDependency(PowerCC26XX_XOSC_HF );
Power_releaseDependency(PowerCC26XX_XOSC_HF);
GPTimerCC26XX_stop(gpt_handle);
PIN_close(pin_handle);
pin_handle = NULL;
is_running = false;
}

View File

@ -27,16 +27,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-buzzer SensorTag 2.0 Buzzer
* \defgroup sensortag-buzzer SensorTag Buzzer
* @{
*
* \file
* Header file for the Sensortag Buzzer
* Header file for the Sensortag Buzzer.
* \author
* Edvard Pettersen <e.pettersen@ti.com>.
*/
/*---------------------------------------------------------------------------*/
#ifndef BUZZER_H_
@ -46,24 +47,26 @@
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
/**
* \brief Initialise the buzzer
* \brief Initialise the buzzer
*/
bool buzzer_init(void);
/**
* \brief Start the buzzer
* \param freq The buzzer frequency
* \brief Start the buzzer.
* \param freq The buzzer frequency in Hz.
*/
bool buzzer_start(uint32_t freq);
/**
* \brief Stop the buzzer
* \brief Stop the buzzer.
*/
void buzzer_stop(void);
/**
* \brief Retrieve the buzzer state
* \return 1: on, 0: off
* \brief Retrieve the buzzer state.
* \return Running status of the buzzer.
* \retval 0 Buzzer is off
* \retval 1 Buzzer is on
*/
bool buzzer_running(void);
/*---------------------------------------------------------------------------*/

View File

@ -80,19 +80,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC1350STK_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#ifndef CC1350STK_DISPLAY_UART_STRBUF_SIZE
#define CC1350STK_DISPLAY_UART_STRBUF_SIZE 128
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef CC1350STK_DISPLAY_SHARP_SIZE
#define CC1350STK_DISPLAY_SHARP_SIZE 96
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[CC1350STK_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[CC1350STK_DISPLAY_SHARP_SIZE * CC1350STK_DISPLAY_SHARP_SIZE / 8];
DisplayUart_Object displayUartObject;
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1350STK_UART0,
@ -102,6 +104,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = CC1350STK_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[CC1350STK_DISPLAY_SHARP_SIZE * CC1350STK_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1350STK_SPI0,
.csPin = CC1350STK_GPIO_LCD_CS,
@ -112,30 +130,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
/*
* The pins for the UART and Watch Devpack conflict, prefer UART by default
*/
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -145,7 +151,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -161,7 +167,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -249,9 +255,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350STK_GPTIMERPARTSCOUNT] = {
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1350STK_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350STK_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -260,19 +269,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350STK_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1350STK_I2C0_SDA0,
.sclPin = CC1350STK_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1350STK_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1350STK_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1350STK_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1350STK_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -283,10 +297,10 @@ const uint_least8_t I2C_count = CC1350STK_I2CCOUNT;
#define NVS_REGIONS_BASE 0x1A000
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#define SPIREGIONSIZE (SECTORSIZE * 32)
#define VERIFYBUFSIZE 64
static uint8_t verifyBuf[VERIFYBUFSIZE];
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -327,7 +341,6 @@ static char flashBuf[REGIONSIZE];
/* Allocate objects for NVS and NVS SPI */
NVSCC26XX_Object nvsCC26xxObjects[1];
NVSSPI25X_Object nvsSPI25XObjects[1];
/* Hardware attributes for NVS */
const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
@ -337,12 +350,24 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SECTORSIZE * 32)
#define VERIFYBUFSIZE 64
static uint8_t verifyBuf[VERIFYBUFSIZE];
NVSSPI25X_Object nvsSPI25XObjects[1];
/* Hardware attributes for NVS SPI */
const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
{
.regionBaseOffset = 0,
.regionSize = SPIREGIONSIZE,
.sectorSize = SECTORSIZE,
.sectorSize = SPISECTORSIZE,
.verifyBuf = verifyBuf,
.verifyBufSize = VERIFYBUFSIZE,
.spiHandle = NULL,
@ -352,22 +377,30 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1350STK_NVSCOUNT] = {
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
.hwAttrs = &nvsSPI25XHWAttrs[0],
},
#endif
};
const uint_least8_t NVS_count = CC1350STK_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PDM ===============================
*/
@ -516,9 +549,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350STK_SPICOUNT];
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350STK_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -534,6 +570,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350STK_SPICOUNT] = {
.csnPin = CC1350STK_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -548,35 +586,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350STK_SPICOUNT] = {
.clkPin = CC1350STK_SPI1_CLK,
.csnPin = CC1350STK_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1350STK_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350STK_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350STK_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350STK_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350STK_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1350STK_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1350STK_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1350STK_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350STK_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -592,19 +640,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350STK_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1350STK_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1350STK_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1350STK_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1350STK_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -48,6 +48,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/DeviceFamily.h>
@ -233,7 +235,9 @@ typedef enum CC1350STK_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1350STK_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1350STK_I2C0 = 0,
#endif
CC1350STK_I2CCOUNT
} CC1350STK_I2CName;
@ -243,8 +247,12 @@ typedef enum CC1350STK_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1350STK_NVSName {
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1350STK_NVSCC26XX0 = 0,
#endif
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC1350STK_NVSSPI25X0,
#endif
CC1350STK_NVSCOUNT
} CC1350STK_NVSName;
@ -281,8 +289,12 @@ typedef enum CC1350STK_PWMName {
* @brief Enum of SPI names
*/
typedef enum CC1350STK_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1350STK_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1350STK_SPI1,
#endif
CC1350STK_SPICOUNT
} CC1350STK_SPIName;
@ -292,7 +304,9 @@ typedef enum CC1350STK_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1350STK_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1350STK_UART0 = 0,
#endif
CC1350STK_UARTCOUNT
} CC1350STK_UARTName;

View File

@ -27,25 +27,26 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-platform
* \addtogroup sensortag-peripherals
* @{
*
* \file
* Driver for LaunchPad LEDs
* LED HAL definitions for the CC1350STK LEDs. Is not compatible with
* the CC2650STK.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "dev/leds.h"
/*---------------------------------------------------------------------------*/
/* Simplelink SDK API */
#include <Board.h>
/*---------------------------------------------------------------------------*/
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
const leds_t leds_arch_leds[] = {
/* Red LED, AKA LED0 */
{ .pin = Board_PIN_LED0, .negative_logic = false },
};
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,27 +27,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
*
* Defines related to LaunchPad peripherals.
*
/** \addtogroup sensortag-peripherals
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* LED HAL definitions for the CC1350STK LEDs. Is not compatible with
* the CC2650STK.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef LEDS_ARCH_H_
#define LEDS_ARCH_H_
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
* \name LED configurations for the dev/leds.h API.
*
* Those values are not meant to be modified by the user
* @{
@ -57,10 +51,10 @@
#define LEDS_CONF_RED 0
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* LEDS_ARCH_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -81,19 +81,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC2650STK_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#ifndef CC2650STK_DISPLAY_UART_STRBUF_SIZE
#define CC2650STK_DISPLAY_UART_STRBUF_SIZE 128
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef CC2650STK_DISPLAY_SHARP_SIZE
#define CC2650STK_DISPLAY_SHARP_SIZE 96
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[CC2650STK_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[CC2650STK_DISPLAY_SHARP_SIZE * CC2650STK_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC2650STK_UART0,
@ -103,6 +105,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = CC2650STK_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[CC2650STK_DISPLAY_SHARP_SIZE * CC2650STK_DISPLAY_SHARP_SIZE / 8];
DisplayUart_Object displayUartObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC2650STK_SPI0,
.csPin = CC2650STK_GPIO_LCD_CS,
@ -113,30 +131,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
/*
* The pins for the UART and Watch Devpack conflict, prefer UART by default
*/
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -146,7 +152,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -162,7 +168,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -250,9 +256,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650STK_GPTIMERPARTSCOUNT] = {
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC2650STK_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650STK_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -261,19 +270,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650STK_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC2650STK_I2C0_SDA0,
.sclPin = CC2650STK_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC2650STK_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC2650STK_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC2650STK_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC2650STK_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -284,10 +298,10 @@ const uint_least8_t I2C_count = CC2650STK_I2CCOUNT;
#define NVS_REGIONS_BASE 0x1A000
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#define SPIREGIONSIZE (SECTORSIZE * 32)
#define VERIFYBUFSIZE 64
static uint8_t verifyBuf[VERIFYBUFSIZE];
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -326,9 +340,7 @@ static char flashBuf[REGIONSIZE];
#endif
/* Allocate objects for NVS and NVS SPI */
NVSCC26XX_Object nvsCC26xxObjects[1];
NVSSPI25X_Object nvsSPI25XObjects[1];
/* Hardware attributes for NVS */
const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
@ -338,12 +350,25 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
#define SPISECTORSIZE 0x1000
#define SPIREGIONSIZE (SPISECTORSIZE * 32)
#define VERIFYBUFSIZE 64
static uint8_t verifyBuf[VERIFYBUFSIZE];
/* Allocate objects for NVS and NVS SPI */
NVSSPI25X_Object nvsSPI25XObjects[1];
/* Hardware attributes for NVS SPI */
const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
{
.regionBaseOffset = 0,
.regionSize = SPIREGIONSIZE,
.sectorSize = SECTORSIZE,
.sectorSize = SPISECTORSIZE,
.verifyBuf = verifyBuf,
.verifyBufSize = VERIFYBUFSIZE,
.spiHandle = NULL,
@ -353,22 +378,30 @@ const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC2650STK_NVSCOUNT] = {
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
.hwAttrs = &nvsCC26xxHWAttrs[0],
},
#endif
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
{
.fxnTablePtr = &NVSSPI25X_fxnTable,
.object = &nvsSPI25XObjects[0],
.hwAttrs = &nvsSPI25XHWAttrs[0],
},
#endif
};
const uint_least8_t NVS_count = CC2650STK_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PDM ===============================
*/
@ -517,9 +550,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650STK_SPICOUNT];
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650STK_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -535,6 +571,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650STK_SPICOUNT] = {
.csnPin = CC2650STK_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -549,35 +587,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650STK_SPICOUNT] = {
.clkPin = CC2650STK_SPI1_CLK,
.csnPin = CC2650STK_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC2650STK_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650STK_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650STK_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650STK_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650STK_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC2650STK_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC2650STK_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC2650STK_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650STK_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -593,19 +641,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650STK_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC2650STK_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC2650STK_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC2650STK_UART0]
},
#endif
};
const uint_least8_t UART_count = CC2650STK_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -48,6 +48,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/DeviceFamily.h>
@ -234,7 +236,9 @@ typedef enum CC2650STK_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC2650STK_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC2650STK_I2C0 = 0,
#endif
CC2650STK_I2CCOUNT
} CC2650STK_I2CName;
@ -244,8 +248,12 @@ typedef enum CC2650STK_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC2650STK_NVSName {
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC2650STK_NVSCC26XX0 = 0,
#endif
#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
CC2650STK_NVSSPI25X0,
#endif
CC2650STK_NVSCOUNT
} CC2650STK_NVSName;
@ -282,8 +290,12 @@ typedef enum CC2650STK_PWMName {
* @brief Enum of SPI names
*/
typedef enum CC2650STK_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC2650STK_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC2650STK_SPI1,
#endif
CC2650STK_SPICOUNT
} CC2650STK_SPIName;
@ -293,7 +305,10 @@ typedef enum CC2650STK_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC2650STK_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC2650STK_UART0 = 0,
#endif
CC2650STK_UARTCOUNT
} CC2650STK_UARTName;

View File

@ -27,26 +27,28 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-platform
* \addtogroup sensortag-peripherals
* @{
*
* \file
* Driver for LaunchPad LEDs
* LED HAL definitions for the CC2650STK LEDs. Is not compatible with
* the CC1350STK.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "dev/leds.h"
/*---------------------------------------------------------------------------*/
/* Simplelink SDK API */
#include <Board.h>
/*---------------------------------------------------------------------------*/
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
const leds_t leds_arch_leds[] = {
/* Red LED, AKA LED0 */
{ .pin = Board_PIN_LED0, .negative_logic = false },
/* Green LED, AKA LED1 */
{ .pin = Board_PIN_LED1, .negative_logic = false },
};
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,27 +27,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
*
* Defines related to LaunchPad peripherals.
*
/** \addtogroup sensortag-peripherals
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* LED HAL definitions for the CC1350STK LEDs. Is not compatible with
* the CC2650STK.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef LEDS_ARCH_H_
#define LEDS_ARCH_H_
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
* \name LED configurations for the dev/leds.h API.
*
* Those values are not meant to be modified by the user
* @{
@ -58,10 +52,10 @@
#define LEDS_CONF_GREEN 1
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* LEDS_ARCH_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -1,468 +0,0 @@
/*
* Copyright (c) 2014, 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 sensortag-cc26xx-ext-flash
* @{
*
* \file
* Sensortag/LaunchPad External Flash Driver
*/
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/SPI.h>
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "ext-flash.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
static PIN_Config pin_table[] = {
Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,
PIN_TERMINATE
};
static PIN_State pin_state;
static PIN_Handle pin_handle;
static SPI_Handle spi_handle;
static bool ext_flash_opened;
/*---------------------------------------------------------------------------*/
#define SPI_BIT_RATE 4000000
/* Instruction codes */
#define BLS_CODE_PROGRAM 0x02 /**< Page Program */
#define BLS_CODE_READ 0x03 /**< Read Data */
#define BLS_CODE_READ_STATUS 0x05 /**< Read Status Register */
#define BLS_CODE_WRITE_ENABLE 0x06 /**< Write Enable */
#define BLS_CODE_SECTOR_ERASE 0x20 /**< Sector Erase */
#define BLS_CODE_MDID 0x90 /**< Manufacturer Device ID */
#define BLS_CODE_DP 0xB9 /**< Power down */
#define BLS_CODE_RDP 0xAB /**< Power standby */
/* Erase instructions */
#define BLS_CODE_ERASE_4K 0x20 /**< Sector Erase */
#define BLS_CODE_ERASE_32K 0x52
#define BLS_CODE_ERASE_64K 0xD8
#define BLS_CODE_ERASE_ALL 0xC7 /**< Mass Erase */
/* Bitmasks of the status register */
#define BLS_STATUS_SRWD_BM 0x80
#define BLS_STATUS_BP_BM 0x0C
#define BLS_STATUS_WEL_BM 0x02
#define BLS_STATUS_WIP_BM 0x01
#define BLS_STATUS_BIT_BUSY 0x01 /**< Busy bit of the status register */
/* Part specific constants */
#define BLS_PROGRAM_PAGE_SIZE 0x100 /**< Page size 0x100 */
#define BLS_ERASE_SECTOR_SIZE 0x1000 /**< Sector size 0x1000 */
/*---------------------------------------------------------------------------*/
typedef struct
{
uint8_t manfId; /**< Manufacturer ID */
uint8_t devId; /**< Device ID */
} ExtFlashInfo;
/* Supported flash devices */
static const ExtFlashInfo supported_devices[] =
{
{
.manfId = 0xC2, /**< Macronics MX25R1635F */
.devId = 0x15
},
{
.manfId = 0xC2, /**< Macronics MX25R8035F */
.devId = 0x14
},
{
.manfId = 0xEF, /**< WinBond W25X40CL */
.devId = 0x12
},
{
.manfId = 0xEF, /**< WinBond W25X20CL */
.devId = 0x11
}
};
/*---------------------------------------------------------------------------*/
static bool
spi_write(const uint8_t *buf, size_t len)
{
SPI_Transaction spiTransaction;
spiTransaction.count = len;
spiTransaction.txBuf = (void *)buf;
spiTransaction.rxBuf = NULL;
return SPI_transfer(spi_handle, &spiTransaction);
}
/*---------------------------------------------------------------------------*/
static bool
spi_read(uint8_t *buf, size_t len)
{
SPI_Transaction spiTransaction;
spiTransaction.count = len;
spiTransaction.txBuf = NULL;
spiTransaction.rxBuf = buf;
return SPI_transfer(spi_handle, &spiTransaction);
}
/*---------------------------------------------------------------------------*/
static void
select(void)
{
PIN_setOutputValue(pin_handle, Board_SPI_FLASH_CS, 1);
}
/*---------------------------------------------------------------------------*/
static void
deselect(void)
{
PIN_setOutputValue(pin_handle, Board_SPI_FLASH_CS, 0);
}
/*---------------------------------------------------------------------------*/
static bool
wait_ready(void)
{
const uint8_t wbuf[] = { BLS_CODE_READ_STATUS };
uint8_t rbuf[1] = { 0x0 };
/* TODO are 1000 tries enough? */
for (size_t i = 0; i < 1000; ++i) {
select();
const bool spi_ok = spi_write(wbuf, sizeof(wbuf))
&& spi_read(rbuf, sizeof(rbuf));
deselect();
if (!spi_ok) {
/* Error */
return false;
}
if (!(rbuf[0] & BLS_STATUS_BIT_BUSY)) {
/* Now ready */
return true;
}
}
return false;
}
/*---------------------------------------------------------------------------*/
static bool
power_standby(void)
{
const uint8_t cmd[] = { BLS_CODE_RDP };
select();
const bool spi_ok = spi_write(cmd, sizeof(cmd));
deselect();
if (!spi_ok) {
return false;
}
/* Waking up of the device is manufacturer dependent.
* for a Winond chip-set, once the request to wake up the flash has been
* send, CS needs to stay high at least 3us (for Winbond part)
* for chip-set like Macronix, it can take up to 35us.
* 3 cycles per loop: 560 loops @ 48 MHz = 35 us */
ti_lib_cpu_delay(560);
return wait_ready();
}
/*---------------------------------------------------------------------------*/
static bool
power_down(void)
{
const uint8_t cmd[] = { BLS_CODE_DP };
select();
const bool spi_ok = spi_write(cmd, sizeof(cmd));
deselect();
return spi_ok;
}
/*---------------------------------------------------------------------------*/
static bool
write_enable(void)
{
const uint8_t wbuf[] = { BLS_CODE_WRITE_ENABLE };
select();
const bool spi_ok = spi_write(wbuf, sizeof(wbuf));
deselect();
return spi_ok;
}
/*---------------------------------------------------------------------------*/
/**
* \brief Verify the flash part.
* \retval bool true on success; else, false
*/
static bool
verify_part(void)
{
const uint8_t wbuf[] = { BLS_CODE_MDID, 0xFF, 0xFF, 0x00 };
uint8_t rbuf[2] = { 0x0 };
const bool spi_ok = spi_write(wbuf, sizeof(wbuf))
&& spi_read(rbuf, sizeof(rbuf));
if (!spi_ok) {
return false;
}
const ExtFlashInfo curr_device = {
.manfId = rbuf[0],
.devId = rbuf[1]
};
const size_t num_devices = sizeof(supported_devices) / sizeof(supported_devices[0]);
for (size_t i = 0; i < num_devices; ++i) {
if (curr_device.manfId == supported_devices[i].manfId &&
curr_device.devId == supported_devices[i].devId) {
return true;
}
}
return false;
}
/*---------------------------------------------------------------------------*/
bool
ext_flash_open()
{
if (ext_flash_opened) {
return true;
}
pin_handle = PIN_open(&pin_state, pin_table);
if (pin_handle == NULL) {
return false;
}
SPI_Params spiParams;
SPI_Params_init(&spiParams);
spiParams.bitRate = SPI_BIT_RATE;
spiParams.mode = SPI_MASTER;
spiParams.transferMode = SPI_MODE_BLOCKING;
spi_handle = SPI_open(Board_SPI0, &spiParams);
if (spi_handle == NULL) {
PIN_close(pin_handle);
return false;
}
ext_flash_opened = true;
deselect();
const bool is_powered = power_standby();
if (!is_powered) {
ext_flash_close();
return false;
}
return verify_part();
}
/*---------------------------------------------------------------------------*/
void
ext_flash_close()
{
if (!ext_flash_opened) {
return;
}
ext_flash_opened = false;
power_down();
SPI_close(spi_handle);
PIN_close(pin_handle);
}
/*---------------------------------------------------------------------------*/
bool
ext_flash_read(size_t offset, size_t length, uint8_t *buf)
{
if (spi_handle == NULL || buf == NULL) {
return false;
}
if (length == 0) {
return true;
}
const bool is_ready = wait_ready();
if (!is_ready) {
return false;
}
const uint8_t wbuf[] = {
BLS_CODE_READ,
(offset >> 16) & 0xFF,
(offset >> 8) & 0xFF,
(offset >> 0) & 0xFF,
};
select();
const bool spi_ok = spi_write(wbuf, sizeof(wbuf))
&& spi_read(buf, length);
deselect();
return (spi_ok);
}
/*---------------------------------------------------------------------------*/
bool
ext_flash_write(size_t offset, size_t length, const uint8_t *buf)
{
if (spi_handle == NULL || buf == NULL) {
return false;
}
uint8_t wbuf[4] = { BLS_CODE_PROGRAM, 0, 0, 0 };
while (length > 0)
{
/* Wait till previous erase/program operation completes */
if (!wait_ready()) {
return false;
}
/* Enable writing */
if (!write_enable()) {
return false;
}
/* Interim length per instruction */
size_t ilen = BLS_PROGRAM_PAGE_SIZE - (offset % BLS_PROGRAM_PAGE_SIZE);
if (length < ilen) {
ilen = length;
}
wbuf[1] = (offset >> 16) & 0xFF;
wbuf[2] = (offset >> 8) & 0xFF;
wbuf[3] = (offset >> 0) & 0xFF;
offset += ilen;
length -= ilen;
/* Up to 100ns CS hold time (which is not clear
* whether it's application only in between reads)
* is not imposed here since above instructions
* should be enough to delay
* as much. */
select();
const bool spi_ok = spi_write(wbuf, sizeof(wbuf))
&& spi_write(buf, ilen);
buf += ilen;
deselect();
if (!spi_ok) {
return false;
}
}
return true;
}
/*---------------------------------------------------------------------------*/
bool
ext_flash_erase(size_t offset, size_t length)
{
/* Note that Block erase might be more efficient when the floor map
* is well planned for OTA but to simplify for the temporary implemetation,
* sector erase is used blindly. */
uint8_t wbuf[4] = { BLS_CODE_SECTOR_ERASE, 0x0, 0x0, 0x0 };
const size_t endoffset = offset + length - 1;
offset = (offset / BLS_ERASE_SECTOR_SIZE) * BLS_ERASE_SECTOR_SIZE;
const size_t numsectors = (endoffset - offset + BLS_ERASE_SECTOR_SIZE - 1) / BLS_ERASE_SECTOR_SIZE;
for (size_t i = 0; i < numsectors; ++i) {
/* Wait till previous erase/program operation completes */
if (!wait_ready()) {
return false;
}
/* Enable writing */
if (!write_enable()) {
return false;
}
wbuf[1] = (offset >> 16) & 0xFF;
wbuf[2] = (offset >> 8) & 0xFF;
wbuf[3] = (offset >> 0) & 0xFF;
select();
const bool spi_ok = spi_write(wbuf, sizeof(wbuf));
deselect();
if (!spi_ok) {
return false;
}
offset += BLS_ERASE_SECTOR_SIZE;
}
return true;
}
/*---------------------------------------------------------------------------*/
bool
ext_flash_test(void)
{
const bool ret = ext_flash_open();
ext_flash_close();
return ret;
}
/*---------------------------------------------------------------------------*/
void
ext_flash_init()
{
SPI_init();
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -1,116 +0,0 @@
/*
* Copyright (c) 2014, 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 common-cc26xx-peripherals
* @{
*
* \defgroup sensortag-cc26xx-ext-flash SensorTag/LaunchPad External Flash
* @{
*
* \file
* Header file for the Sensortag/LaunchPad External Flash Driver
*/
/*---------------------------------------------------------------------------*/
#ifndef EXT_FLASH_H_
#define EXT_FLASH_H_
/*---------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
/**
* \brief Initialize storage driver.
* \return True when successful.
*/
bool ext_flash_open(void);
/**
* \brief Close the storage driver
*
* This call will put the device in its lower power mode (power down).
*/
void ext_flash_close(void);
/**
* \brief Read storage content
* \param offset Address to read from
* \param length Number of bytes to read
* \param buf Buffer where to store the read bytes
* \return True when successful.
*
* buf must be allocated by the caller
*/
bool ext_flash_read(size_t offset, size_t length, uint8_t *buf);
/**
* \brief Erase storage sectors corresponding to the range.
* \param offset Address to start erasing
* \param length Number of bytes to erase
* \return True when successful.
*
* The erase operation will be sector-wise, therefore a call to this function
* will generally start the erase procedure at an address lower than offset
*/
bool ext_flash_erase(size_t offset, size_t length);
/**
* \brief Write to storage sectors.
* \param offset Address to write to
* \param length Number of bytes to write
* \param buf Buffer holding the bytes to be written
*
* \return True when successful.
*/
bool ext_flash_write(size_t offset, size_t length, const uint8_t *buf);
/**
* \brief Test the flash (power on self-test)
* \return True when successful.
*/
bool ext_flash_test(void);
/**
* \brief Initialise the external flash
*
* This function will explicitly put the part in its lowest power mode
* (power-down).
*
* In order to perform any operation, the caller must first wake the device
* up by calling ext_flash_open()
*/
void ext_flash_init(void);
/*---------------------------------------------------------------------------*/
#endif /* EXT_FLASH_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-hdc-sensor
* \addtogroup sensortag-hdc-sensor
* @{
*
* \file
* Driver for the Sensortag HDC sensor
* Driver for the Sensortag HDC1000 sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -58,7 +59,7 @@
#endif
/*---------------------------------------------------------------------------*/
#ifndef Board_HDC1000_ADDR
# error "Board file doesn't define I2C address Board_HDC1000_ADDR"
# error "Board file doesn't define the I2C address Board_HDC1000_ADDR"
#endif
/* Sensor I2C address */
#define HDC1000_I2C_ADDRESS Board_HDC1000_ADDR
@ -72,15 +73,11 @@
#define HDC1000_REG_SERID_L 0xFD /* Serial ID low */
#define HDC1000_REG_MANF_ID 0xFE /* Manufacturer ID */
#define HDC1000_REG_DEV_ID 0xFF /* Device ID */
/*---------------------------------------------------------------------------*/
/* Fixed values */
#define HDC1000_VAL_MANF_ID 0x5449
#define HDC1000_VAL_DEV_ID 0x1000
#define HDC1000_VAL_CONFIG 0x1000 /* 14 bit, acquired in sequence */
/* Sensor selection/deselection */
#define SENSOR_SELECT() board_i2c_select(BOARD_I2C_INTERFACE_0, SENSOR_I2C_ADDRESS)
#define SENSOR_DESELECT() board_i2c_deselect()
/*---------------------------------------------------------------------------*/
/* Byte swap of 16-bit register value */
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
@ -90,7 +87,7 @@
#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v))
/*---------------------------------------------------------------------------*/
static I2C_Handle i2cHandle;
static I2C_Handle i2c_handle;
/*---------------------------------------------------------------------------*/
/* Raw data as returned from the sensor (Big Endian) */
typedef struct {
@ -117,43 +114,74 @@ static volatile HDC_1000_SENSOR_STATUS sensor_status = HDC_1000_SENSOR_STATUS_DI
static struct ctimer startup_timer;
/*---------------------------------------------------------------------------*/
/**
* \brief Setup and peform an I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static bool
i2c_transaction(void *writeBuf, size_t writeCount, void *readBuf, size_t readCount)
i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount)
{
I2C_Transaction i2cTransaction = {
.writeBuf = writeBuf,
.writeCount = writeCount,
.readBuf = readBuf,
.readCount = readCount,
I2C_Transaction i2c_transaction = {
.writeBuf = wbuf,
.writeCount = wcount,
.readBuf = rbuf,
.readCount = rcount,
.slaveAddress = HDC1000_I2C_ADDRESS,
};
return I2C_transfer(i2cHandle, &i2cTransaction);
return I2C_transfer(i2c_handle, &i2c_transaction);
}
#define i2c_write(writeBuf, writeCount) i2c_transaction(writeBuf, writeCount, NULL, 0)
#define i2c_read(readBuf, readCount) i2c_transaction(NULL, 0, readBuf, readCount)
#define i2c_write_read(writeBuf, writeCount, readBuf, readCount) \
i2c_transaction(writeBuf, writeCount, readBuf, readCount)
/**
* \brief Peform a write only I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_write(void *wbuf, size_t wcount)
{
return i2c_write_read(wbuf, wcount, NULL, 0);
}
/**
* \brief Peform a read only I2C transaction.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_read(void *rbuf, size_t rcount)
{
return i2c_write_read(NULL, 0, rbuf, rcount);
}
/*---------------------------------------------------------------------------*/
/**
* \brief Initialise the humidity sensor driver
* \return True if I2C operation successful
* \brief Initialize the HDC-1000 sensor driver.
* \return true if I2C operation successful; else, return false.
*/
static bool
sensor_init(void)
{
if (i2cHandle) {
if (i2c_handle) {
return true;
}
I2C_Params i2cParams;
I2C_Params_init(&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_400kHz;
I2C_Params i2c_params;
I2C_Params_init(&i2c_params);
i2cHandle = I2C_open(Board_I2C0, &i2cParams);
if (i2cHandle == NULL) {
i2c_params.transferMode = I2C_MODE_BLOCKING;
i2c_params.bitRate = I2C_400kHz;
i2c_handle = I2C_open(Board_I2C0, &i2c_params);
if (i2c_handle == NULL) {
return false;
}
@ -164,8 +192,8 @@ sensor_init(void)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Start measurement
* \return True if I2C operation successful
* \brief Start measurement.
* \return true if I2C operation successful; else, return false.
*/
static bool
start(void)
@ -176,9 +204,9 @@ start(void)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Convert raw data to temperature and humidity
* \param temp - converted temperature
* \param hum - converted humidity
* \brief Convert raw data to temperature and humidity.
* \param temp Output variable to store converted temperature.
* \param hum Output variable to store converted humidity.
*/
static void
convert(int32_t *temp, int32_t *hum)
@ -192,9 +220,15 @@ convert(int32_t *temp, int32_t *hum)
*hum = raw_hum * 100 * 100 / 65536;
}
/*---------------------------------------------------------------------------*/
/**
* \brief Callback when sensor is ready to read data from.
*/
static void
notify_ready(void *not_used)
notify_ready(void *unused)
{
/* Unused args */
(void)unused;
/* Latch readings */
if (i2c_read(&sensor_data, sizeof(sensor_data))) {
sensor_status = HDC_1000_SENSOR_STATUS_READINGS_READY;
@ -206,9 +240,9 @@ notify_ready(void *not_used)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns a reading from the sensor
* \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMIDITY
* \return Temperature (centi degrees C) or Humidity (centi %RH)
* \brief Returns a reading from the sensor.
* \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID.
* \return Temperature (centi degrees C) or Humidity (centi %RH).
*/
static int
value(int type)
@ -223,13 +257,13 @@ value(int type)
switch (type) {
case HDC_1000_SENSOR_TYPE_TEMP:
case HDC_1000_SENSOR_TYPE_HUMIDITY:
case HDC_1000_SENSOR_TYPE_HUMID:
convert(&temp, &hum);
PRINTF("HDC: t=%d h=%d\n", (int)temp, (int)hum);
if (type == HDC_1000_SENSOR_TYPE_TEMP) {
return (int)temp;
} else if (type == HDC_1000_SENSOR_TYPE_HUMIDITY) {
} else if (type == HDC_1000_SENSOR_TYPE_HUMID) {
return (int)hum;
} else {
return HDC_1000_READING_ERROR;
@ -242,14 +276,12 @@ value(int type)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Configuration function for the HDC1000 sensor.
*
* \param type Activate, enable or disable the sensor. See below
* \param enable
*
* When type == SENSORS_HW_INIT we turn on the hardware
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor
* \brief Configuration function for the HDC1000 sensor.
* \param type Activate, enable or disable the sensor. See below.
* \param enable Either enable or disable the sensor.
* When type == SENSORS_HW_INIT we turn on the hardware.
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor.
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor.
*/
static int
configure(int type, int enable)
@ -291,9 +323,9 @@ configure(int type, int enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the status of the sensor
* \param type SENSORS_ACTIVE or SENSORS_READY
* \return One of the SENSOR_STATUS_xyz defines
* \brief Returns the status of the sensor.
* \param type SENSORS_ACTIVE or SENSORS_READY.
* \return One of the SENSOR_STATUS_xyz defines.
*/
static int
status(int type)
@ -302,12 +334,10 @@ status(int type)
case SENSORS_ACTIVE:
case SENSORS_READY:
return sensor_status;
break;
default:
break;
return HDC_1000_SENSOR_STATUS_DISABLED;
}
return HDC_1000_SENSOR_STATUS_DISABLED;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(hdc_1000_sensor, "HDC1000", value, configure, status);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,12 +27,12 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-hdc-sensor SensorTag 2.0 TI HDC1000 Sensor
* \defgroup sensortag-hdc-sensor SensorTag HDC1000 - Temperature and
* Humidity Sensor
*
* Due to the time required for the sensor to startup, this driver is meant to
* be used in an asynchronous fashion. The caller must first activate the
@ -45,28 +45,35 @@
* and latch them. It will then generate a sensors_changed event.
*
* The user can then retrieve readings by calling .value() and by passing
* either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMIDITY as the
* either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID as the
* argument. Multiple calls to value() will not trigger new readings, they will
* simply return the most recent latched values.
*
* The user can query the sensor's status by calling .status()
* The user can query the sensor's status by calling status().
*
* To get a fresh reading, the user must trigger a new reading cycle by calling
* SENSORS_ACTIVATE().
* @{
*
* \file
* Header file for the Sensortag TI HDC1000 sensor
* Header file for the Sensortag HDC1000 sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef HDC_1000_SENSOR_H
#define HDC_1000_SENSOR_H
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "lib/sensors.h"
/*---------------------------------------------------------------------------*/
#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0)
# error "The HDC-1000 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)"
#endif
/*---------------------------------------------------------------------------*/
typedef enum {
HDC_1000_SENSOR_TYPE_TEMP,
HDC_1000_SENSOR_TYPE_HUMIDITY
HDC_1000_SENSOR_TYPE_HUMID
} HDC_1000_SENSOR_TYPE;
/*---------------------------------------------------------------------------*/
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,23 +27,27 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-mpu
* \addtogroup sensortag-mpu
* @{
*
* \file
* Driver for the Sensortag Invensense MPU9250 motion processing unit
* Driver for the Sensortag Invensense MPU9250 motion processing unit
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "lib/sensors.h"
#include "sys/rtimer.h"
#include "mpu-9250-sensor.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/cpu.h)
#include <ti/drivers/PIN.h>
#include <ti/drivers/I2C.h>
/*---------------------------------------------------------------------------*/
@ -60,16 +64,17 @@
#endif
/*---------------------------------------------------------------------------*/
#ifndef Board_MPU9250_ADDR
# error "Board file doesn't define I2C address Board_MPU9250_ADDR"
# error "Board file doesn't define I2C address Board_MPU9250_ADDR"
#endif
#ifndef Board_MPU9250_MAG_ADDR
# error "Board file doesn't define I2C address Board_MPU9250_MAG_ADDR"
# error "Board file doesn't define I2C address Board_MPU9250_MAG_ADDR"
#endif
/* Sensor I2C address */
#define MPU_9250_I2C_ADDRESS Board_MPU9250_ADDR
#define MPU_9250_MAG_I2C_ADDRESS Board_MPU9250_MAG_ADDR
/*-------------a--------------------------------------------------------------*/
/* Registers */
/* Self Test Registers */
#define REG_SELF_TEST_X_GYRO 0x00 /* R/W */
#define REG_SELF_TEST_Y_GYRO 0x01 /* R/W */
#define REG_SELF_TEST_Z_GYRO 0x02 /* R/W */
@ -77,6 +82,7 @@
#define REG_SELF_TEST_Z_ACCEL 0x0E /* R/W */
#define REG_SELF_TEST_Y_ACCEL 0x0F /* R/W */
/*---------------------------------------------------------------------------*/
/* Axis Registers */
#define REG_XG_OFFSET_H 0x13 /* R/W */
#define REG_XG_OFFSET_L 0x14 /* R/W */
#define REG_YG_OFFSET_H 0x15 /* R/W */
@ -84,6 +90,7 @@
#define REG_ZG_OFFSET_H 0x17 /* R/W */
#define REG_ZG_OFFSET_L 0x18 /* R/W */
/*---------------------------------------------------------------------------*/
/* Control Registers */
#define REG_SMPLRT_DIV 0x19 /* R/W */
#define REG_CONFIG 0x1A /* R/W */
#define REG_GYRO_CONFIG 0x1B /* R/W */
@ -180,9 +187,9 @@ static PIN_Config mpu_9250_pin_table[] = {
PIN_TERMINATE
};
static PIN_State pinState;
static PIN_Handle pinHandle;
static I2C_Handle i2cHandle;
static PIN_State pin_state;
static PIN_Handle pin_handle;
static I2C_Handle i2c_handle;
/*---------------------------------------------------------------------------*/
typedef struct {
@ -219,30 +226,64 @@ static struct ctimer startup_timer;
/* ui32Count = [delay in us] * [CPU clock in MHz] / [cycles per loop] */
#define delay_ms(ms) CPUdelay((ms) * 1000 * 48 / 7)
/*---------------------------------------------------------------------------*/
/**
* \brief Setup and peform an I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static bool
i2c_transaction(void *writeBuf, size_t writeCount, void *readBuf, size_t readCount)
i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount)
{
I2C_Transaction i2cTransaction = {
.writeBuf = writeBuf,
.writeCount = writeCount,
.readBuf = readBuf,
.readCount = readCount,
I2C_Transaction i2c_transaction = {
.writeBuf = wbuf,
.writeCount = wcount,
.readBuf = rbuf,
.readCount = rcount,
.slaveAddress = MPU_9250_I2C_ADDRESS,
};
return I2C_transfer(i2cHandle, &i2cTransaction);
return I2C_transfer(i2c_handle, &i2c_transaction);
}
#define i2c_write(writeBuf, writeCount) i2c_transaction(writeBuf, writeCount, NULL, 0)
#define i2c_read(readBuf, readCount) i2c_transaction(NULL, 0, readBuf, readCount)
#define i2c_write_read(writeBuf, writeCount, readBuf, readCount) \
i2c_transaction(writeBuf, writeCount, readBuf, readCount)
/**
* \brief Peform a write only I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_write(void *wbuf, size_t wcount)
{
return i2c_write_read(wbuf, wcount, NULL, 0);
}
/**
* \brief Peform a read only I2C transaction.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_read(void *rbuf, size_t rcount)
{
return i2c_write_read(NULL, 0, rbuf, rcount);
}
/*---------------------------------------------------------------------------*/
/**
* \brief Initialize the MPU-9250 sensor driver.
* \return true if I2C operation successful; else, return false.
*/
static bool
sensor_init(void)
{
pinHandle = PIN_open(&pinState, mpu_9250_pin_table);
if (pinHandle == NULL) {
pin_handle = PIN_open(&pin_state, mpu_9250_pin_table);
if (pin_handle == NULL) {
return false;
}
@ -251,9 +292,9 @@ sensor_init(void)
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_400kHz;
i2cHandle = I2C_open(Board_I2C0, &i2cParams);
if (i2cHandle == NULL) {
PIN_close(&pinState);
i2c_handle = I2C_open(Board_I2C0, &i2cParams);
if (i2c_handle == NULL) {
PIN_close(&pin_state);
return false;
}
@ -265,7 +306,7 @@ sensor_init(void)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Place the MPU in low power mode
* \brief Place the sensor in low-power mode.
*/
static void
sensor_sleep(void)
@ -281,7 +322,7 @@ sensor_sleep(void)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Exit low power mode
* \brief Wakeup the sensor from low-power mode.
*/
static void
sensor_wakeup(void)
@ -336,11 +377,11 @@ convert_to_le(uint8_t *data, uint8_t len)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Check whether a data or wake on motion interrupt has occurred
* \return Return the interrupt status
* \brief Check whether a data or wake on motion interrupt has occurred.
* \return Return the interrupt status.
*
* This driver does not use interrupts, however this function allows us to
* determine whether a new sensor reading is available
* This driver does not use interrupts, however this function allows
* us to determine whether a new sensor reading is available.
*/
static bool
sensor_data_ready(uint8_t* int_status)
@ -352,8 +393,8 @@ sensor_data_ready(uint8_t* int_status)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Read data from the accelerometer - X, Y, Z - 3 words
* \return True if a valid reading could be taken, false otherwise
* \brief Read data from the accelerometer, total of 3 words (X, Y, Z).
* \return true if a valid reading could be taken; otherwise, false.
*/
static bool
acc_read(uint8_t int_status, uint16_t *data)
@ -375,8 +416,8 @@ acc_read(uint8_t int_status, uint16_t *data)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Read data from the gyroscope - X, Y, Z - 3 words
* \return True if a valid reading could be taken, false otherwise
* \brief Read data from the accelerometer, total of 3 words (X, Y, Z).
* \return true if a valid reading could be taken; otherwise, false.
*/
static bool
gyro_read(uint8_t int_status, uint16_t *data)
@ -398,9 +439,9 @@ gyro_read(uint8_t int_status, uint16_t *data)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Convert accelerometer raw reading to a value in G
* \param raw_data The raw accelerometer reading
* \return The converted value
* \brief Convert accelerometer raw reading to a value in G.
* \param raw_data The raw accelerometer reading.
* \return The converted value.
*/
static int32_t
acc_convert(int32_t raw_data)
@ -415,9 +456,9 @@ acc_convert(int32_t raw_data)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Convert gyro raw reading to a value in deg/sec
* \param raw_data The raw accelerometer reading
* \return The converted value
* \brief Convert gyro raw reading to a value in deg/sec.
* \param raw_data The raw accelerometer reading.
* \return The converted value.
*/
static int32_t
gyro_convert(int32_t raw_data)
@ -460,9 +501,10 @@ initialise_cb(void *unused)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns a reading from the sensor
* \param type MPU_9250_SENSOR_TYPE_ACC_[XYZ] or MPU_9250_SENSOR_TYPE_GYRO_[XYZ]
* \return centi-G (ACC) or centi-Deg/Sec (Gyro)
* \brief Returns a reading from the sensor.
* \param type MPU_9250_SENSOR_TYPE_ACC_[XYZ] or
* MPU_9250_SENSOR_TYPE_GYRO_[XYZ].
* \return Centi-G (ACC) or centi-Deg/Sec (Gyro).
*/
static int
value(int type)
@ -531,14 +573,12 @@ value(int type)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Configuration function for the MPU9250 sensor.
*
* \param type Activate, enable or disable the sensor. See below
* \param enable
*
* When type == SENSORS_HW_INIT we turn on the hardware
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor
* \brief Configuration function for the MPU9250 sensor.
* \param type Activate, enable or disable the sensor. See below.
* \param enable Enable or disable sensor.
* When type == SENSORS_HW_INIT we turn on the hardware.
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor.
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor.
*/
static int
configure(int type, int enable)
@ -562,7 +602,7 @@ configure(int type, int enable)
mpu_9250.type = enable_type;
mpu_9250.status = MPU_9250_SENSOR_STATUS_BOOTING;
PIN_setOutputValue(pinHandle, Board_MPU_POWER, 1);
PIN_setOutputValue(pin_handle, Board_MPU_POWER, 1);
ctimer_set(&startup_timer, SENSOR_BOOT_DELAY, initialise_cb, NULL);
} else {
@ -573,8 +613,8 @@ configure(int type, int enable)
if (PIN_getOutputValue(Board_MPU_POWER)) {
sensor_sleep();
I2C_cancel(i2cHandle);
PIN_setOutputValue(pinHandle, Board_MPU_POWER, 0);
I2C_cancel(i2c_handle);
PIN_setOutputValue(pin_handle, Board_MPU_POWER, 0);
}
mpu_9250.type = MPU_9250_SENSOR_TYPE_NONE;
@ -589,9 +629,9 @@ configure(int type, int enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the status of the sensor
* \param type SENSORS_ACTIVE or SENSORS_READY
* \return 1 if the sensor is enabled
* \brief Returns the status of the sensor
* \param type SENSORS_ACTIVE or SENSORS_READY
* \return 1 if the sensor is enabled, else 0.
*/
static int
status(int type)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,71 +27,80 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-mpu SensorTag 2.0 Motion Processing Unit
* \defgroup sensortag-mpu SensorTag Motion Processing Unit
*
* Driver for the Invensense MPU9250 Motion Processing Unit.
* Driver for the Invensense MPU-9250 Motion Processing Unit.
*
* Due to the time required between triggering a reading and the reading
* becoming available, this driver is meant to be used in an asynchronous
* fashion. The caller must first activate the sensor by calling
* mpu_9250_sensor.configure(SENSORS_ACTIVE, xyz);
* The value for the xyz arguments depends on the required readings. If the
* caller intends to read both the accelerometer as well as the gyro then
* xyz should be MPU_9250_SENSOR_TYPE_ALL. If the caller only needs to take a
* reading from one of the two elements, xyz should be one of
* MPU_9250_SENSOR_TYPE_ACC or MPU_9250_SENSOR_TYPE_GYRO
* Due to the time required between triggering a reading and the
* reading becoming available, this driver is meant to be used in an
* asynchronous fashion. The caller must first activate the sensor by
* calling
*
* Calling .configure() will power up the sensor and initialise it. When the
* sensor is ready to provide readings, the driver will generate a
* sensors_changed event.
* mpu_9250_sensor.configure(SENSORS_ACTIVE, xyz);
*
* Calls to .status() will return the driver's state which could indicate that
* the sensor is off, booting or on.
* The value for the xyz arguments depends on the required readings. If
* the caller intends to read both the accelerometer as well as the gyro
* then xyz should be MPU_9250_SENSOR_TYPE_ALL. If the caller only needs
* to take a reading from one of the two elements, xyz should be one of
* MPU_9250_SENSOR_TYPE_ACC or MPU_9250_SENSOR_TYPE_GYRO
*
* Once a reading has been taken, the caller has two options:
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take
* subsequent readings the sensor must be started up all over
* - Leave the sensor on. In this scenario, the caller can simply keep calling
* value() for subsequent readings, but having the sensor on will consume
* more energy, especially if both accelerometer and the gyro are on.
* Calling configure() will power up the sensor and initialise it. When
* the sensor is ready to provide readings, the driver will generate a
* sensors_changed event.
*
* Calls to status() will return the driver's state which could indicate
* that the sensor is off, booting or on.
*
* Once a reading has been taken, the caller has two options:
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to
* take subsequent readings the sensor must be started up all over
* - Leave the sensor on. In this scenario, the caller can simply keep
* calling value() for subsequent readings, but having the sensor on
* will consume more energy, especially if both accelerometer and the
* gyro are on.
* @{
*
* \file
* Header file for the Sensortag Invensense MPU9250 motion processing unit
* Header file for the Sensortag Invensense MPU-9250 motion processing unit
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef MPU_9250_SENSOR_H_
#define MPU_9250_SENSOR_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "contiki.h"
/*---------------------------------------------------------------------------*/
#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0)
# error "The MPU-9250 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)"
#endif
/*---------------------------------------------------------------------------*/
#define MPU_9250_READING_ERROR -1
/*---------------------------------------------------------------------------*/
/* ACC / Gyro Axes */
/* Accelerometer / Gyro Axes */
typedef enum {
MPU_9250_SENSOR_TYPE_NONE = (0), /* 0b000000 = 0x00 */
MPU_9250_SENSOR_TYPE_GYRO_X = (1 << 0), /* 0b000001 = 0x01 */
MPU_9250_SENSOR_TYPE_GYRO_Y = (1 << 1), /* 0b000010 = 0x02 */
MPU_9250_SENSOR_TYPE_GYRO_Z = (1 << 2), /* 0b000100 = 0x04 */
MPU_9250_SENSOR_TYPE_ACC_X = (1 << 3), /* 0b001000 = 0x08 */
MPU_9250_SENSOR_TYPE_ACC_Y = (1 << 4), /* 0b010000 = 0x10 */
MPU_9250_SENSOR_TYPE_ACC_Z = (1 << 5), /* 0b100000 = 0x20 */
MPU_9250_SENSOR_TYPE_NONE = (0), /**< 0b000000 = 0x00 */
MPU_9250_SENSOR_TYPE_GYRO_X = (1 << 0), /**< 0b000001 = 0x01 */
MPU_9250_SENSOR_TYPE_GYRO_Y = (1 << 1), /**< 0b000010 = 0x02 */
MPU_9250_SENSOR_TYPE_GYRO_Z = (1 << 2), /**< 0b000100 = 0x04 */
MPU_9250_SENSOR_TYPE_ACC_X = (1 << 3), /**< 0b001000 = 0x08 */
MPU_9250_SENSOR_TYPE_ACC_Y = (1 << 4), /**< 0b010000 = 0x10 */
MPU_9250_SENSOR_TYPE_ACC_Z = (1 << 5), /**< 0b100000 = 0x20 */
MPU_9250_SENSOR_TYPE_GYRO = MPU_9250_SENSOR_TYPE_GYRO_X
| MPU_9250_SENSOR_TYPE_GYRO_Y
| MPU_9250_SENSOR_TYPE_GYRO_Z,
/* 0b000111 = 0x07 */
/**< 0b000111 = 0x07 */
MPU_9250_SENSOR_TYPE_ACC = MPU_9250_SENSOR_TYPE_ACC_X
| MPU_9250_SENSOR_TYPE_ACC_Y
| MPU_9250_SENSOR_TYPE_ACC_Z,
/* 0b111000 = 0x38 */
/**< 0b111000 = 0x38 */
MPU_9250_SENSOR_TYPE_ALL = MPU_9250_SENSOR_TYPE_GYRO
| MPU_9250_SENSOR_TYPE_ACC
/* 0b111111 = 0x3F */
/**< 0b111111 = 0x3F */
} MPU_9250_SENSOR_TYPE;
/*---------------------------------------------------------------------------*/
/* Accelerometer range */
@ -112,9 +121,9 @@ typedef enum {
/*---------------------------------------------------------------------------*/
/* Accelerometer range configuration, type MPU_9250_SENSOR_ACC_RANGE */
#ifdef MPU_9250_SENSOR_CONF_ACC_RANGE_ARG
# define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_CONF_ACC_RANGE
# define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_CONF_ACC_RANGE
#else
# define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_ACC_RANGE_2G
# define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_ACC_RANGE_2G
#endif
/*---------------------------------------------------------------------------*/
extern const struct sensors_sensor mpu_9250_sensor;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,21 +27,24 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-opt-sensor
* \addtogroup sensortag-opt-sensor
* @{
*
* \file
* Driver for the Sensortag Opt3001 light sensor
* Driver for the Sensortag OPT-3001 light sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "lib/sensors.h"
#include "sys/ctimer.h"
#include "opt-3001-sensor.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/drivers/I2C.h>
/*---------------------------------------------------------------------------*/
#include <stdint.h>
@ -63,65 +66,65 @@
#define OPT_3001_I2C_ADDRESS Board_OPT3001_ADDR
/*---------------------------------------------------------------------------*/
/* Register addresses */
#define REG_RESULT 0x00
#define REG_CONFIGURATION 0x01
#define REG_LOW_LIMIT 0x02
#define REG_HIGH_LIMIT 0x03
#define REG_RESULT 0x00
#define REG_CONFIGURATION 0x01
#define REG_LOW_LIMIT 0x02
#define REG_HIGH_LIMIT 0x03
#define REG_MANUFACTURER_ID 0x7E
#define REG_DEVICE_ID 0x7F
#define REG_MANUFACTURER_ID 0x7E
#define REG_DEVICE_ID 0x7F
/*---------------------------------------------------------------------------*/
/*
* Configuration Register Bits and Masks.
* We use uint16_t to read from / write to registers, meaning that the
* register's MSB is the variable's LSB.
*/
#define CFG_RN 0x00F0 /* [15..12] Range Number */
#define CFG_CT 0x0008 /* [11] Conversion Time */
#define CFG_M 0x0006 /* [10..9] Mode of Conversion */
#define CFG_OVF 0x0001 /* [8] Overflow */
#define CFG_CRF 0x8000 /* [7] Conversion Ready Field */
#define CFG_FH 0x4000 /* [6] Flag High */
#define CFG_FL 0x2000 /* [5] Flag Low */
#define CFG_L 0x1000 /* [4] Latch */
#define CFG_POL 0x0800 /* [3] Polarity */
#define CFG_ME 0x0400 /* [2] Mask Exponent */
#define CFG_FC 0x0300 /* [1..0] Fault Count */
#define CFG_RN 0x00F0 /**< [15..12] Range Number */
#define CFG_CT 0x0008 /**< [11] Conversion Time */
#define CFG_M 0x0006 /**< [10..9] Mode of Conversion */
#define CFG_OVF 0x0001 /**< [8] Overflow */
#define CFG_CRF 0x8000 /**< [7] Conversion Ready Field */
#define CFG_FH 0x4000 /**< [6] Flag High */
#define CFG_FL 0x2000 /**< [5] Flag Low */
#define CFG_L 0x1000 /**< [4] Latch */
#define CFG_POL 0x0800 /**< [3] Polarity */
#define CFG_ME 0x0400 /**< [2] Mask Exponent */
#define CFG_FC 0x0300 /**< [1..0] Fault Count */
/*---------------------------------------------------------------------------*/
/* Possible Values for CT */
#define CFG_CT_100 0x0000
#define CFG_CT_800 CFG_CT
#define CFG_CT_100 0x0000
#define CFG_CT_800 CFG_CT
/*---------------------------------------------------------------------------*/
/* Possible Values for M */
#define CFG_M_CONTI 0x0004
#define CFG_M_SINGLE 0x0002
#define CFG_M_SHUTDOWN 0x0000
#define CFG_M_CONTI 0x0004
#define CFG_M_SINGLE 0x0002
#define CFG_M_SHUTDOWN 0x0000
/*---------------------------------------------------------------------------*/
/* Reset Value for the register 0xC810. All zeros except: */
#define CFG_RN_RESET 0x00C0
#define CFG_CT_RESET CFG_CT_800
#define CFG_L_RESET 0x1000
#define CFG_DEFAULTS (CFG_RN_RESET | CFG_CT_100 | CFG_L_RESET)
#define CFG_RN_RESET 0x00C0
#define CFG_CT_RESET CFG_CT_800
#define CFG_L_RESET 0x1000
#define CFG_DEFAULTS (CFG_RN_RESET | CFG_CT_100 | CFG_L_RESET)
/*---------------------------------------------------------------------------*/
/* Enable / Disable */
#define CFG_ENABLE_CONTINUOUS (CFG_M_CONTI | CFG_DEFAULTS)
#define CFG_ENABLE_SINGLE_SHOT (CFG_M_SINGLE | CFG_DEFAULTS)
#define CFG_DISABLE CFG_DEFAULTS
#define CFG_ENABLE_CONTINUOUS (CFG_M_CONTI | CFG_DEFAULTS)
#define CFG_ENABLE_SINGLE_SHOT (CFG_M_SINGLE | CFG_DEFAULTS)
#define CFG_DISABLE CFG_DEFAULTS
/*---------------------------------------------------------------------------*/
/* Register length */
#define REGISTER_LENGTH 2
#define REGISTER_LENGTH 2
/*---------------------------------------------------------------------------*/
/* Sensor data size */
#define DATA_LENGTH 2
#define DATA_LENGTH 2
/*---------------------------------------------------------------------------*/
/* Byte swap of 16-bit register value */
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) ((a) & 0xFF)
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) (((a) >> 0) & 0xFF)
#define SWAP16(v) ((LO_UINT16(v) << 8) | HI_UINT16(v))
#define SWAP16(v) ((LO_UINT16(v) << 8) | (HI_UINT16(v) << 0))
#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v))
#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v))
#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v))
#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v))
/*---------------------------------------------------------------------------*/
typedef struct {
volatile OPT_3001_STATUS status;
@ -134,39 +137,76 @@ static OPT_3001_Object opt_3001;
static struct ctimer startup_timer;
/*---------------------------------------------------------------------------*/
static I2C_Handle i2cHandle;
static I2C_Handle i2c_handle;
/*---------------------------------------------------------------------------*/
/**
* \brief Setup and peform an I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static bool
i2c_write_read(void *writeBuf, size_t writeCount, void *readBuf, size_t readCount)
i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount)
{
I2C_Transaction i2cTransaction = {
.writeBuf = writeBuf,
.writeCount = writeCount,
.readBuf = readBuf,
.readCount = readCount,
I2C_Transaction i2c_transaction = {
.writeBuf = wbuf,
.writeCount = wcount,
.readBuf = rbuf,
.readCount = rcount,
.slaveAddress = OPT_3001_I2C_ADDRESS,
};
return I2C_transfer(i2cHandle, &i2cTransaction);
return I2C_transfer(i2c_handle, &i2c_transaction);
}
#define i2c_write(writeBuf, writeCount) i2c_write_read(writeBuf, writeCount, NULL, 0)
#define i2c_read(readBuf, readCount) i2c_write_read(NULL, 0, readBuf, readCount)
/**
* \brief Peform a write only I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_write(void *wbuf, size_t wcount)
{
return i2c_write_read(wbuf, wcount, NULL, 0);
}
/**
* \brief Peform a read only I2C transaction.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_read(void *rbuf, size_t rcount)
{
return i2c_write_read(NULL, 0, rbuf, rcount);
}
/*---------------------------------------------------------------------------*/
/**
* \brief Initialize the OPT-3001 sensor driver.
* \return true if I2C operation successful; else, return false.
*/
static bool
sensor_init(void)
{
if (i2cHandle) {
if (i2c_handle) {
return true;
}
I2C_Params i2cParams;
I2C_Params_init(&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_400kHz;
I2C_Params i2c_params;
I2C_Params_init(&i2c_params);
i2cHandle = I2C_open(Board_I2C0, &i2cParams);
if (i2cHandle == NULL) {
i2c_params.transferMode = I2C_MODE_BLOCKING;
i2c_params.bitRate = I2C_400kHz;
i2c_handle = I2C_open(Board_I2C0, &i2c_params);
if (i2c_handle == NULL) {
return false;
}
@ -176,8 +216,8 @@ sensor_init(void)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Turn the sensor on/off
* \param enable TRUE: on, FALSE: off
* \brief Turn the sensor on/off
* \param enable Enable sensor if true; else, disable sensor.
*/
static bool
sensor_enable(bool enable)
@ -190,9 +230,15 @@ sensor_enable(bool enable)
return i2c_write(cfg_data, sizeof(cfg_data));
}
/*---------------------------------------------------------------------------*/
/**
* \brief Callback when sensor is ready to read data from.
*/
static void
notify_ready_cb(void *not_used)
notify_ready_cb(void *unused)
{
/* Unused args */
(void)unused;
/*
* Depending on the CONFIGURATION.CONVERSION_TIME bits, a conversion will
* take either 100 or 800 ms. Here we inspect the CONVERSION_READY bit and
@ -217,15 +263,18 @@ notify_ready_cb(void *not_used)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns a reading from the sensor
* \param type Ignored
* \return Illuminance in centilux
* \brief Returns a reading from the sensor.
* \param type Ignored.
* \return Illuminance in centilux.
*/
static int
value(int type)
{
/* Unused args */
(void)type;
if (opt_3001.status != OPT_3001_STATUS_DATA_READY) {
return MPU_9250_READING_ERROR;
return OPT_3001_READING_ERROR;
}
uint8_t cfg_data[] = { REG_CONFIGURATION };
@ -234,7 +283,7 @@ value(int type)
bool spi_ok = i2c_write_read(cfg_data, sizeof(cfg_data), &cfg_value, sizeof(cfg_value));
if (!spi_ok) {
opt_3001.status = OPT_3001_STATUS_I2C_ERROR;
return MPU_9250_READING_ERROR;
return OPT_3001_READING_ERROR;
}
uint8_t result_data[] = { REG_RESULT };
@ -243,7 +292,7 @@ value(int type)
spi_ok = i2c_write_read(result_data, sizeof(result_data), &result_value, sizeof(result_value));
if (!spi_ok) {
opt_3001.status = OPT_3001_STATUS_I2C_ERROR;
return MPU_9250_READING_ERROR;
return OPT_3001_READING_ERROR;
}
result_value = SWAP16(result_value);
@ -259,14 +308,13 @@ value(int type)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Configuration function for the OPT3001 sensor.
* \brief Configuration function for the OPT3001 sensor.
* \param type Activate, enable or disable the sensor. See below.
* \param enable Enable or disable sensor.
*
* \param type Activate, enable or disable the sensor. See below
* \param enable
*
* When type == SENSORS_HW_INIT we turn on the hardware
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor
* When type == SENSORS_HW_INIT we turn on the hardware.
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor.
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor.
*/
static int
configure(int type, int enable)
@ -278,7 +326,7 @@ configure(int type, int enable)
opt_3001.status = OPT_3001_STATUS_STANDBY;
} else {
opt_3001.status = OPT_3001_STATUS_DISABLED;
rv = MPU_9250_READING_ERROR;
rv = OPT_3001_READING_ERROR;
}
break;
@ -302,13 +350,14 @@ configure(int type, int enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the status of the sensor
* \param type ignored
* \return The state of the sensor SENSOR_STATE_xyz
* \brief Returns the status of the sensor.
* \param type Ignored.
* \return The state of the sensor SENSOR_STATE_xyz.
*/
static int
status(int type)
{
/* Unused args */
(void)type;
return opt_3001.status;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,39 +27,47 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-opt-sensor SensorTag 2.0 Light Sensor
* \defgroup sensortag-opt-sensor SensorTag Optical Sensor
*
* Due to the time required for the sensor to startup, this driver is meant to
* be used in an asynchronous fashion. The caller must first activate the
* sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup
* sequence, but the call will not wait for it to complete so that the CPU can
* perform other tasks or drop to a low power mode.
* Due to the time required for the sensor to startup, this driver is
* meant to be used in an asynchronous fashion. The caller must first
* activate the sensor by calling SENSORS_ACTIVATE(). This will trigger
* the sensor's startup sequence, but the call will not wait for it to
* complete so that the CPU can perform other tasks or drop to a low
* power mode.
*
* Once the reading and conversion are complete, the driver will generate a
* sensors_changed event.
* Once the reading and conversion are complete, the driver will
* generate a sensors_changed event.
*
* We use single-shot readings. In this mode, the hardware automatically goes
* back to its shutdown mode after the conversion is finished. However, it will
* still respond to I2C operations, so the last conversion can still be read
* out.
* We use single-shot readings. In this mode, the hardware
* automatically goes back to its shutdown mode after the conversion
* is finished. However, it will still respond to I2C operations, so
* the last conversion can still be read out.
*
* In order to take a new reading, the caller has to use SENSORS_ACTIVATE
* again.
* In order to take a new reading, the caller has to use
* SENSORS_ACTIVATE again.
* @{
*
* \file
* Header file for the Sensortag Opt3001 light sensor
* Header file for the Sensortag OPT-3001 light sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef OPT_3001_SENSOR_H_
#define OPT_3001_SENSOR_H_
/*---------------------------------------------------------------------------*/
#define MPU_9250_READING_ERROR -1
#include "contiki.h"
/*---------------------------------------------------------------------------*/
#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0)
# error "The OPT-3001 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)"
#endif
/*---------------------------------------------------------------------------*/
#define OPT_3001_READING_ERROR -1
/*---------------------------------------------------------------------------*/
typedef enum {
OPT_3001_STATUS_DISABLED,

View File

@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \file
* Generic module controlling Simplelink sensors
* Generic module controlling sensors on SensorTag.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -42,7 +43,6 @@
#include "board-peripherals.h"
/*---------------------------------------------------------------------------*/
/* Exports a global symbol to be used by the sensor API */
SENSORS(&bmp_280_sensor, &tmp_007_sensor, &opt_3001_sensor, &hdc_1000_sensor,
&mpu_9250_sensor);
SENSORS(&bmp_280_sensor, &tmp_007_sensor, &opt_3001_sensor, &hdc_1000_sensor, &mpu_9250_sensor);
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,21 +27,24 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-tmp-sensor
* \addtogroup sensortag-tmp-sensor
* @{
*
* \file
* Driver for the Sensortag TI TMP007 infrared thermophile sensor
* Driver for the Sensortag TI TMP-007 IR Thermophile sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "lib/sensors.h"
#include "sys/ctimer.h"
#include "tmp-007-sensor.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/drivers/I2C.h>
#include <ti/drivers/PIN.h>
/*---------------------------------------------------------------------------*/
@ -58,47 +61,47 @@
/*---------------------------------------------------------------------------*/
/* Slave address */
#ifndef Board_TMP_ADDR
# error "Board file doesn't define I2C address Board_TMP_ADDR"
# error "Board file doesn't define I2C address Board_TMP_ADDR"
#endif
#define TMP_007_I2C_ADDRESS Board_TMP_ADDR
#define TMP_007_I2C_ADDRESS Board_TMP_ADDR
/* MPU Interrupt pin */
/* Sensor Interrupt pin */
#ifndef Board_TMP_RDY
# error "Board file doesn't define interrupt pin Board_TMP_RDY"
# error "Board file doesn't define interrupt pin Board_TMP_RDY"
#endif
#define TMP_007_TMP_RDY Board_TMP_RDY
#define TMP_007_TMP_RDY Board_TMP_RDY
/*---------------------------------------------------------------------------*/
/* TMP007 register addresses */
#define REG_VOLTAGE 0x00
#define REG_LOCAL_TEMP 0x01
#define REG_CONFIG 0x02
#define REG_OBJ_TEMP 0x03
#define REG_STATUS 0x04
#define REG_PROD_ID 0x1F
/* TMP-007 register addresses */
#define REG_VOLTAGE 0x00
#define REG_LOCAL_TEMP 0x01
#define REG_CONFIG 0x02
#define REG_OBJ_TEMP 0x03
#define REG_STATUS 0x04
#define REG_PROD_ID 0x1F
/*---------------------------------------------------------------------------*/
/* TMP007 register values */
#define VAL_CONFIG_ON 0x1000 /* Sensor on state */
#define VAL_CONFIG_OFF 0x0000 /* Sensor off state */
#define VAL_CONFIG_RESET 0x8000
#define VAL_PROD_ID 0x0078 /* Product ID */
/* TMP-007 register values */
#define VAL_CONFIG_ON 0x1000 /**< Sensor on state */
#define VAL_CONFIG_OFF 0x0000 /**< Sensor off state */
#define VAL_CONFIG_RESET 0x8000
#define VAL_PROD_ID 0x0078 /**< Product ID */
/*---------------------------------------------------------------------------*/
/* Conversion ready (status register) bit values */
#define CONV_RDY_BIT 0x4000
#define CONV_RDY_BIT 0x4000
/*---------------------------------------------------------------------------*/
/* Register length */
#define REGISTER_LENGTH 2
#define REGISTER_LENGTH 2
/*---------------------------------------------------------------------------*/
/* Sensor data size */
#define DATA_SIZE 4
#define DATA_SIZE 4
/*---------------------------------------------------------------------------*/
/* Byte swap of 16-bit register value */
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) ((a) & 0xFF)
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) (((a) >> 0) & 0xFF)
#define SWAP16(v) ((LO_UINT16(v) << 8) | HI_UINT16(v))
#define SWAP16(v) ((LO_UINT16(v) << 8) | (HI_UINT16(v) << 0))
#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v))
#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v))
#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v))
#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v))
/*---------------------------------------------------------------------------*/
static const PIN_Config pin_table[] = {
TMP_007_TMP_RDY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS | PIN_IRQ_NEGEDGE,
@ -120,27 +123,63 @@ typedef struct {
static TMP_007_Object tmp_007;
/*---------------------------------------------------------------------------*/
/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - 275ms */
#define SENSOR_STARTUP_DELAY 36
#define SENSOR_STARTUP_DELAY 36
static struct ctimer startup_timer;
/*---------------------------------------------------------------------------*/
/**
* \brief Setup and peform an I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static bool
i2c_write_read(void *writeBuf, size_t writeCount, void *readBuf, size_t readCount)
i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount)
{
I2C_Transaction i2c_transaction = {
.writeBuf = writeBuf,
.writeCount = writeCount,
.readBuf = readBuf,
.readCount = readCount,
.writeBuf = wbuf,
.writeCount = wcount,
.readBuf = rbuf,
.readCount = rcount,
.slaveAddress = TMP_007_I2C_ADDRESS,
};
return I2C_transfer(i2c_handle, &i2c_transaction);
}
#define i2c_write(writeBuf, writeCount) i2c_write_read(writeBuf, writeCount, NULL, 0)
#define i2c_read(readBuf, readCount) i2c_write_read(NULL, 0, readBuf, readCount)
/**
* \brief Peform a write only I2C transaction.
* \param wbuf Output buffer during the I2C transation.
* \param wcount How many bytes in the wbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_write(void *wbuf, size_t wcount)
{
return i2c_write_read(wbuf, wcount, NULL, 0);
}
/**
* \brief Peform a read only I2C transaction.
* \param rbuf Input buffer during the I2C transation.
* \param rcount How many bytes to read into rbuf.
* \return true if the I2C operation was successful;
* else, return false.
*/
static inline bool
i2c_read(void *rbuf, size_t rcount)
{
return i2c_write_read(NULL, 0, rbuf, rcount);
}
/*---------------------------------------------------------------------------*/
/**
* \brief Initialize the TMP-007 sensor driver.
* \return true if I2C operation successful; else, return false.
*/
static bool
sensor_init(void)
{
@ -155,6 +194,7 @@ sensor_init(void)
I2C_Params i2c_params;
I2C_Params_init(&i2c_params);
i2c_params.transferMode = I2C_MODE_BLOCKING;
i2c_params.bitRate = I2C_400kHz;
@ -169,6 +209,9 @@ sensor_init(void)
return true;
}
/*---------------------------------------------------------------------------*/
/**
* \brief Callback when sensor is ready to read data from.
*/
static void
notify_ready_cb(void *not_used)
{
@ -177,7 +220,7 @@ notify_ready_cb(void *not_used)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Turn the sensor on/off
* \brief Turn the sensor on or off.
*/
static bool
enable_sensor(bool enable)
@ -192,10 +235,12 @@ enable_sensor(bool enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Read the sensor value registers
* \param raw_temp Temperature in 16 bit format
* \param raw_obj_temp object temperature in 16 bit format
* \return TRUE if valid data could be retrieved
* \brief Read the sensor value registers.
* \param raw_temp Output variable holding the Temperature in
* 16-bit format.
* \param raw_obj_temp Output variable holding the Object temperature in
* 16-bit format.
* \return true if valid data could be retrieved; else, false.
*/
static bool
read_data(uint16_t *local_tmp, uint16_t *obj_tmp)
@ -241,11 +286,11 @@ read_data(uint16_t *local_tmp, uint16_t *obj_tmp)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Convert raw data to values in degrees C
* \param raw_temp raw ambient temperature from sensor
* \param raw_obj_temp raw object temperature from sensor
* \param obj converted object temperature
* \param amb converted ambient temperature
* \brief Convert raw data to values in degrees Celsius.
* \param raw_temp Output variable holding the raw ambient temperature
* from sensor.
* \param raw_obj_temp Output variable holding the raw object temperature
* from sensor.
*/
static void
convert(uint16_t* local_tmp, uint16_t* obj_tmp)
@ -261,9 +306,9 @@ convert(uint16_t* local_tmp, uint16_t* obj_tmp)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns a reading from the sensor
* \param type TMP_007_SENSOR_TYPE_OBJECT or TMP_007_SENSOR_TYPE_AMBIENT
* \return Object or Ambient temperature in milli degrees C
* \brief Returns a reading from the sensor.
* \param type TMP_007_SENSOR_TYPE_OBJECT or TMP_007_SENSOR_TYPE_AMBIENT.
* \return Object or Ambient temperature in milli degrees Celsius.
*/
static int
value(int type)
@ -304,14 +349,13 @@ value(int type)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Configuration function for the TMP007 sensor.
* \brief Configuration function for the TMP-007 sensor.
* \param type Activate, enable or disable the sensor. See below.
* \param enable Enable or disable sensor.
*
* \param type Activate, enable or disable the sensor. See below
* \param enable
*
* When type == SENSORS_HW_INIT we turn on the hardware
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor
* When type == SENSORS_HW_INIT we turn on the hardware.
* When type == SENSORS_ACTIVE and enable==1 we enable the sensor.
* When type == SENSORS_ACTIVE and enable==0 we disable the sensor.
*/
static int
configure(int type, int enable)
@ -351,9 +395,9 @@ configure(int type, int enable)
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the status of the sensor
* \param type SENSORS_ACTIVE or SENSORS_READY
* \return 1 if the sensor is enabled
* \brief Returns the status of the sensor.
* \param type Ignored.
* \return Status of the sensor.
*/
static int
status(int type)
@ -363,6 +407,6 @@ status(int type)
return tmp_007.status;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(tmp_007_sensor, "TMP007", value, configure, status);
SENSORS_SENSOR(tmp_007_sensor, "TMP-007", value, configure, status);
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,41 +27,51 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup sensortag-cc26xx-peripherals
* \addtogroup sensortag-peripherals
* @{
*
* \defgroup sensortag-cc26xx-tmp-sensor SensorTag 2.0 IR thermophile sensor
* \defgroup sensortag-tmp-sensor SensorTag IR Thermophile sensor
*
* Due to the time required for the sensor to startup, this driver is meant to
* be used in an asynchronous fashion. The caller must first activate the
* sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup
* sequence, but the call will not wait for it to complete so that the CPU can
* perform other tasks or drop to a low power mode.
* Due to the time required for the sensor to startup, this driver is
* meant to be used in an asynchronous fashion. The caller must first
* activate the sensor by calling SENSORS_ACTIVATE(). This will trigger
* the sensor's startup sequence, but the call will not wait for it to
* complete so that the CPU can perform other tasks or drop to a low
* power mode.
*
* Once the sensor is stable, the driver will generate a sensors_changed event.
* Once the sensor is stable, the driver will generate a
* sensors_changed event.
*
* The caller should then use value(TMP_007_SENSOR_TYPE_ALL) to read sensor
* values and latch them. Once completed successfully, individual readings can
* be retrieved with calls to value(TMP_007_SENSOR_TYPE_OBJECT) or
* value(TMP_007_SENSOR_TYPE_AMBIENT).
* The caller should then use value(TMP_007_SENSOR_TYPE_ALL) to
* read sensor values and latch them. Once completed successfully,
* individual readings can be retrieved with calls to
* value(TMP_007_SENSOR_TYPE_OBJECT) or
* value(TMP_007_SENSOR_TYPE_AMBIENT).
*
* Once required readings have been taken, the caller has two options:
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take
* subsequent readings SENSORS_ACTIVATE must be called again
* - Leave the sensor on. In this scenario, the caller can simply keep calling
* value(TMP_007_SENSOR_TYPE_ALL) to read and latch new values. However
* keeping the sensor on will consume more energy
* Once required readings have been taken, the caller has two options:
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order
* to take subsequent readings SENSORS_ACTIVATE must be called again.
* - Leave the sensor on. In this scenario, the caller can simply keep
* calling value(TMP_007_SENSOR_TYPE_ALL) to read and latch new
* values. However keeping the sensor on will consume more energy.
* @{
*
* \file
* Header file for the Sensortag TI TMP007 infrared thermophile sensor
* Header file for the Sensortag TMP-007 IR Thermophile sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef TMP_007_SENSOR_H_
#define TMP_007_SENSOR_H_
/*---------------------------------------------------------------------------*/
#include "contiki.h"
/*---------------------------------------------------------------------------*/
#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0)
# error "The BMP280 requires the I2C driver to be enabled (TI_I2C_CONF_ENABLE = 1)"
#endif
/*---------------------------------------------------------------------------*/
typedef enum {
TMP_007_TYPE_OBJECT = (1 << 0),
TMP_007_TYPE_AMBIENT = (1 << 1),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup srf06-common-peripherals
* \addtogroup srf06-peripherals
* @{
*
* \file
* Driver for the SmartRF06EB ALS when a CC13xx/CC26xxEM is mounted on it
* Driver for the SmartRF06 EB ALS sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -42,11 +43,11 @@
#include "sys/timer.h"
#include "als-sensor.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
#include <ti/drivers/ADC.h>
/*---------------------------------------------------------------------------*/
#include <stdint.h>
/*---------------------------------------------------------------------------*/
static ADC_Handle adc_handle;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup srf06-common-peripherals
* \addtogroup srf06-peripherals
* @{
*
* \file
* Header file for the SmartRF06EB + CC13xx/CC26xxEM ALS Driver
* Header file for the SmartRF06 EB ALS sensor.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef ALS_SENSOR_H_

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,27 +27,23 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
*
* Defines related to LaunchPad peripherals.
*
/**
* \addtogroup srf06-peripherals
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* Header file with definitions related to SmartRF06 EB boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
* \note
* This file should not be included directly
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
/*---------------------------------------------------------------------------*/
/**
* \name LED configurations
* \name LED configurations for the dev/leds.h API.
*
* Those values are not meant to be modified by the user
* @{
@ -60,12 +56,29 @@
#define LEDS_CONF_ORANGE 3
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Button configurations for the dev/button-hal.h API.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BUTTON_HAL_ID_KEY_LEFT 0
#define BUTTON_HAL_ID_KEY_RIGHT 1
#define BUTTON_HAL_ID_KEY_UP 2
#define BUTTON_HAL_ID_KEY_DOWN 3
#define BUTTON_HAL_ID_KEY_SELECT 4
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name SmartRF06 EB does have sensors.
*
* Those values are not meant to be modified by the user
* @{
*/
#define BOARD_CONF_HAS_SENSORS 1
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* BOARD_CONF_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,20 +27,22 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/** \addtogroup cc26xx-srf-tag
/**
* \addtogroup cc13xx-cc26xx-platform
* @{
*
* \defgroup launchpad-peripherals LaunchPad peripherals
* \defgroup srf06-peripherals SmartRF06 Evaluation Board peripherals
*
* Defines related to LaunchPad peripherals.
* Defines related to configuring SmartRF06 EB's peripherals. All
* SmartRF06 EBs are identical to a very large extent. Everything
* documented within this group applies to all SmartRF06 EBs.
*
* @{
*
* \file
* Header file with definitions related to LaunchPad peripherals
*
* \note Do not include this file directly.
* Header file with definitions related to SmartRF06 EB boards.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#ifndef BOARD_PERIPHERALS_H_
@ -50,8 +52,6 @@
/*---------------------------------------------------------------------------*/
#include "board-conf.h"
/*---------------------------------------------------------------------------*/
#define BOARD_CONF_HAS_SENSORS 1
/*---------------------------------------------------------------------------*/
#endif /* BOARD_PERIPHERALS_H_ */
/*---------------------------------------------------------------------------*/
/**

View File

@ -27,64 +27,71 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup launchpad-button-sensor
* \addtogroup srf06-peripherals
* @{
*
* \file
* Driver for LaunchPad buttons
* Button HAL definitions for the SmartRF06 Evaluation Board's buttons.
* Common across all CC13xx/CC26xx devices on SmartRF06 EB.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "dev/button-hal.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
/* Key select button */
BUTTON_HAL_BUTTON(key_select, /**< Name */
"Key Select", /**< Description */
Board_KEY_SELECT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_SELECT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_select, /**< Name */
"Key Select", /**< Description */
Board_KEY_SELECT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_SELECT, /**< Unique ID */
true); /**< Negative logic */
/* Key up button */
BUTTON_HAL_BUTTON(key_up, /**< Name */
"Key Up", /**< Description */
Board_KEY_UP, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_UP, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_up, /**< Name */
"Key Up", /**< Description */
Board_KEY_UP, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_UP, /**< Unique ID */
true); /**< Negative logic */
/* Key down button */
BUTTON_HAL_BUTTON(key_down, /**< Name */
"Key Down", /**< Description */
Board_KEY_DOWN, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_DOWN, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_down, /**< Name */
"Key Down", /**< Description */
Board_KEY_DOWN, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_DOWN, /**< Unique ID */
true); /**< Negative logic */
/* Key left button */
BUTTON_HAL_BUTTON(key_left, /**< Name */
"Key Left", /**< Description */
Board_KEY_LEFT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_left, /**< Name */
"Key Left", /**< Description */
Board_KEY_LEFT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */
true); /**< Negative logic */
/* Key right button */
BUTTON_HAL_BUTTON(key_right, /**< Name */
"Key Right", /**< Description */
Board_KEY_RIGHT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
BUTTON_HAL_BUTTON(
key_right, /**< Name */
"Key Right", /**< Description */
Board_KEY_RIGHT, /**< PIN */
GPIO_HAL_PIN_CFG_INPUT_PULLUP |
GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS, /**< Pull configuration */
BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */
true); /**< Negative logic */
/*---------------------------------------------------------------------------*/
BUTTON_HAL_BUTTONS(&key_select, &key_up, &key_down, &key_left, &key_right);
/*---------------------------------------------------------------------------*/

View File

@ -175,19 +175,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC1350DK_7XD_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC1350DK_7XD_UART0,
@ -197,6 +199,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC1350DK_7XD_SPI0,
.csPin = CC1350DK_7XD_GPIO_LCD_CS,
@ -207,27 +225,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -236,7 +245,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -252,7 +261,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -356,9 +365,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350DK_7XD_GPTIMERPARTSCOUNT]
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC1350DK_7XD_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -367,19 +379,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC1350DK_7XD_I2C0_SDA0,
.sclPin = CC1350DK_7XD_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC1350DK_7XD_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC1350DK_7XD_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC1350DK_7XD_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC1350DK_7XD_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -391,8 +408,9 @@ const uint_least8_t I2C_count = CC1350DK_7XD_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
* array at the desired flash address.
@ -441,11 +459,11 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC1350DK_7XD_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
@ -456,6 +474,8 @@ const NVS_Config NVS_config[CC1350DK_7XD_NVSCOUNT] = {
const uint_least8_t NVS_count = CC1350DK_7XD_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -557,6 +577,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC1350DK_7XD_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC1350DK_7XD_SDCOUNT] = {
@ -576,12 +602,16 @@ const SD_Config SD_config[CC1350DK_7XD_SDCOUNT] = {
const uint_least8_t SD_count = CC1350DK_7XD_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT];
/*
@ -590,6 +620,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -605,6 +636,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = {
.csnPin = CC1350DK_7XD_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -619,35 +652,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = {
.clkPin = CC1350DK_7XD_SPI1_CLK,
.csnPin = CC1350DK_7XD_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC1350DK_7XD_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC1350DK_7XD_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC1350DK_7XD_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC1350DK_7XD_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -663,19 +706,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC1350DK_7XD_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC1350DK_7XD_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC1350DK_7XD_UART0]
},
#endif
};
const uint_least8_t UART_count = CC1350DK_7XD_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc26x0/driverlib/ioc.h>
@ -275,7 +277,9 @@ typedef enum CC1350DK_7XD_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC1350DK_7XD_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC1350DK_7XD_I2C0 = 0,
#endif
CC1350DK_7XD_I2CCOUNT
} CC1350DK_7XD_I2CName;
@ -285,7 +289,7 @@ typedef enum CC1350DK_7XD_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC1350DK_7XD_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC1350DK_7XD_NVSCC26XX0 = 0,
#endif
@ -324,8 +328,12 @@ typedef enum CC1350DK_7XD_SDName {
* @brief Enum of SPI names
*/
typedef enum CC1350DK_7XD_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC1350DK_7XD_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC1350DK_7XD_SPI1,
#endif
CC1350DK_7XD_SPICOUNT
} CC1350DK_7XD_SPIName;
@ -335,7 +343,9 @@ typedef enum CC1350DK_7XD_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC1350DK_7XD_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC1350DK_7XD_UART0 = 0,
#endif
CC1350DK_7XD_UARTCOUNT
} CC1350DK_7XD_UARTName;

View File

@ -5,7 +5,7 @@ SUBFAMILY = cc13x0-cc26x0
DEVICE_FAMILY = CC13X0
DEVICE_LINE = CC13XX
BOARD_SOURCEFILES += CC1310DK_7XD.c CC1310DK_7XD_fxns.c
BOARD_SOURCEFILES += CC1350DK_7XD.c CC1350DK_7XD_fxns.c
SUPPORTS_PROP_MODE = 1
SUPPORTS_IEEE_MODE = 1

View File

@ -175,19 +175,21 @@ const CryptoCC26XX_Config CryptoCC26XX_config[CC2650DK_7ID_CRYPTOCOUNT] = {
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#if TI_DISPLAY_CONF_ENABLE
#if TI_DISPLAY_CONF_UART_ENABLE
#if !(TI_UART_CONF_UART0_ENABLE)
#error "Display UART driver requires UART0"
#endif
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
DisplayUart_Object displayUartObject;
DisplaySharp_Object displaySharpObject;
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CC2650DK_7ID_UART0,
@ -197,6 +199,22 @@ const DisplayUart_HWAttrs displayUartHWAttrs = {
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
};
#endif /* TI_DISPLAY_CONF_UART_ENABLE */
#if TI_DISPLAY_CONF_LCD_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "Display LCD driver requires SPI0"
#endif
#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE 96
#endif
static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
DisplaySharp_Object displaySharpObject;
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.spiIndex = CC2650DK_7ID_SPI0,
.csPin = CC2650DK_7ID_GPIO_LCD_CS,
@ -207,27 +225,18 @@ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
.displayBuf = sharpDisplayBuf,
};
#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif
#endif /* TI_DISPLAY_CONF_LCD_ENABLE */
/*
* This #if/#else is needed to workaround a problem with the
* IAR compiler. The IAR compiler doesn't like the empty array
* initialization. (IAR Error[Pe1345])
*/
#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
#if (BOARD_DISPLAY_USE_UART)
#if TI_DISPLAY_CONF_UART_ENABLE
{
# if (BOARD_DISPLAY_USE_UART_ANSI)
# if TI_DISPLAY_CONF_USE_UART_ANSI
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
# else /* Default to minimal UART with no cursor placement */
.fxnTablePtr = &DisplayUartMin_fxnTable,
@ -236,7 +245,7 @@ const Display_Config Display_config[] = {
.hwAttrs = &displayUartHWAttrs,
},
#endif
#if (BOARD_DISPLAY_USE_LCD)
#if TI_DISPLAY_CONF_LCD_ENABLE
{
.fxnTablePtr = &DisplaySharp_fxnTable,
.object = &displaySharpObject,
@ -252,7 +261,7 @@ const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Conf
const Display_Config *Display_config = NULL;
const uint_least8_t Display_count = 0;
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
#endif /* TI_DISPLAY_CONF_ENABLE */
/*
* =============================== GPIO ===============================
@ -356,9 +365,12 @@ const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650DK_7ID_GPTIMERPARTSCOUNT]
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#if TI_I2C_CONF_ENABLE
I2CCC26XX_Object i2cCC26xxObjects[CC2650DK_7ID_I2CCOUNT];
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650DK_7ID_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.baseAddr = I2C0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
@ -367,19 +379,24 @@ const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650DK_7ID_I2CCOUNT] = {
.swiPriority = 0,
.sdaPin = CC2650DK_7ID_I2C0_SDA0,
.sclPin = CC2650DK_7ID_I2C0_SCL0,
}
},
#endif
};
const I2C_Config I2C_config[CC2650DK_7ID_I2CCOUNT] = {
#if TI_I2C_CONF_I2C0_ENABLE
{
.fxnTablePtr = &I2CCC26XX_fxnTable,
.object = &i2cCC26xxObjects[CC2650DK_7ID_I2C0],
.hwAttrs = &i2cCC26xxHWAttrs[CC2650DK_7ID_I2C0]
},
#endif
};
const uint_least8_t I2C_count = CC2650DK_7ID_I2CCOUNT;
#endif /* TI_I2C_CONF_ENABLE */
/*
* =============================== NVS ===============================
*/
@ -391,7 +408,9 @@ const uint_least8_t I2C_count = CC2650DK_7ID_I2CCOUNT;
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_ENABLE
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
/*
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
@ -441,11 +460,11 @@ const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
},
};
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
const NVS_Config NVS_config[CC2650DK_7ID_NVSCOUNT] = {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
{
.fxnTablePtr = &NVSCC26XX_fxnTable,
.object = &nvsCC26xxObjects[0],
@ -456,6 +475,8 @@ const NVS_Config NVS_config[CC2650DK_7ID_NVSCOUNT] = {
const uint_least8_t NVS_count = CC2650DK_7ID_NVSCOUNT;
#endif /* TI_NVS_CONF_ENABLE */
/*
* =============================== PIN ===============================
*/
@ -557,6 +578,12 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
#include <ti/drivers/SD.h>
#include <ti/drivers/sd/SDSPI.h>
#if TI_SD_CONF_ENABLE
#if !(TI_SPI_CONF_SPI0_ENABLE)
#error "SD driver requires SPI0 enabled"
#endif
SDSPI_Object sdspiObjects[CC2650DK_7ID_SDCOUNT];
const SDSPI_HWAttrs sdspiHWAttrs[CC2650DK_7ID_SDCOUNT] = {
@ -576,12 +603,16 @@ const SD_Config SD_config[CC2650DK_7ID_SDCOUNT] = {
const uint_least8_t SD_count = CC2650DK_7ID_SDCOUNT;
#endif /* TI_SD_CONF_ENABLE */
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#if TI_SPI_CONF_ENABLE
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650DK_7ID_SPICOUNT];
/*
@ -590,6 +621,7 @@ SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650DK_7ID_SPICOUNT];
* to satisfy the SDSPI driver requirement.
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
@ -605,6 +637,8 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = {
.csnPin = CC2650DK_7ID_SPI0_CSN,
.minDmaTransferSize = 10
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
@ -619,35 +653,45 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = {
.clkPin = CC2650DK_7ID_SPI1_CLK,
.csnPin = CC2650DK_7ID_SPI1_CSN,
.minDmaTransferSize = 10
}
},
#endif
};
const SPI_Config SPI_config[CC2650DK_7ID_SPICOUNT] = {
#if TI_SPI_CONF_SPI0_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI0]
},
#endif
#if TI_SPI_CONF_SPI1_ENABLE
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI1]
},
#endif
};
const uint_least8_t SPI_count = CC2650DK_7ID_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== UART ===============================
*/
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#if TI_UART_CONF_ENABLE
UARTCC26XX_Object uartCC26XXObjects[CC2650DK_7ID_UARTCOUNT];
uint8_t uartCC26XXRingBuffer[CC2650DK_7ID_UARTCOUNT][32];
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650DK_7ID_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
@ -663,19 +707,24 @@ const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650DK_7ID_UARTCOUNT] = {
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
},
#endif
};
const UART_Config UART_config[CC2650DK_7ID_UARTCOUNT] = {
#if TI_UART_CONF_UART0_ENABLE
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[CC2650DK_7ID_UART0],
.hwAttrs = &uartCC26XXHWAttrs[CC2650DK_7ID_UART0]
},
#endif
};
const uint_least8_t UART_count = CC2650DK_7ID_UARTCOUNT;
#endif /* TI_UART_CONF_ENABLE */
/*
* =============================== UDMA ===============================
*/

View File

@ -49,6 +49,8 @@
extern "C" {
#endif
#include "contiki-conf.h"
/* Includes */
#include <ti/drivers/PIN.h>
#include <ti/devices/cc26x0/driverlib/ioc.h>
@ -275,7 +277,9 @@ typedef enum CC2650DK_7ID_GPTimers {
* @brief Enum of I2C names
*/
typedef enum CC2650DK_7ID_I2CName {
#if TI_I2C_CONF_I2C0_ENABLE
CC2650DK_7ID_I2C0 = 0,
#endif
CC2650DK_7ID_I2CCOUNT
} CC2650DK_7ID_I2CName;
@ -285,7 +289,7 @@ typedef enum CC2650DK_7ID_I2CName {
* @brief Enum of NVS names
*/
typedef enum CC2650DK_7ID_NVSName {
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
#if TI_NVS_CONF_NVS_INTERNAL_ENABLE
CC2650DK_7ID_NVSCC26XX0 = 0,
#endif
@ -324,8 +328,12 @@ typedef enum CC2650DK_7ID_SDName {
* @brief Enum of SPI names
*/
typedef enum CC2650DK_7ID_SPIName {
#if TI_SPI_CONF_SPI0_ENABLE
CC2650DK_7ID_SPI0 = 0,
#endif
#if TI_SPI_CONF_SPI1_ENABLE
CC2650DK_7ID_SPI1,
#endif
CC2650DK_7ID_SPICOUNT
} CC2650DK_7ID_SPIName;
@ -335,7 +343,9 @@ typedef enum CC2650DK_7ID_SPIName {
* @brief Enum of UARTs
*/
typedef enum CC2650DK_7ID_UARTName {
#if TI_UART_CONF_UART0_ENABLE
CC2650DK_7ID_UART0 = 0,
#endif
CC2650DK_7ID_UARTCOUNT
} CC2650DK_7ID_UARTName;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,27 +27,32 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-platform
* \addtogroup srf06-peripherals
* @{
*
* \file
* Driver for LaunchPad LEDs
* LED HAL definitions for the SmartRF06 Evaluation Board's LEDs.
* Common across all CC13xx/CC26xx devices for the SmartRF06 EB.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
/* Contiki API */
#include "contiki.h"
#include "dev/leds.h"
/*---------------------------------------------------------------------------*/
#include <Board.h>
/*---------------------------------------------------------------------------*/
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
const leds_t leds_arch_leds[] = {
/* Red LED, AKA LED0 */
{ .pin = Board_PIN_LED0, .negative_logic = false },
/* Yellow LED, AKA LED1 */
{ .pin = Board_PIN_LED1, .negative_logic = false },
/* Green LED, AKA LED2 */
{ .pin = Board_PIN_LED2, .negative_logic = false },
/* Red-orange LED, AKA LED3 */
{ .pin = Board_PIN_LED3, .negative_logic = false },
};
/*---------------------------------------------------------------------------*/

View File

@ -27,13 +27,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup simplelink-peripherals
* \addtogroup srf06-peripherals
* @{
*
* \file
* Generic module controlling Simplelink sensors
* Generic module controlling sensors on SmartRF06 Evaluation Board.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"