Normalized GPIO HAL, fixed LEDS & Buttons HAL, and aligned sensortag and
SRF06 boards
This commit is contained in:
parent
d4828c7baf
commit
bb00eaa041
@ -37,12 +37,12 @@
|
||||
/* TSCH related defines */
|
||||
|
||||
/* Delay between GO signal and SFD */
|
||||
#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81))
|
||||
#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81))
|
||||
/* Delay between GO signal and start listening.
|
||||
* This value is so small because the radio is constantly on within each timeslot. */
|
||||
#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15))
|
||||
#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15))
|
||||
/* Delay between the SFD finishes arriving and it is detected in software. */
|
||||
#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352))
|
||||
#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352))
|
||||
|
||||
/* Timer conversion; radio is running at 4 MHz */
|
||||
#define RAT_SECOND 4000000u
|
||||
|
@ -117,7 +117,7 @@
|
||||
/* CC26xx only supports IEEE mode */
|
||||
#elif defined(DEVICE_LINE_CC26XX)
|
||||
|
||||
# if (SUPPORTS_IEEE_MODE)
|
||||
# if (RF_CORE_MODE == RF_CORE_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
||||
/*----- CC26xx IEEE Mode ----------------------------------------------------*/
|
||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
|
||||
|
@ -42,70 +42,184 @@
|
||||
|
||||
#include <ti/devices/DeviceFamily.h>
|
||||
#include DeviceFamily_constructPath(driverlib/gpio.h)
|
||||
#include DeviceFamily_constructPath(driverlib/ioc.h)
|
||||
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define CONFIG_MASK (IOC_IOPULL_M | IOC_INT_M | IOC_IOMODE_OPEN_SRC_INV)
|
||||
static PIN_Config pin_config[] =
|
||||
{
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
static PIN_State pin_state;
|
||||
static PIN_Handle pin_handle;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
from_hal_cfg(gpio_hal_pin_cfg_t cfg, PIN_Config *pin_cfg, PIN_Config *pin_mask)
|
||||
{
|
||||
cfg &= GPIO_HAL_PIN_BM_ALL;
|
||||
|
||||
/* Input config */
|
||||
if (cfg & GPIO_HAL_PIN_BM_INPUT) {
|
||||
*pin_mask |= PIN_BM_INPUT_MODE;
|
||||
|
||||
if ((cfg & GPIO_HAL_PIN_BM_INPUT_HYSTERESIS) == GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS) {
|
||||
*pin_cfg |= PIN_HYSTERESIS;
|
||||
}
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_BM_INPUT_PULLING) {
|
||||
case GPIO_HAL_PIN_CFG_INPUT_NOPULL: *pin_cfg |= PIN_NOPULL; break;
|
||||
case GPIO_HAL_PIN_CFG_INPUT_PULLUP: *pin_cfg |= PIN_PULLUP; break;
|
||||
case GPIO_HAL_PIN_CFG_INPUT_PULLDOWN: *pin_cfg |= PIN_PULLDOWN; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output config */
|
||||
if (cfg & GPIO_HAL_PIN_BM_OUTPUT) {
|
||||
*pin_mask |= PIN_BM_OUTPUT_MODE;
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_BUF) {
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_PUSHPULL: *pin_cfg |= PIN_PUSHPULL; break;
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_OPENDRAIN: *pin_cfg |= PIN_OPENDRAIN; break;
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_OPENSOURCE: *pin_cfg |= PIN_OPENSOURCE; break;
|
||||
}
|
||||
|
||||
if ((cfg & GPIO_HAL_PIN_BM_OUTPUT_SLEWCTRL) == GPIO_HAL_PIN_CFG_OUTPUT_SLEWCTRL) {
|
||||
*pin_cfg |= PIN_SLEWCTRL;
|
||||
}
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_DRVSTR) {
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MIN: *pin_cfg |= PIN_DRVSTR_MIN; break;
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MED: *pin_cfg |= PIN_DRVSTR_MED; break;
|
||||
case GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MAX: *pin_cfg |= PIN_DRVSTR_MAX; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Interrupt config */
|
||||
if (cfg & GPIO_HAL_PIN_BM_INT) {
|
||||
*pin_mask |= PIN_BM_IRQ;
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_BUF) {
|
||||
case GPIO_HAL_PIN_CFG_INT_DISABLE: *pin_cfg |= PIN_IRQ_DIS; break;
|
||||
case GPIO_HAL_PIN_CFG_INT_FALLING: *pin_cfg |= PIN_IRQ_NEGEDGE; break;
|
||||
case GPIO_HAL_PIN_CFG_INT_RISING: *pin_cfg |= PIN_IRQ_POSEDGE; break;
|
||||
case GPIO_HAL_PIN_CFG_INT_BOTH: *pin_cfg |= PIN_IRQ_BOTHEDGES; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg)
|
||||
{
|
||||
/* Input config */
|
||||
if (pin_cfg & PIN_BM_INPUT_MODE) {
|
||||
if ((pin_cfg & PIN_BM_HYSTERESIS) == PIN_HYSTERESIS) {
|
||||
*cfg |= GPIO_HAL_PIN_BM_INPUT_HYSTERESIS;
|
||||
}
|
||||
|
||||
switch (pin_cfg & PIN_BM_PULLING) {
|
||||
case PIN_NOPULL: *cfg |= GPIO_HAL_PIN_CFG_INPUT_NOPULL; break;
|
||||
case PIN_PULLUP: *cfg |= GPIO_HAL_PIN_CFG_INPUT_PULLUP; break;
|
||||
case PIN_PULLDOWN: *cfg |= GPIO_HAL_PIN_CFG_INPUT_PULLDOWN; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output config */
|
||||
if (pin_cfg & PIN_BM_OUTPUT_MODE) {
|
||||
switch (pin_cfg & PIN_BM_OUTPUT_BUF) {
|
||||
case PIN_PUSHPULL: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_PUSHPULL; break;
|
||||
case PIN_OPENDRAIN: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_OPENDRAIN; break;
|
||||
case PIN_OPENSOURCE: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_OPENSOURCE; break;
|
||||
}
|
||||
|
||||
if ((pin_cfg & PIN_BM_SLEWCTRL) == PIN_SLEWCTRL) {
|
||||
*cfg |= GPIO_HAL_PIN_CFG_OUTPUT_SLEWCTRL;
|
||||
}
|
||||
|
||||
switch (pin_cfg & PIN_BM_DRVSTR) {
|
||||
case PIN_DRVSTR_MIN: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MIN; break;
|
||||
case PIN_DRVSTR_MED: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MED; break;
|
||||
case PIN_DRVSTR_MAX: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MAX; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Interrupt config */
|
||||
if (pin_cfg & PIN_BM_IRQ) {
|
||||
switch (pin_cfg & PIN_BM_IRQ) {
|
||||
case PIN_IRQ_DIS: *cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE; break;
|
||||
case PIN_IRQ_NEGEDGE: *cfg |= GPIO_HAL_PIN_CFG_INT_FALLING; break;
|
||||
case PIN_IRQ_POSEDGE: *cfg |= GPIO_HAL_PIN_CFG_INT_RISING; break;
|
||||
case PIN_IRQ_BOTHEDGES: *cfg |= GPIO_HAL_PIN_CFG_INT_BOTH; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
gpio_int_cb(PIN_Handle handle, PIN_Id pin_id)
|
||||
{
|
||||
/* Unused args */
|
||||
(void)handle;
|
||||
|
||||
gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id));
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_init(void)
|
||||
{
|
||||
/* No error checking */
|
||||
pin_handle = PIN_open(&pin_state, pin_config);
|
||||
PIN_registerIntCb(pin_handle, gpio_int_cb);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_interrupt_enable(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
|
||||
{
|
||||
GPIO_clearEventDio(pin);
|
||||
gpio_hal_arch_pin_cfg_set(pin, cfg);
|
||||
IOCIntEnable(pin);
|
||||
PIN_add(pin_handle, PIN_getConfig(pin));
|
||||
|
||||
cfg &= GPIO_HAL_PIN_BM_INT;
|
||||
|
||||
PIN_Config int_cfg = PIN_IRQ_DIS;
|
||||
switch (cfg) {
|
||||
case GPIO_HAL_PIN_CFG_INT_FALLING: int_cfg |= PIN_IRQ_NEGEDGE; break;
|
||||
case GPIO_HAL_PIN_CFG_INT_RISING: int_cfg |= PIN_IRQ_POSEDGE; break;
|
||||
case GPIO_HAL_PIN_CFG_INT_BOTH: int_cfg |= PIN_IRQ_BOTHEDGES; break;
|
||||
}
|
||||
|
||||
PIN_setInterrupt(pin_handle, pin | int_cfg);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_interrupt_disable(gpio_hal_pin_t pin)
|
||||
{
|
||||
PIN_add(pin_handle, PIN_getConfig(pin));
|
||||
|
||||
PIN_setInterrupt(pin_handle, pin | PIN_IRQ_DIS);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
|
||||
{
|
||||
PIN_add(pin_handle, PIN_getConfig(pin));
|
||||
|
||||
/* Clear settings that we are about to change, keep everything else */
|
||||
uint32_t config = IOCPortConfigureGet(pin);
|
||||
config &= ~CONFIG_MASK;
|
||||
PIN_Config pin_cfg = 0;
|
||||
PIN_Config pin_mask = 0;
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_CFG_INT_MASK) {
|
||||
case GPIO_HAL_PIN_CFG_INT_DISABLE: config |= (IOC_NO_EDGE | IOC_INT_DISABLE); break;
|
||||
case GPIO_HAL_PIN_CFG_INT_FALLING: config |= (IOC_FALLING_EDGE | IOC_INT_ENABLE); break;
|
||||
case GPIO_HAL_PIN_CFG_INT_RISING: config |= (IOC_RISING_EDGE | IOC_INT_ENABLE); break;
|
||||
case GPIO_HAL_PIN_CFG_INT_BOTH: config |= (IOC_BOTH_EDGES | IOC_INT_ENABLE); break;
|
||||
default: {}
|
||||
}
|
||||
from_hal_cfg(cfg, &pin_cfg, &pin_mask);
|
||||
|
||||
switch (cfg & GPIO_HAL_PIN_CFG_PULL_MASK) {
|
||||
case GPIO_HAL_PIN_CFG_PULL_NONE: config |= IOC_NO_IOPULL; break;
|
||||
case GPIO_HAL_PIN_CFG_PULL_DOWN: config |= IOC_IOPULL_DOWN; break;
|
||||
case GPIO_HAL_PIN_CFG_PULL_UP: config |= IOC_IOPULL_UP; break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
IOCPortConfigureSet(pin, IOC_PORT_GPIO, config);
|
||||
PIN_setConfig(pin_handle, pin_mask, pin | pin_cfg);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
gpio_hal_pin_cfg_t
|
||||
gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin)
|
||||
{
|
||||
PIN_Config pin_cfg = PIN_getConfig(pin);
|
||||
gpio_hal_pin_cfg_t cfg = 0;
|
||||
uint32_t config = IOCPortConfigureGet(pin);
|
||||
|
||||
switch (config & IOC_IOPULL_M) {
|
||||
case IOC_IOPULL_UP: cfg |= GPIO_HAL_PIN_CFG_PULL_UP; break;
|
||||
case IOC_IOPULL_DOWN: cfg |= GPIO_HAL_PIN_CFG_PULL_DOWN; break;
|
||||
case IOC_NO_IOPULL: cfg |= GPIO_HAL_PIN_CFG_PULL_NONE; break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
/* Interrupt enable/disable */
|
||||
uint32_t tmp = config & IOC_INT_M;
|
||||
if (tmp & IOC_INT_ENABLE) {
|
||||
switch (tmp) {
|
||||
case IOC_FALLING_EDGE: cfg |= GPIO_HAL_PIN_CFG_INT_FALLING; break;
|
||||
case IOC_RISING_EDGE: cfg |= GPIO_HAL_PIN_CFG_INT_RISING; break;
|
||||
case IOC_BOTH_EDGES: cfg |= GPIO_HAL_PIN_CFG_INT_BOTH; break;
|
||||
default: {}
|
||||
}
|
||||
} else {
|
||||
cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE;
|
||||
}
|
||||
to_hal_cfg(pin_cfg, &cfg);
|
||||
|
||||
return cfg;
|
||||
}
|
||||
@ -125,11 +239,9 @@ gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins)
|
||||
uint8_t
|
||||
gpio_hal_arch_read_pin(gpio_hal_pin_t pin)
|
||||
{
|
||||
if (GPIO_getOutputEnableDio(pin)) {
|
||||
return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) >> pin) & 1;
|
||||
}
|
||||
|
||||
return GPIO_readDio(pin);
|
||||
return (GPIO_getOutputEnableDio(pin))
|
||||
? PINCC26XX_getOutputValue(pin)
|
||||
: PINCC26XX_getInputValue(pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -50,21 +50,24 @@
|
||||
#include "contiki.h"
|
||||
|
||||
#include <ti/devices/DeviceFamily.h>
|
||||
#include DeviceFamily_constructPath(driverlib/gpio.h)
|
||||
#include DeviceFamily_constructPath(driverlib/ioc.h)
|
||||
#include DeviceFamily_constructPath(driverlib/gpio.h)
|
||||
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define gpio_hal_arch_init() do { /* do nothing */ } while (0)
|
||||
#define gpio_hal_arch_interrupt_disable(p) IOCIntDisable(p)
|
||||
#define gpio_hal_arch_pin_set_input(p) PINCC26XX_setOutputEnable(p, false)
|
||||
#define gpio_hal_arch_pin_set_output(p) PINCC26XX_setOutputEnable(p, true)
|
||||
|
||||
#define gpio_hal_arch_pin_set_input(p) IOCPinTypeGpioInput(p)
|
||||
#define gpio_hal_arch_pin_set_output(p) IOCPinTypeGpioOutput(p)
|
||||
|
||||
#define gpio_hal_arch_set_pin(p) GPIO_setDio(p)
|
||||
#define gpio_hal_arch_clear_pin(p) GPIO_clearDio(p)
|
||||
#define gpio_hal_arch_toggle_pin(p) GPIO_toggleDio(p)
|
||||
#define gpio_hal_arch_write_pin(p, v) GPIO_writeDio(p, v)
|
||||
#define gpio_hal_arch_set_pin(p) PINCC26XX_setOutputValue(p, 1)
|
||||
#define gpio_hal_arch_clear_pin(p) PINCC26XX_setOutputValue(p, 0)
|
||||
#define gpio_hal_arch_toggle_pin(p) PINCC26XX_setOutputValue(p, \
|
||||
PINCC26XX_getOutputValue(p) \
|
||||
? 0 : 1)
|
||||
#define gpio_hal_arch_write_pin(p, v) PINCC26XX_setOutputValue(p, v)
|
||||
|
||||
#define gpio_hal_arch_set_pins(p) GPIO_setMultiDio(p)
|
||||
#define gpio_hal_arch_clear_pins(p) GPIO_clearMultiDio(p)
|
||||
|
@ -168,7 +168,7 @@
|
||||
#define RAT_THREE_QUARTERS ((RAT_RANGE * (uint32_t)3) / (uint32_t)4)
|
||||
|
||||
/* XXX: don't know what exactly is this, looks like the time to TX 3 octets */
|
||||
#define RAT_TIMESTAMP_OFFSET -(USEC_TO_RADIO(32 * 3) - 1) /* -95.75 usec */
|
||||
#define RAT_TIMESTAMP_OFFSET -(USEC_TO_RAT(32 * 3) - 1) /* -95.75 usec */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define STATUS_CORRELATION 0x3f /* bits 0-5 */
|
||||
#define STATUS_REJECT_FRAME 0x40 /* bit 6 */
|
||||
|
@ -148,7 +148,7 @@
|
||||
#ifdef PROP_MODE_CONF_TX_POWER_TABLE
|
||||
# define TX_POWER_TABLE PROP_MODE_CONF_TX_POWER_TABLE
|
||||
#else
|
||||
# define TX_POWER_TABLE propTxPowerTable
|
||||
# define TX_POWER_TABLE rf_prop_tx_power_table
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TX power table convenience macros */
|
||||
|
@ -108,24 +108,6 @@ uint32_t rf_ieee_overrides[] CC_ALIGN(4) =
|
||||
(uint32_t)0xFFFFFFFF,
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// Old override list
|
||||
uint32_t rf_ieee_overrides_old[] CC_ALIGN(4) =
|
||||
{
|
||||
(uint32_t)0x00354038, /* Synth: Set RTRIM (POTAILRESTRIM) to 5 */
|
||||
(uint32_t)0x4001402D, /* Synth: Correct CKVD latency setting (address) */
|
||||
(uint32_t)0x00608402, /* Synth: Correct CKVD latency setting (value) */
|
||||
// (uint32_t)0x4001405D, /* Synth: Set ANADIV DIV_BIAS_MODE to PG1 (address) */
|
||||
// (uint32_t)0x1801F800, /* Synth: Set ANADIV DIV_BIAS_MODE to PG1 (value) */
|
||||
(uint32_t)0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */
|
||||
(uint32_t)0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */
|
||||
(uint32_t)0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */
|
||||
(uint32_t)0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */
|
||||
(uint32_t)0x002B50DC, /* Adjust AGC DC filter */
|
||||
(uint32_t)0x05000243, /* Increase synth programming timeout */
|
||||
(uint32_t)0x002082C3, /* Increase synth programming timeout */
|
||||
(uint32_t)0xFFFFFFFF,
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// CMD_RADIO_SETUP
|
||||
// Radio Setup Command for Pre-Defined Schemes
|
||||
rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup =
|
||||
@ -197,7 +179,7 @@ rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx =
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// CMD_IEEE_RX
|
||||
// The command ID number 0x2801
|
||||
rfc_CMD_IEEE_RX_t rf_cmd_ieee_xx =
|
||||
rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx =
|
||||
{
|
||||
.commandNo = CMD_IEEE_RX,
|
||||
.status = IDLE,
|
||||
|
@ -53,7 +53,7 @@ extern RF_TxPowerTable_Entry rf_ieee_tx_power_table[RF_IEEE_TX_POWER_TABLE_SIZE+
|
||||
extern rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup;
|
||||
extern rfc_CMD_FS_t rf_cmd_ieee_fs;
|
||||
extern rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx;
|
||||
extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_xx;
|
||||
extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// RF Core API Overrides
|
||||
extern uint32_t rf_ieee_overrides[];
|
||||
|
@ -43,7 +43,8 @@ extern RF_Mode rf_prop_mode;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// TX Power Table
|
||||
#define RF_PROP_TX_POWER_TABLE_SIZE 15
|
||||
extern RF_TxPowerTable_Entry rf_prop_tx_power_table[PROP_TX_POWER_TABLE_SIZE+1];
|
||||
|
||||
extern RF_TxPowerTable_Entry rf_prop_tx_power_table[RF_PROP_TX_POWER_TABLE_SIZE+1];
|
||||
/*---------------------------------------------------------------------------*/
|
||||
// RF Core API commands
|
||||
extern rfc_CMD_PROP_RADIO_DIV_SETUP_t rf_cmd_prop_radio_div_setup;
|
||||
|
@ -39,30 +39,14 @@
|
||||
#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 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Button configurations
|
||||
*
|
||||
* Configure a button as power on/off: We use the right button for both boards.
|
||||
* @{
|
||||
*/
|
||||
#ifndef BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN
|
||||
#define BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Override button symbols from dev/button-sensor.h, for the examples that
|
||||
* include it
|
||||
*/
|
||||
#define button_sensor button_left_sensor
|
||||
#define button_sensor2 button_right_sensor
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Include CPU-related configuration */
|
||||
#include "cc13xx-cc26xx-conf.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -0,0 +1,15 @@
|
||||
################################################################################
|
||||
# SimpleLink LaunchPad makefile
|
||||
|
||||
BOARD_TYPE = BOARD_SENSORTAG
|
||||
|
||||
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 += 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
|
||||
|
||||
TARGET_FAMILY_DIRS += sensortag
|
@ -6,7 +6,7 @@ BOARD_TYPE = BOARD_LAUNCHPAD
|
||||
PLATFORM_HAS_BUTTON = 1
|
||||
|
||||
# leds-arch.c/h etc.
|
||||
BOARD_SOURCEFILES += launchpad.c launchpad-sensors.c
|
||||
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c ext-flash.c
|
||||
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c
|
||||
BOARD_SOURCEFILES += ext-flash.c
|
||||
|
||||
TARGET_FAMILY_DIRS += launchpad
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -28,29 +28,41 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup simplelink-platform
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup simplelink-button-sensor Simplelink Button Driver
|
||||
* \defgroup launchpad-peripherals LaunchPad peripherals
|
||||
*
|
||||
* Defines related to LaunchPad peripherals.
|
||||
*
|
||||
* One of the buttons can be configured as general purpose or as an on/off key
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Simplelink Button Driver
|
||||
* Header file with definitions related to LaunchPad peripherals
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef BUTTON_SENSOR_ARCH_H_
|
||||
#define BUTTON_SENSOR_ARCH_H_
|
||||
#ifndef BOARD_CONF_H_
|
||||
#define BOARD_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include "lib/sensors.h"
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_CONF_COUNT 2
|
||||
|
||||
#define LEDS_CONF_RED 0
|
||||
#define LEDS_CONF_GREEN 1
|
||||
|
||||
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern const struct sensors_sensor button_left_sensor;
|
||||
extern const struct sensors_sensor button_right_sensor;
|
||||
#define BUTTON_HAL_ID_KEY_LEFT 0
|
||||
#define BUTTON_HAL_ID_KEY_RIGHT 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BUTTON_SENSOR_ARCH_H_ */
|
||||
#endif /* BOARD_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
@ -48,6 +48,10 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "ext-flash.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "board-conf.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define BOARD_CONF_HAS_SENSORS 0
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BOARD_PERIPHERALS_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -36,186 +36,29 @@
|
||||
* Driver for LaunchPad buttons
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <contiki.h>
|
||||
#include <sys/timer.h>
|
||||
#include <lib/sensors.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/button-hal.h"
|
||||
|
||||
#include <Board.h>
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/drivers/Power.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "button-sensor.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* LaunchPad has 2 buttons: BTN1 and BTN2 */
|
||||
/* Map the GPIO defines from the Board file */
|
||||
#define BTN1_PIN Board_PIN_BTN1
|
||||
#define BTN2_PIN Board_PIN_BTN2
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN
|
||||
# define BUTTON_SENSOR_ENABLE_SHUTDOWN BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN
|
||||
#else
|
||||
# define BUTTON_SENSOR_ENABLE_SHUTDOWN 0
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DEBOUNCE_DURATION (CLOCK_SECOND >> 5)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
struct timer debounce;
|
||||
clock_time_t start;
|
||||
clock_time_t duration;
|
||||
} BtnTimer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static BtnTimer btn1_timer;
|
||||
static BtnTimer btn2_timer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const PIN_Config btn_pin_table[] = {
|
||||
BTN1_PIN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
BTN2_PIN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
PIN_TERMINATE
|
||||
};
|
||||
/* 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 */
|
||||
|
||||
static PIN_State pin_state;
|
||||
static PIN_Handle pin_handle;
|
||||
/* 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 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
button_press_cb(PIN_Handle handle, PIN_Id pin_id)
|
||||
{
|
||||
#if BUTTON_SENSOR_ENABLE_SHUTDOWN
|
||||
if (pin_id == BTN2_PIN) {
|
||||
Power_shutdown(Power_ENTERING_SHUTDOWN, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
BtnTimer *btn_timer = NULL;
|
||||
const struct sensors_sensor *btn_sensor = NULL;
|
||||
|
||||
switch (pin_id) {
|
||||
case BTN1_PIN: btn_timer = &btn1_timer;
|
||||
btn_sensor = &button_left_sensor; break;
|
||||
case BTN2_PIN: btn_timer = &btn2_timer;
|
||||
btn_sensor = &button_right_sensor; break;
|
||||
default: return; /* No matching PIN */
|
||||
}
|
||||
|
||||
if (!timer_expired(&btn_timer->debounce)) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer_set(&btn_timer->debounce, DEBOUNCE_DURATION);
|
||||
|
||||
// Start press duration counter on press (falling), notify on release (rising)
|
||||
if (PIN_getInputValue(pin_id) == 0) {
|
||||
btn_timer->start = clock_time();
|
||||
btn_timer->duration = 0;
|
||||
} else {
|
||||
btn_timer->duration = clock_time() - btn_timer->start;
|
||||
sensors_changed(btn_sensor);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_value(int type, uint8_t pin, BtnTimer *btn_timer)
|
||||
{
|
||||
switch (type) {
|
||||
case BUTTON_SENSOR_TYPE_STATE:
|
||||
return (PIN_getInputValue(pin) == 0)
|
||||
? BUTTON_SENSOR_VALUE_PRESSED
|
||||
: BUTTON_SENSOR_VALUE_RELEASED;
|
||||
|
||||
case BUTTON_SENSOR_TYPE_DURATION:
|
||||
return (int)btn_timer->duration;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_config(int type, int value, uint8_t pin)
|
||||
{
|
||||
switch (type) {
|
||||
case SENSORS_HW_INIT:
|
||||
// Open PIN handle
|
||||
if (pin_handle) {
|
||||
return 1;
|
||||
}
|
||||
pin_handle = PIN_open(&pin_state, btn_pin_table);
|
||||
if (!pin_handle) {
|
||||
return 0;
|
||||
}
|
||||
// Register button callback function
|
||||
PIN_registerIntCb(pin_handle, button_press_cb);
|
||||
break;
|
||||
|
||||
case SENSORS_ACTIVE:
|
||||
if (value) {
|
||||
// Enable interrupts on both edges
|
||||
PIN_setInterrupt(pin_handle, pin | PIN_IRQ_BOTHEDGES);
|
||||
} else {
|
||||
// Disable pin interrupts
|
||||
PIN_setInterrupt(pin_handle, pin | PIN_IRQ_DIS);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_status(int type, uint8_t pin)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_ACTIVE: /* fallthrough */
|
||||
case SENSORS_READY: {
|
||||
PIN_Config pin_cfg = PIN_getConfig(pin);
|
||||
return (pin_cfg & PIN_BM_IRQ) == PIN_IRQ_DIS;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_value(int type)
|
||||
{
|
||||
return button_value(type, BTN1_PIN, &btn1_timer);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_config(int type, int value)
|
||||
{
|
||||
return button_config(type, value, BTN1_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_status(int type)
|
||||
{
|
||||
return button_status(type, BTN1_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_value(int type)
|
||||
{
|
||||
return button_value(type, BTN2_PIN, &btn2_timer);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_config(int type, int value)
|
||||
{
|
||||
return button_config(type, value, BTN2_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_status(int type)
|
||||
{
|
||||
return button_status(type, BTN2_PIN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
SENSORS_SENSOR(button_left_sensor, BUTTON_SENSOR, btn1_value, btn1_config, btn1_status);
|
||||
SENSORS_SENSOR(button_right_sensor, BUTTON_SENSOR, btn2_value, btn2_config, btn2_status);
|
||||
BUTTON_HAL_BUTTONS(&key_left, &key_right);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -41,24 +41,10 @@ extern "C" {
|
||||
|
||||
#include "CC1310_LAUNCHXL.h"
|
||||
|
||||
#define Board_initGeneral() CC1310_LAUNCHXL_initGeneral()
|
||||
#define Board_initGeneral() CC1310_LAUNCHXL_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC1310_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1310_LAUNCHXL_wakeUpExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1310_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1310_LAUNCHXL_ADC0
|
||||
|
@ -41,24 +41,10 @@ extern "C" {
|
||||
|
||||
#include "CC1312R1_LAUNCHXL.h"
|
||||
|
||||
#define Board_initGeneral() CC1312R1_LAUNCHXL_initGeneral()
|
||||
#define Board_initGeneral() CC1312R1_LAUNCHXL_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC1312R1_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1312R1_LAUNCHXL_wakeUpExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1312R1_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1312R1_LAUNCHXL_ADC0
|
||||
|
@ -45,20 +45,6 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1350_LAUNCHXL_433_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_433_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1350_LAUNCHXL_433_ADC0
|
||||
|
@ -5,7 +5,7 @@ SUBFAMILY = cc13x0-cc26x0
|
||||
DEVICE_FAMILY = CC13X0
|
||||
DEVICE_LINE = CC13XX
|
||||
|
||||
BOARD_SOURCEFILES += CC1350_LAUNCHXL_433.c CC1310_LAUNCHXL_433_fxns.c
|
||||
BOARD_SOURCEFILES += CC1350_LAUNCHXL_433.c CC1350_LAUNCHXL_433_fxns.c
|
||||
|
||||
SUPPORTS_PROP_MODE = 1
|
||||
SUPPORTS_IEEE_MODE = 1
|
||||
|
@ -45,21 +45,8 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1350_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1350_LAUNCHXL_ADC0
|
||||
#define Board_ADC1 CC1350_LAUNCHXL_ADC1
|
||||
|
||||
|
@ -45,20 +45,6 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1352P_2_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1352P_2_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1352P_2_LAUNCHXL_ADC0
|
@ -45,20 +45,6 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1352P_4_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1352P_4_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1352P_4_LAUNCHXL_ADC0
|
@ -45,20 +45,6 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1352P1_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1352P1_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1352P1_LAUNCHXL_ADC0
|
||||
|
@ -5,7 +5,7 @@ SUBFAMILY = cc13x2-cc26x2
|
||||
DEVICE_FAMILY = CC13X2
|
||||
DEVICE_LINE = CC13XX
|
||||
|
||||
BOARD_SOURCEFILES += CC1352P1_LAUNCHXL.c CC1312P1_LAUNCHXL_fxns.c
|
||||
BOARD_SOURCEFILES += CC1352P1_LAUNCHXL.c CC1352P1_LAUNCHXL_fxns.c
|
||||
|
||||
DEFINES += PROP_MODE_CONF_TX_POWER_TABLE=rf_prop_tx_power_table_default_pa
|
||||
DEFINES += PROP_MODE_CONF_TX_POWER_TABLE_SIZE=RF_PROP_TX_POWER_TABLE_DEFAULT_PA_SIZE
|
||||
|
@ -45,20 +45,6 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC1352R1_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1352R1_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_CONF_COUNT 2
|
||||
|
||||
#define LEDS_CONF_RED 0
|
||||
#define LEDS_CONF_GREEN 1
|
||||
|
||||
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC1352R1_LAUNCHXL_ADC0
|
||||
|
@ -45,21 +45,8 @@ extern "C" {
|
||||
#define Board_shutDownExtFlash() CC2650_LAUNCHXL_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC2650_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC2650_LAUNCHXL_ADC0
|
||||
#define Board_ADC1 CC2650_LAUNCHXL_ADC1
|
||||
|
||||
|
@ -47,20 +47,6 @@ extern "C" {
|
||||
|
||||
#define Board_wakeUpExtFlash() CC26X2R1_LAUNCHXL_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_ADC0 CC26X2R1_LAUNCHXL_ADC0
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup simplelink-peripherals
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Generic module controlling Simplelink sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <contiki.h>
|
||||
#include <lib/sensors.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "button-sensor.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Exports a global symbol to be used by the sensor API */
|
||||
SENSORS(
|
||||
&button_left_sensor,
|
||||
&button_right_sensor,
|
||||
NULL
|
||||
);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -71,6 +71,7 @@
|
||||
#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"
|
||||
@ -78,6 +79,7 @@
|
||||
#include "lib/sensors.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Arch driver implementations */
|
||||
#include "board-peripherals.h"
|
||||
#include "uart0-arch.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "ieee-addr.h"
|
||||
@ -101,6 +103,12 @@ unsigned short g_nodeId = 0;
|
||||
*/
|
||||
extern void Board_initHook(void);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef BOARD_CONF_HAS_SENSORS
|
||||
#define BOARD_HAS_SENSORS BOARD_CONF_HAS_SENSORS
|
||||
#else
|
||||
#define BOARD_HAS_SENSORS 1
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
fade(unsigned char l)
|
||||
{
|
||||
@ -186,6 +194,8 @@ platform_init_stage_two(void)
|
||||
/* Populate linkaddr_node_addr */
|
||||
ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE);
|
||||
|
||||
button_hal_init();
|
||||
|
||||
fade(LEDS_RED);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -211,7 +221,9 @@ platform_init_stage_three(void)
|
||||
LOG_INFO("RF: Channel %d, PANID 0x%04X\n", chan, pan);
|
||||
LOG_INFO("Node ID: %d\n", g_nodeId);
|
||||
|
||||
#if BOARD_HAS_SENSORS
|
||||
process_start(&sensors_process, NULL);
|
||||
#endif
|
||||
|
||||
fade(LEDS_GREEN);
|
||||
}
|
||||
|
@ -6,11 +6,10 @@ BOARD_TYPE = BOARD_SENSORTAG
|
||||
PLATFORM_HAS_BUTTON = 1
|
||||
|
||||
# leds-arch.c/h etc.
|
||||
BOARD_SOURCEFILES += sensortag.c sensortag-sensors.c
|
||||
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c
|
||||
BOARD_SOURCEFILES += sensortag-sensors.c
|
||||
BOARD_SOURCEFILES += button-sensor-arch.c ext-flash.c
|
||||
BOARD_SOURCEFILES += bmp-280-sensor.c hdc-1000-sensor.c
|
||||
BOARD_SOURCEFILES += mpu-9250-sensor.c opt-3001-sensor.c
|
||||
BOARD_SOURCEFILES += reed-relay.c tmp-007-sensor.c
|
||||
BOARD_SOURCEFILES += buzzer.c
|
||||
BOARD_SOURCEFILES += tmp-007-sensor.c buzzer.c
|
||||
|
||||
TARGET_FAMILY_DIRS += sensortag
|
@ -28,32 +28,33 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup sensortag-cc26xx-peripherals
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup sensortag-cc26xx-reed-relay SensorTag 2.0 Reed Relay
|
||||
* \defgroup sensortag-cc26xx-peripherals Sensortag CC1350/CC2650 common
|
||||
*
|
||||
* The reed relay acts like a button without a button. To trigger the reed,
|
||||
* approach a magnet to the sensortag and a sensors_changed event will be
|
||||
* generated, in a fashion similar to as if a button had been pressed
|
||||
* Defines related to Sensortag sensors. The two sensortags are identical to a
|
||||
* very large extent. Everything documented within this group applies to both
|
||||
* sensortags.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Sensortag Reed Relay
|
||||
* Header file with definitions related to the sensors on the Sensortags
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef REED_RELAY_H
|
||||
#define REED_RELAY_H
|
||||
#ifndef BOARD_CONF_H_
|
||||
#define BOARD_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "lib/sensors.h"
|
||||
#include "leds-arch.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define REED_RELAY_READING_ERROR -1
|
||||
#define BUTTON_HAL_ID_KEY_LEFT 0
|
||||
#define BUTTON_HAL_ID_KEY_RIGHT 1
|
||||
#define BUTTON_HAL_ID_REED_RELAY 2
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern const struct sensors_sensor reed_relay_sensor;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* REED_RELAY_H */
|
||||
#endif /* BOARD_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
@ -53,10 +53,13 @@
|
||||
#include "opt-3001-sensor.h"
|
||||
#include "hdc-1000-sensor.h"
|
||||
#include "mpu-9250-sensor.h"
|
||||
#include "reed-relay.h"
|
||||
#include "buzzer.h"
|
||||
#include "ext-flash.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "board-conf.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define BOARD_CONF_HAS_SENSORS 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BOARD_PERIPHERALS_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -36,163 +36,37 @@
|
||||
* Driver for LaunchPad buttons
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <contiki.h>
|
||||
#include <sys/timer.h>
|
||||
#include <lib/sensors.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/button-hal.h"
|
||||
|
||||
#include <Board.h>
|
||||
#include <ti/drivers/GPIO.h>
|
||||
#include <ti/drivers/Power.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "button-sensor.h"
|
||||
#include "button-sensor-arch.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Sensortag has 2 buttons: BTN1 and BTN2 */
|
||||
/* Map the GPIO defines from the Board file */
|
||||
#define BTN1_GPIO Board_KEY_LEFT
|
||||
#define BTN2_GPIO Board_KEY_RIGHT
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN
|
||||
# define BUTTON_SENSOR_ENABLE_SHUTDOWN BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN
|
||||
#else
|
||||
# define BUTTON_SENSOR_ENABLE_SHUTDOWN 1
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DEBOUNCE_DURATION (CLOCK_SECOND >> 5)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
struct timer debounce;
|
||||
clock_time_t start;
|
||||
clock_time_t duration;
|
||||
} BtnTimer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static BtnTimer g_btn1Timer;
|
||||
static BtnTimer g_btn2Timer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
button_press_cb(uint8_t index, BtnTimer *btnTimer, const struct sensors_sensor *btnSensor)
|
||||
{
|
||||
if (!timer_expired(&btnTimer->debounce)) {
|
||||
return;
|
||||
}
|
||||
/* 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 */
|
||||
|
||||
timer_set(&btnTimer->debounce, DEBOUNCE_DURATION);
|
||||
/* 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 */
|
||||
|
||||
// Start press duration counter on press (falling), notify on release (rising)
|
||||
if (GPIO_read(index) == 0) {
|
||||
btnTimer->start = clock_time();
|
||||
btnTimer->duration = 0;
|
||||
} else {
|
||||
btnTimer->duration = clock_time() - btnTimer->start;
|
||||
sensors_changed(btnSensor);
|
||||
}
|
||||
}
|
||||
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 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_value(int type, uint8_t index, BtnTimer *btnTimer)
|
||||
{
|
||||
if (type == BUTTON_SENSOR_VALUE_STATE) {
|
||||
return (GPIO_read(index) == 0)
|
||||
? BUTTON_SENSOR_VALUE_PRESSED
|
||||
: BUTTON_SENSOR_VALUE_RELEASED;
|
||||
} else if (type == BUTTON_SENSOR_VALUE_DURATION) {
|
||||
return (int)btnTimer->duration;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_config(int type, int value, uint8_t index, GPIO_CallbackFxn callback)
|
||||
{
|
||||
switch (type) {
|
||||
case SENSORS_HW_INIT:
|
||||
GPIO_clearInt(index);
|
||||
GPIO_setCallback(index, callback);
|
||||
break;
|
||||
|
||||
case SENSORS_ACTIVE:
|
||||
if (value) {
|
||||
GPIO_clearInt(index);
|
||||
GPIO_enableInt(index);
|
||||
} else {
|
||||
GPIO_disableInt(index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
button_status(int type, uint8_t index)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_ACTIVE: /* fallthrough */
|
||||
case SENSORS_READY: {
|
||||
GPIO_PinConfig pinCfg = 0;
|
||||
GPIO_getConfig(index, &pinCfg);
|
||||
return (pinCfg & GPIO_CFG_IN_INT_NONE) == 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
btn1_press_cb(unsigned char unusued)
|
||||
{
|
||||
button_press_cb(BTN1_GPIO, &g_btn1Timer, &btn1_sensor);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_value(int type)
|
||||
{
|
||||
return button_value(type, BTN1_GPIO, &g_btn1Timer);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_config(int type, int value)
|
||||
{
|
||||
return button_config(type, value, BTN1_GPIO, btn1_press_cb);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn1_status(int type)
|
||||
{
|
||||
return button_status(type, BTN1_GPIO);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
btn2_press_cb(unsigned char unusued)
|
||||
{
|
||||
if (BUTTON_SENSOR_ENABLE_SHUTDOWN) {
|
||||
Power_shutdown(Power_ENTERING_SHUTDOWN, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
button_press_cb(BTN2_GPIO, &g_btn2Timer, &btn2_sensor);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_value(int type)
|
||||
{
|
||||
return button_value(type, BTN2_GPIO, &g_btn2Timer);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_config(int type, int value)
|
||||
{
|
||||
return button_config(type, value, BTN2_GPIO, btn2_press_cb);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
btn2_status(int type)
|
||||
{
|
||||
return button_status(type, BTN1_GPIO);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
SENSORS_SENSOR(btn1_sensor, BUTTON_SENSOR, btn1_value, btn1_config, btn1_status);
|
||||
SENSORS_SENSOR(btn2_sensor, BUTTON_SENSOR, btn2_value, btn2_config, btn2_status);
|
||||
BUTTON_HAL_BUTTONS(&key_left, &key_right, &reed_relay);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -41,24 +41,10 @@ extern "C" {
|
||||
|
||||
#include "CC1350STK.h"
|
||||
|
||||
#define Board_initGeneral() CC1350STK_initGeneral()
|
||||
#define Board_initGeneral() CC1350STK_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC1350STK_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1350STK_wakeUpExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1350STK_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN LEDS_RED
|
||||
#define LEDS_YELLOW LEDS_RED
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_BUZZER CC1350STK_BUZZER
|
||||
|
@ -37,61 +37,16 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include <contiki.h>
|
||||
#include <dev/leds.h>
|
||||
#include "contiki.h"
|
||||
#include "dev/leds.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Simplelink SDK API */
|
||||
#include <Board.h>
|
||||
|
||||
#include <ti/drivers/PIN.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard library */
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const PIN_Config pin_table[] = {
|
||||
Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
PIN_TERMINATE
|
||||
const leds_t leds_arch_leds[] = {
|
||||
{ .pin = Board_PIN_LED0, .negative_logic = false },
|
||||
};
|
||||
|
||||
static PIN_State pin_state;
|
||||
static PIN_Handle pin_handle;
|
||||
|
||||
static volatile unsigned char c;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
static bool bHasInit = false;
|
||||
if(bHasInit) {
|
||||
return;
|
||||
}
|
||||
|
||||
// PIN_init() called from Board_initGeneral()
|
||||
pin_handle = PIN_open(&pin_state, pin_table);
|
||||
if (!pin_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
bHasInit = true;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
leds_arch_get(void)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
c = leds;
|
||||
|
||||
PIN_setPortOutputValue(pin_handle, 0);
|
||||
|
||||
if (leds & LEDS_RED) {
|
||||
PIN_setOutputValue(pin_handle, Board_PIN_LED0, 1);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -28,34 +28,39 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup launchpad-peripherals
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup launchpad-peripherals LaunchPad peripherals
|
||||
*
|
||||
* Defines related to LaunchPad peripherals.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* LaunchPad-specific board initialisation driver
|
||||
* Header file with definitions related to LaunchPad peripherals
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#ifndef LEDS_ARCH_H_
|
||||
#define LEDS_ARCH_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "Board.h"
|
||||
#include "ti/drivers/dpl/HwiP.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
board_init()
|
||||
{
|
||||
/* Disable interrupts */
|
||||
const uintptr_t key = HwiP_disable();
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_CONF_COUNT 1
|
||||
|
||||
Board_initGeneral();
|
||||
Board_shutDownExtFlash();
|
||||
#define LEDS_CONF_RED 0
|
||||
|
||||
/* Restore interrupts. */
|
||||
HwiP_restore(key);
|
||||
}
|
||||
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
#endif /* LEDS_ARCH_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -41,24 +41,10 @@ extern "C" {
|
||||
|
||||
#include "CC2650STK.h"
|
||||
|
||||
#define Board_initGeneral() CC2650STK_initGeneral()
|
||||
#define Board_initGeneral() CC2650STK_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC2650STK_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC2650STK_wakeUpExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC2650STK_wakeUpExtFlash()
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_RED (1 << 0)
|
||||
#define LEDS_GREEN (1 << 1)
|
||||
#define LEDS_YELLOW LEDS_GREEN
|
||||
#define LEDS_ORANGE LEDS_RED
|
||||
|
||||
#define LEDS_CONF_ALL (LEDS_RED | LEDS_GREEN)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
|
||||
#define Board_BUZZER CC2650STK_BUZZER
|
||||
|
@ -37,66 +37,17 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include <contiki.h>
|
||||
#include <dev/leds.h>
|
||||
#include "contiki.h"
|
||||
#include "dev/leds.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Simplelink SDK API */
|
||||
#include <Board.h>
|
||||
|
||||
#include <ti/drivers/PIN.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard library */
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const PIN_Config pin_table[] = {
|
||||
Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
|
||||
PIN_TERMINATE
|
||||
const leds_t leds_arch_leds[] = {
|
||||
{ .pin = Board_PIN_LED0, .negative_logic = false },
|
||||
{ .pin = Board_PIN_LED1, .negative_logic = false },
|
||||
};
|
||||
|
||||
static PIN_State pin_state;
|
||||
static PIN_Handle pin_handle;
|
||||
|
||||
static volatile unsigned char c;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
static bool bHasInit = false;
|
||||
if(bHasInit) {
|
||||
return;
|
||||
}
|
||||
|
||||
// PIN_init() called from Board_initGeneral()
|
||||
pin_handle = PIN_open(&pin_state, pin_table);
|
||||
if (!pin_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
bHasInit = true;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
leds_arch_get(void)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
c = leds;
|
||||
|
||||
PIN_setPortOutputValue(pin_handle, 0);
|
||||
|
||||
if (leds & LEDS_RED) {
|
||||
PIN_setOutputValue(pin_handle, Board_PIN_LED0, 1);
|
||||
}
|
||||
|
||||
if (leds & LEDS_GREEN) {
|
||||
PIN_setOutputValue(pin_handle, Board_PIN_LED1, 1);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -28,29 +28,38 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup simplelink-platform
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup simplelink-button-sensor Simplelink Button Driver
|
||||
* \defgroup launchpad-peripherals LaunchPad peripherals
|
||||
*
|
||||
* Defines related to LaunchPad peripherals.
|
||||
*
|
||||
* One of the buttons can be configured as general purpose or as an on/off key
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Simplelink Button Driver
|
||||
* Header file with definitions related to LaunchPad peripherals
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef BUTTON_SENSOR_ARCH_H_
|
||||
#define BUTTON_SENSOR_ARCH_H_
|
||||
#ifndef LEDS_ARCH_H_
|
||||
#define LEDS_ARCH_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include "lib/sensors.h"
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_CONF_COUNT 2
|
||||
|
||||
#define LEDS_CONF_RED 0
|
||||
#define LEDS_CONF_GREEN 1
|
||||
|
||||
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern const struct sensors_sensor btn1_sensor;
|
||||
extern const struct sensors_sensor btn2_sensor;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BUTTON_SENSOR_ARCH_H_ */
|
||||
#endif /* LEDS_ARCH_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
468
arch/platform/simplelink/cc13xx-cc26xx/sensortag/ext-flash.c
Normal file
468
arch/platform/simplelink/cc13xx-cc26xx/sensortag/ext-flash.c
Normal file
@ -0,0 +1,468 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -29,28 +29,88 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup sensortag-cc26xx-peripherals
|
||||
* \addtogroup common-cc26xx-peripherals
|
||||
* @{
|
||||
*
|
||||
* \defgroup sensortag-cc26xx-ext-flash SensorTag/LaunchPad External Flash
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Sensortag-specific board initialisation driver
|
||||
* Header file for the Sensortag/LaunchPad External Flash Driver
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "Board.h"
|
||||
#include "ti/drivers/GPIO.h"
|
||||
#include "ti/drivers/I2C.h"
|
||||
#include "ti/drivers/PIN.h"
|
||||
#include "ti/drivers/SPI.h"
|
||||
#ifndef EXT_FLASH_H_
|
||||
#define EXT_FLASH_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
board_init(void)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* \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_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -1,152 +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-reed-relay
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the Sensortag Reed Relay
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "sys/clock.h"
|
||||
#include "sys/timer.h"
|
||||
#include "lib/sensors.h"
|
||||
#include "sys/timer.h"
|
||||
#include "reed-relay.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <Board.h>
|
||||
#include <ti/drivers/PIN.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct timer debouncetimer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static PIN_Config reed_pin_table[] = {
|
||||
Board_RELAY | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_DIS,
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
static PIN_State pin_state;
|
||||
static PIN_Handle pin_handle;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static bool
|
||||
sensor_init(void)
|
||||
{
|
||||
if (pin_handle) {
|
||||
return true;
|
||||
}
|
||||
|
||||
pin_handle = PIN_open(&pin_state, reed_pin_table);
|
||||
return pin_handle != NULL;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Handler for Sensortag-CC26XX reed interrupts
|
||||
*/
|
||||
static void
|
||||
reed_relay_isr(PIN_Handle handle, PIN_Id pinId)
|
||||
{
|
||||
(void)handle;
|
||||
(void)pinId;
|
||||
|
||||
if (!timer_expired(&debouncetimer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer_set(&debouncetimer, CLOCK_SECOND / 2);
|
||||
sensors_changed(&reed_relay_sensor);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
value(int type)
|
||||
{
|
||||
return (int)PIN_getInputValue(Board_RELAY);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Configuration function for the button sensor for all buttons.
|
||||
*
|
||||
* \param type SENSORS_HW_INIT: Initialise. SENSORS_ACTIVE: Enables/Disables
|
||||
* depending on 'value'
|
||||
* \param value 0: disable, non-zero: enable
|
||||
* \return Always returns 1
|
||||
*/
|
||||
static int
|
||||
configure(int type, int value)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_HW_INIT:
|
||||
if (!sensor_init()) {
|
||||
return REED_RELAY_READING_ERROR;
|
||||
}
|
||||
|
||||
PIN_setInterrupt(pin_handle, Board_RELAY | PIN_IRQ_DIS);
|
||||
PIN_registerIntCb(pin_handle, reed_relay_isr);
|
||||
break;
|
||||
|
||||
case SENSORS_ACTIVE:
|
||||
if (value) {
|
||||
PIN_setInterrupt(pin_handle, Board_RELAY | PIN_IRQ_NEGEDGE);
|
||||
} else {
|
||||
PIN_setInterrupt(pin_handle, Board_RELAY | PIN_IRQ_DIS);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Status function for the reed
|
||||
* \param type SENSORS_ACTIVE or SENSORS_READY
|
||||
* \return 1 Interrupt enabled, 0: Disabled
|
||||
*/
|
||||
static int
|
||||
status(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case SENSORS_ACTIVE:
|
||||
case SENSORS_READY:
|
||||
return (PIN_getConfig(Board_RELAY) & PIN_BM_IRQ) != 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
SENSORS_SENSOR(reed_relay_sensor, "REED", value, configure, status);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -36,20 +36,13 @@
|
||||
* Generic module controlling Simplelink sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <contiki.h>
|
||||
#include <lib/sensors.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "common/button-sensor.h"
|
||||
#include "contiki.h"
|
||||
#include "lib/sensors.h"
|
||||
|
||||
#include "board-peripherals.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Exports a global symbol to be used by the sensor API */
|
||||
SENSORS(
|
||||
#ifdef BUTTON_SENSOR_ARCH_BTN1
|
||||
&button_sensor,
|
||||
#endif
|
||||
#ifdef BUTTON_SENSOR_ARCH_BTN2
|
||||
&button_sensor2,
|
||||
#endif
|
||||
NULL
|
||||
);
|
||||
SENSORS(&bmp_280_sensor, &tmp_007_sensor, &opt_3001_sensor, &hdc_1000_sensor,
|
||||
&mpu_9250_sensor);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -6,7 +6,8 @@ BOARD_TYPE = BOARD_SRF06
|
||||
PLATFORM_HAS_BUTTON = 1
|
||||
|
||||
# leds-arch.c/h etc.
|
||||
BOARD_SOURCEFILES += srf06.c srf06-sensors.c
|
||||
BOARD_SOURCEFILES += srf06-sensors.c
|
||||
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c
|
||||
BOARD_SOURCEFILES += als-sensor.c
|
||||
|
||||
TARGET_FAMILY_DIRS += srf06
|
||||
|
@ -37,43 +37,53 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/gpio-hal.h"
|
||||
#include "lib/sensors.h"
|
||||
#include "srf06/als-sensor.h"
|
||||
#include "sys/timer.h"
|
||||
#include "dev/adc-sensor.h"
|
||||
#include "dev/aux-ctrl.h"
|
||||
|
||||
#include "ti-lib.h"
|
||||
#include "als-sensor.h"
|
||||
|
||||
#include <Board.h>
|
||||
|
||||
#include <ti/drivers/ADC.h>
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static aux_consumer_module_t als_aux = {
|
||||
.clocks = AUX_WUC_ADI_CLOCK | AUX_WUC_ANAIF_CLOCK | AUX_WUC_SMPH_CLOCK
|
||||
};
|
||||
static ADC_Handle adc_handle;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
init(void)
|
||||
{
|
||||
ADC_Params adc_params;
|
||||
ADC_Params_init(&adc_params);
|
||||
|
||||
adc_handle = ADC_open(Board_ADCALS, &adc_params);
|
||||
if (adc_handle == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
config(int type, int enable)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_HW_INIT:
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR);
|
||||
break;
|
||||
return init();
|
||||
|
||||
case SENSORS_ACTIVE:
|
||||
ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR);
|
||||
ti_lib_rom_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO,
|
||||
IOC_STD_OUTPUT);
|
||||
ti_lib_rom_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT);
|
||||
gpio_hal_arch_pin_set_output(Board_ALS_PWR);
|
||||
gpio_hal_arch_pin_set_input(Board_ALS_OUT);
|
||||
|
||||
if(enable) {
|
||||
ti_lib_gpio_set_dio(BOARD_IOID_ALS_PWR);
|
||||
aux_ctrl_register_consumer(&als_aux);
|
||||
ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7);
|
||||
gpio_hal_arch_set_pin(Board_ALS_PWR);
|
||||
clock_delay_usec(2000);
|
||||
} else {
|
||||
ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR);
|
||||
aux_ctrl_unregister_consumer(&als_aux);
|
||||
gpio_hal_arch_clear_pin(Board_ALS_PWR);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -83,15 +93,14 @@ config(int type, int enable)
|
||||
static int
|
||||
value(int type)
|
||||
{
|
||||
int val;
|
||||
|
||||
ti_lib_aux_adc_enable_sync(AUXADC_REF_VDDS_REL, AUXADC_SAMPLE_TIME_2P7_US,
|
||||
AUXADC_TRIGGER_MANUAL);
|
||||
ti_lib_aux_adc_gen_manual_trigger();
|
||||
val = ti_lib_aux_adc_read_fifo();
|
||||
ti_lib_aux_adc_disable();
|
||||
uint16_t adc_value = 0;
|
||||
int_fast16_t res = ADC_convert(adc_handle, &adc_value);
|
||||
if (res != ADC_STATUS_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return val;
|
||||
return (int)adc_value;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -28,41 +28,46 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup simplelink-platform
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup simplelink-button-sensor Simplelink Button Driver
|
||||
* \defgroup launchpad-peripherals LaunchPad peripherals
|
||||
*
|
||||
* Defines related to LaunchPad peripherals.
|
||||
*
|
||||
* One of the buttons can be configured as general purpose or as an on/off key
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file for the Simplelink Button Driver
|
||||
* Header file with definitions related to LaunchPad peripherals
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef BUTTON_SENSOR_H_
|
||||
#define BUTTON_SENSOR_H_
|
||||
#ifndef BOARD_CONF_H_
|
||||
#define BOARD_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include "lib/sensors.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Board specific button sensors */
|
||||
#include "button-sensor-arch.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define BUTTON_SENSOR "Button"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
BUTTON_SENSOR_TYPE_STATE,
|
||||
BUTTON_SENSOR_TYPE_DURATION
|
||||
} button_sensor_type_t;
|
||||
/**
|
||||
* \name LED configurations
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define LEDS_CONF_COUNT 4
|
||||
|
||||
typedef enum {
|
||||
BUTTON_SENSOR_VALUE_RELEASED,
|
||||
BUTTON_SENSOR_VALUE_PRESSED
|
||||
} button_sensor_value_t;
|
||||
#define LEDS_CONF_RED 0
|
||||
#define LEDS_CONF_YELLOW 1
|
||||
#define LEDS_CONF_GREEN 2
|
||||
#define LEDS_CONF_ORANGE 3
|
||||
|
||||
#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BUTTON_SENSOR_H_ */
|
||||
#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
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BOARD_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -31,15 +31,16 @@
|
||||
/** \addtogroup cc26xx-srf-tag
|
||||
* @{
|
||||
*
|
||||
* \defgroup srf06-common-peripherals SmartRF06EB + CC13xx/CC26xx common
|
||||
* \defgroup launchpad-peripherals LaunchPad peripherals
|
||||
*
|
||||
* Defines related to the SmartRF06 Evaluation Board irrespective of the EM
|
||||
* mounted on it
|
||||
*
|
||||
* This file provides connectivity information on LEDs, Buttons, UART and
|
||||
* other peripherals
|
||||
* Defines related to LaunchPad peripherals.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Header file with definitions related to LaunchPad peripherals
|
||||
*
|
||||
* \note Do not include this file directly.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef BOARD_PERIPHERALS_H_
|
||||
@ -47,6 +48,10 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "als-sensor.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "board-conf.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define BOARD_CONF_HAS_SENSORS 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* BOARD_PERIPHERALS_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup launchpad-button-sensor
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for LaunchPad buttons
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#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 */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* 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_BUTTONS(&key_select, &key_up, &key_down, &key_left, &key_right);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||
* Copyright (c) 2015-2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,53 +33,131 @@
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
#define Board_CC1350DK_7XD
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ti/drivers/Power.h>
|
||||
#include "CC1350DK_7XD.h"
|
||||
|
||||
#include "CC1310DK_7XD.h"
|
||||
#define Board_initGeneral() CC1350DK_7XD_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC1350DK_7XD_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC1350DK_7XD_wakeUpExtFlash()
|
||||
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
#define Board_LED1 Board_DK_LED1
|
||||
#define Board_LED2 Board_DK_LED2
|
||||
#define Board_LED3 Board_DK_LED3
|
||||
#define Board_LED4 Board_DK_LED4
|
||||
|
||||
#define Board_LED0 Board_DK_LED4
|
||||
#define Board_ADCALS CC1350DK_7XD_ADCALS
|
||||
|
||||
#define Board_ADC0 CC1310DK_7XD_ADCVDDS
|
||||
#define Board_ADC1 CC1310DK_7XD_ADCALS
|
||||
#define Board_ADC0 CC1350DK_7XD_ADCVDDS
|
||||
#define Board_ADC1 CC1350DK_7XD_ADCALS
|
||||
|
||||
#define Board_ADCBuf0 CC1310DK_7XD_ADCBuf0
|
||||
#define Board_ADCBufChannel0 (0)
|
||||
#define Board_ADCBufChannel1 (1)
|
||||
#define Board_ADCBUF0 CC1350DK_7XD_ADCBUF0
|
||||
#define Board_ADCBUF0CHANNEL0 CC1350DK_7XD_ADCBUF0CHANNELVDDS
|
||||
#define Board_ADCBUF0CHANNEL1 CC1350DK_7XD_ADCBUF0CHANNELADCALS
|
||||
|
||||
#define Board_BUTTON0 Board_KEY_UP
|
||||
#define Board_BUTTON1 Board_KEY_DOWN
|
||||
#define Board_CRYPTO0 CC1350DK_7XD_CRYPTO0
|
||||
|
||||
#define Board_I2C0 Board_I2C
|
||||
#define Board_UART0 Board_UART
|
||||
#define Board_AES0 Board_AES
|
||||
#define Board_WATCHDOG0 CC1310DK_7XD_WATCHDOG0
|
||||
#define Board_DIO0 CC1350DK_7XD_DIO0
|
||||
#define Board_DIO1_RFSW CC1350DK_7XD_DIO1_RFSW
|
||||
#define Board_DIO12 CC1350DK_7XD_DIO12
|
||||
#define Board_DIO15 CC1350DK_7XD_DIO15
|
||||
#define Board_DIO16_TDO CC1350DK_7XD_DIO16_TDO
|
||||
#define Board_DIO17_TDI CC1350DK_7XD_DIO17_TDI
|
||||
#define Board_DIO21 CC1350DK_7XD_DIO21
|
||||
#define Board_DIO22 CC1350DK_7XD_DIO22
|
||||
|
||||
#define Board_initGeneral() { \
|
||||
Power_init(); \
|
||||
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
|
||||
{System_abort("Error with PIN_init\n"); \
|
||||
} \
|
||||
}
|
||||
#define Board_DIO23_ANALOG CC1350DK_7XD_DIO23_ANALOG
|
||||
#define Board_DIO24_ANALOG CC1350DK_7XD_DIO24_ANALOG
|
||||
#define Board_DIO25_ANALOG CC1350DK_7XD_DIO25_ANALOG
|
||||
#define Board_DIO26_ANALOG CC1350DK_7XD_DIO26_ANALOG
|
||||
#define Board_DIO27_ANALOG CC1350DK_7XD_DIO27_ANALOG
|
||||
#define Board_DIO28_ANALOG CC1350DK_7XD_DIO28_ANALOG
|
||||
#define Board_DIO29_ANALOG CC1350DK_7XD_DIO29_ANALOG
|
||||
#define Board_DIO30_ANALOG CC1350DK_7XD_DIO30_ANALOG
|
||||
|
||||
#define Board_initGPIO()
|
||||
#define Board_initPWM() PWM_init()
|
||||
#define Board_initSPI() SPI_init()
|
||||
#define Board_initUART() UART_init()
|
||||
#define Board_initWatchdog() Watchdog_init()
|
||||
#define Board_initADCBuf() ADCBuf_init()
|
||||
#define Board_initADC() ADC_init()
|
||||
#define GPIO_toggle(n)
|
||||
#define GPIO_write(n,m)
|
||||
#define Board_GPIO_BTN0 CC1350DK_7XD_PIN_KEY_SELECT
|
||||
#define Board_GPIO_BTN1 CC1350DK_7XD_PIN_KEY_UP
|
||||
#define Board_GPIO_BTN2 CC1350DK_7XD_PIN_KEY_DOWN
|
||||
#define Board_GPIO_BTN3 CC1350DK_7XD_PIN_KEY_LEFT
|
||||
#define Board_GPIO_BTN4 CC1350DK_7XD_PIN_KEY_RIGHT
|
||||
#define Board_GPIO_LED0 CC1350DK_7XD_PIN_LED1
|
||||
#define Board_GPIO_LED1 CC1350DK_7XD_PIN_LED2
|
||||
#define Board_GPIO_LED2 CC1350DK_7XD_PIN_LED3
|
||||
#define Board_GPIO_LED3 CC1350DK_7XD_PIN_LED4
|
||||
#define Board_GPIO_LED_ON CC1350DK_7XD_GPIO_LED_ON
|
||||
#define Board_GPIO_LED_OFF CC1350DK_7XD_GPIO_LED_OFF
|
||||
|
||||
#define Board_GPTIMER0A CC1350DK_7XD_GPTIMER0A
|
||||
#define Board_GPTIMER0B CC1350DK_7XD_GPTIMER0B
|
||||
#define Board_GPTIMER1A CC1350DK_7XD_GPTIMER1A
|
||||
#define Board_GPTIMER1B CC1350DK_7XD_GPTIMER1B
|
||||
#define Board_GPTIMER2A CC1350DK_7XD_GPTIMER2A
|
||||
#define Board_GPTIMER2B CC1350DK_7XD_GPTIMER2B
|
||||
#define Board_GPTIMER3A CC1350DK_7XD_GPTIMER3A
|
||||
#define Board_GPTIMER3B CC1350DK_7XD_GPTIMER3B
|
||||
|
||||
#define Board_I2C0 CC1350DK_7XD_I2C0
|
||||
|
||||
#define Board_NVSINTERNAL CC1350DK_7XD_NVSCC26XX0
|
||||
|
||||
#define Board_KEY_SELECT CC1350DK_7XD_PIN_KEY_SELECT
|
||||
#define Board_KEY_UP CC1350DK_7XD_PIN_KEY_UP
|
||||
#define Board_KEY_DOWN CC1350DK_7XD_PIN_KEY_DOWN
|
||||
#define Board_KEY_LEFT CC1350DK_7XD_PIN_KEY_LEFT
|
||||
#define Board_KEY_RIGHT CC1350DK_7XD_PIN_KEY_RIGHT
|
||||
|
||||
#define Board_PIN_BUTTON0 CC1350DK_7XD_PIN_KEY_SELECT
|
||||
#define Board_PIN_BUTTON1 CC1350DK_7XD_PIN_KEY_UP
|
||||
#define Board_PIN_BUTTON2 CC1350DK_7XD_PIN_KEY_DOWN
|
||||
#define Board_PIN_BUTTON3 CC1350DK_7XD_PIN_KEY_LEFT
|
||||
#define Board_PIN_BUTTON4 CC1350DK_7XD_PIN_KEY_RIGHT
|
||||
#define Board_PIN_BTN1 CC1350DK_7XD_PIN_KEY_SELECT
|
||||
#define Board_PIN_BTN2 CC1350DK_7XD_PIN_KEY_UP
|
||||
#define Board_PIN_BTN3 CC1350DK_7XD_PIN_KEY_DOWN
|
||||
#define Board_PIN_BTN4 CC1350DK_7XD_PIN_KEY_LEFT
|
||||
#define Board_PIN_BTN5 CC1350DK_7XD_PIN_KEY_RIGHT
|
||||
#define Board_PIN_LED0 CC1350DK_7XD_PIN_LED1
|
||||
#define Board_PIN_LED1 CC1350DK_7XD_PIN_LED2
|
||||
#define Board_PIN_LED2 CC1350DK_7XD_PIN_LED3
|
||||
#define Board_PIN_LED3 CC1350DK_7XD_PIN_LED4
|
||||
|
||||
#define Board_PWM0 CC1350DK_7XD_PWM0
|
||||
#define Board_PWM1 CC1350DK_7XD_PWM1
|
||||
#define Board_PWM2 CC1350DK_7XD_PWM2
|
||||
#define Board_PWM3 CC1350DK_7XD_PWM3
|
||||
#define Board_PWM4 CC1350DK_7XD_PWM4
|
||||
#define Board_PWM5 CC1350DK_7XD_PWM5
|
||||
#define Board_PWM6 CC1350DK_7XD_PWM6
|
||||
#define Board_PWM7 CC1350DK_7XD_PWM7
|
||||
|
||||
#define Board_SD0 CC1350DK_7XD_SDSPI0
|
||||
|
||||
#define Board_SPI0 CC1350DK_7XD_SPI0
|
||||
#define Board_SPI1 CC1350DK_7XD_SPI1
|
||||
#define Board_FLASH_CS_ON 0
|
||||
#define Board_FLASH_CS_OFF 1
|
||||
|
||||
#define Board_SPI_MASTER CC1350DK_7XD_SPI0
|
||||
#define Board_SPI_SLAVE CC1350DK_7XD_SPI0
|
||||
#define Board_SPI_MASTER_READY CC1350DK_7XD_SPI_MASTER_READY
|
||||
#define Board_SPI_SLAVE_READY CC1350DK_7XD_SPI_SLAVE_READY
|
||||
|
||||
#define Board_UART0 CC1350DK_7XD_UART0
|
||||
|
||||
#define Board_WATCHDOG0 CC1350DK_7XD_WATCHDOG0
|
||||
|
||||
#define Board_SDCARD_CS CC1350DK_7XD_SDCARD_CS
|
||||
|
||||
#define Board_LCD_MODE CC1350DK_7XD_LCD_MODE
|
||||
#define Board_LCD_RST CC1350DK_7XD_LCD_RST
|
||||
#define Board_LCD_CS CC1350DK_7XD_LCD_CS
|
||||
|
||||
#define Board_ALS_OUT CC1350DK_7XD_ALS_OUT
|
||||
#define Board_ALS_PWR CC1350DK_7XD_ALS_PWR
|
||||
|
||||
#define Board_ACC_PWR CC1350DK_7XD_ACC_PWR
|
||||
#define Board_ACC_CS CC1350DK_7XD_ACC_CS
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,670 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================== CC1310DK_7XD.c =============================================
|
||||
* This file is responsible for setting up the board specific items for the
|
||||
* SRF06EB with the CC1310EM_7XD_7793 board.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ====================== Includes ============================================
|
||||
*/
|
||||
#include <xdc/std.h>
|
||||
#include <xdc/runtime/System.h>
|
||||
|
||||
#include <ti/sysbios/family/arm/m3/Hwi.h>
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
#include <ti/drivers/PWM.h>
|
||||
#include <ti/drivers/pwm/PWMTimerCC26XX.h>
|
||||
#include <ti/drivers/timer/GPTimerCC26XX.h>
|
||||
#include <ti/drivers/Power.h>
|
||||
#include <ti/drivers/power/PowerCC26XX.h>
|
||||
|
||||
#include <inc/hw_memmap.h>
|
||||
#include <inc/hw_ints.h>
|
||||
#include <driverlib/ioc.h>
|
||||
#include <driverlib/udma.h>
|
||||
|
||||
#include <Board.h>
|
||||
|
||||
/*
|
||||
* ========================= IO driver initialization =========================
|
||||
* From main, PIN_init(BoardGpioInitTable) should be called to setup safe
|
||||
* settings for this board.
|
||||
* When a pin is allocated and then de-allocated, it will revert to the state
|
||||
* configured in this table.
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(BoardGpioInitTable, ".const:BoardGpioInitTable")
|
||||
#pragma DATA_SECTION(PINCC26XX_hwAttrs, ".const:PINCC26XX_hwAttrs")
|
||||
#endif
|
||||
|
||||
const PIN_Config BoardGpioInitTable[] = {
|
||||
|
||||
Board_DK_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
Board_DK_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
Board_DK_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
Board_DK_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
Board_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_KEY_RIGHT | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_3V3_EN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* 3V3 domain off initially */
|
||||
Board_LCD_MODE | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* LCD pin high initially */
|
||||
Board_LCD_RST | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* LCD pin high initially */
|
||||
Board_LCD_CSN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* LCD CSn deasserted initially */
|
||||
Board_ALS_PWR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* ALS power off initially */
|
||||
Board_ACC_PWR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* ACC power off initially */
|
||||
Board_ACC_CSN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* ACC CSn deasserted initially */
|
||||
Board_SDCARD_CSN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* SDCARD CSn deasserted initially */
|
||||
Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX pin at inactive level */
|
||||
PIN_TERMINATE /* Terminate list */
|
||||
};
|
||||
|
||||
const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0
|
||||
};
|
||||
/*============================================================================*/
|
||||
|
||||
/*
|
||||
* ============================= Power begin ===================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(PowerCC26XX_config, ".const:PowerCC26XX_config")
|
||||
#endif
|
||||
const PowerCC26XX_Config PowerCC26XX_config = {
|
||||
.policyInitFxn = NULL,
|
||||
.policyFxn = &PowerCC26XX_standbyPolicy,
|
||||
.calibrateFxn = &PowerCC26XX_calibrate,
|
||||
.enablePolicy = TRUE,
|
||||
.calibrateRCOSC_LF = TRUE,
|
||||
.calibrateRCOSC_HF = TRUE,
|
||||
};
|
||||
/*
|
||||
* ============================= Power end ===================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ============================= UART begin ===================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(UART_config, ".const:UART_config")
|
||||
#pragma DATA_SECTION(uartCC26XXHWAttrs, ".const:uartCC26XXHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/UART.h>
|
||||
#include <ti/drivers/uart/UARTCC26XX.h>
|
||||
|
||||
/* UART objects */
|
||||
UARTCC26XX_Object uartCC26XXObjects[CC1310DK_7XD_UARTCOUNT];
|
||||
unsigned char uartCC26XXRingBuffer[CC1310DK_7XD_UARTCOUNT][32];
|
||||
|
||||
/* UART hardware parameter structure, also used to assign UART pins */
|
||||
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1310DK_7XD_UARTCOUNT] = {
|
||||
{
|
||||
.baseAddr = UART0_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_UART0,
|
||||
.intNum = INT_UART0_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.txPin = Board_UART_TX,
|
||||
.rxPin = Board_UART_RX,
|
||||
.ctsPin = PIN_UNASSIGNED,
|
||||
.rtsPin = PIN_UNASSIGNED,
|
||||
.ringBufPtr = uartCC26XXRingBuffer[0],
|
||||
.ringBufSize = sizeof(uartCC26XXRingBuffer[0])
|
||||
}
|
||||
};
|
||||
|
||||
/* UART configuration structure */
|
||||
const UART_Config UART_config[] = {
|
||||
{
|
||||
.fxnTablePtr = &UARTCC26XX_fxnTable,
|
||||
.object = &uartCC26XXObjects[0],
|
||||
.hwAttrs = &uartCC26XXHWAttrs[0]
|
||||
},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/*
|
||||
* ============================= UART end =====================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ============================= UDMA begin ===================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(UDMACC26XX_config, ".const:UDMACC26XX_config")
|
||||
#pragma DATA_SECTION(udmaHWAttrs, ".const:udmaHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/dma/UDMACC26XX.h>
|
||||
|
||||
/* UDMA objects */
|
||||
UDMACC26XX_Object udmaObjects[CC1310DK_7XD_UDMACOUNT];
|
||||
|
||||
/* UDMA configuration structure */
|
||||
const UDMACC26XX_HWAttrs udmaHWAttrs[CC1310DK_7XD_UDMACOUNT] = {
|
||||
{
|
||||
.baseAddr = UDMA0_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_UDMA,
|
||||
.intNum = INT_DMA_ERR,
|
||||
.intPriority = ~0
|
||||
}
|
||||
};
|
||||
|
||||
/* UDMA configuration structure */
|
||||
const UDMACC26XX_Config UDMACC26XX_config[] = {
|
||||
{
|
||||
.object = &udmaObjects[0],
|
||||
.hwAttrs = &udmaHWAttrs[0]
|
||||
},
|
||||
{NULL, NULL}
|
||||
};
|
||||
/*
|
||||
* ============================= UDMA end =====================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ========================== SPI DMA begin ===================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
|
||||
#pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/spi/SPICC26XXDMA.h>
|
||||
|
||||
/* SPI objects */
|
||||
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1310DK_7XD_SPICOUNT];
|
||||
|
||||
/* SPI configuration structure, describing which pins are to be used */
|
||||
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310DK_7XD_SPICOUNT] = {
|
||||
{
|
||||
.baseAddr = SSI0_BASE,
|
||||
.intNum = INT_SSI0_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.defaultTxBufValue = 0,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
|
||||
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
|
||||
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
|
||||
.mosiPin = Board_SPI0_MOSI,
|
||||
.misoPin = Board_SPI0_MISO,
|
||||
.clkPin = Board_SPI0_CLK,
|
||||
.csnPin = Board_SPI0_CSN
|
||||
},
|
||||
{
|
||||
.baseAddr = SSI1_BASE,
|
||||
.intNum = INT_SSI1_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.defaultTxBufValue = 0,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_SSI1,
|
||||
.rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
|
||||
.txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
|
||||
.mosiPin = Board_SPI1_MOSI,
|
||||
.misoPin = Board_SPI1_MISO,
|
||||
.clkPin = Board_SPI1_CLK,
|
||||
.csnPin = Board_SPI1_CSN
|
||||
}
|
||||
};
|
||||
|
||||
/* SPI configuration structure */
|
||||
const SPI_Config SPI_config[] = {
|
||||
{
|
||||
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
|
||||
.object = &spiCC26XXDMAObjects[0],
|
||||
.hwAttrs = &spiCC26XXDMAHWAttrs[0]
|
||||
},
|
||||
{
|
||||
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
|
||||
.object = &spiCC26XXDMAObjects[1],
|
||||
.hwAttrs = &spiCC26XXDMAHWAttrs[1]
|
||||
},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/*
|
||||
* ========================== SPI DMA end =====================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ========================== LCD begin =======================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(LCD_config, ".const:LCD_config")
|
||||
#pragma DATA_SECTION(lcdHWAttrs, ".const:lcdHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include lcd middleware */
|
||||
#include <ti/mw/lcd/LCDDogm1286.h>
|
||||
|
||||
/* LCD object */
|
||||
LCD_Object lcdObject;
|
||||
|
||||
/* LCD hardware attribute structure */
|
||||
const LCD_HWAttrs lcdHWAttrs = {
|
||||
.LCD_initCmd = &LCD_initCmd,
|
||||
.lcdResetPin = Board_LCD_RST, /* LCD reset pin */
|
||||
.lcdModePin = Board_LCD_MODE, /* LCD mode pin */
|
||||
.lcdCsnPin = Board_LCD_CSN, /* LCD CSn pin */
|
||||
.spiIndex = Board_SPI0
|
||||
};
|
||||
|
||||
/* LCD configuration structure */
|
||||
const LCD_Config LCD_config = {
|
||||
.object = &lcdObject,
|
||||
.hwAttrs = &lcdHWAttrs
|
||||
};
|
||||
/*
|
||||
* ========================== LCD end =========================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ========================== Crypto begin ====================================
|
||||
* NOTE: The Crypto implementation should be considered experimental
|
||||
* and not validated!
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(CryptoCC26XX_config, ".const:CryptoCC26XX_config")
|
||||
#pragma DATA_SECTION(cryptoCC26XXHWAttrs, ".const:cryptoCC26XXHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/crypto/CryptoCC26XX.h>
|
||||
|
||||
/* Crypto objects */
|
||||
CryptoCC26XX_Object cryptoCC26XXObjects[CC1310DK_7XD_CRYPTOCOUNT];
|
||||
|
||||
/* Crypto configuration structure, describing which pins are to be used */
|
||||
const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1310DK_7XD_CRYPTOCOUNT] = {
|
||||
{
|
||||
.baseAddr = CRYPTO_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
|
||||
.intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
|
||||
.intPriority = ~0,
|
||||
}
|
||||
};
|
||||
|
||||
/* Crypto configuration structure */
|
||||
const CryptoCC26XX_Config CryptoCC26XX_config[] = {
|
||||
{
|
||||
.object = &cryptoCC26XXObjects[0],
|
||||
.hwAttrs = &cryptoCC26XXHWAttrs[0]
|
||||
},
|
||||
{NULL, NULL}
|
||||
};
|
||||
/*
|
||||
* ========================== Crypto end =========================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ========================= RF driver begin ==============================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(RFCC26XX_hwAttrs, ".const:RFCC26XX_hwAttrs")
|
||||
#endif
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/rf/RF.h>
|
||||
|
||||
/* RF hwi and swi priority */
|
||||
const RFCC26XX_HWAttrs RFCC26XX_hwAttrs = {
|
||||
.hwiCpe0Priority = ~0,
|
||||
.hwiHwPriority = ~0,
|
||||
.swiCpe0Priority = 0,
|
||||
.swiHwPriority = 0,
|
||||
};
|
||||
|
||||
/*
|
||||
* ========================== RF driver end =========================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ========================= Display begin ====================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(Display_config, ".const:Display_config")
|
||||
#pragma DATA_SECTION(displayDogm1286HWattrs, ".const:displayDogm1286HWAttrs")
|
||||
#pragma DATA_SECTION(displayUartHWAttrs, ".const:displayUartHWAttrs")
|
||||
#endif
|
||||
|
||||
#include <ti/mw/display/Display.h>
|
||||
#include <ti/mw/display/DisplayDogm1286.h>
|
||||
#include <ti/mw/display/DisplayUart.h>
|
||||
|
||||
/* Structures for UartPlain Blocking */
|
||||
DisplayUart_Object displayUartObject;
|
||||
|
||||
#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
|
||||
#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
|
||||
#endif
|
||||
static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
|
||||
|
||||
const DisplayUart_HWAttrs displayUartHWAttrs = {
|
||||
.uartIdx = Board_UART,
|
||||
.baudRate = 115200,
|
||||
.mutexTimeout = BIOS_WAIT_FOREVER,
|
||||
.strBuf = uartStringBuf,
|
||||
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
|
||||
};
|
||||
|
||||
/* Structures for DOGM1286 */
|
||||
DisplayDogm1286_Object displayDogm1286Object;
|
||||
|
||||
const DisplayDogm1286_HWAttrs displayDogm1286HWattrs = {
|
||||
.lcdHandle = (LCD_Handle) & LCD_config,
|
||||
.powerPin = Board_3V3_EN
|
||||
};
|
||||
|
||||
/* Array of displays */
|
||||
const Display_Config Display_config[] = {
|
||||
#if !defined(BOARD_DISPLAY_EXCLUDE_UART)
|
||||
{
|
||||
.fxnTablePtr = &DisplayUart_fxnTable,
|
||||
.object = &displayUartObject,
|
||||
.hwAttrs = &displayUartHWAttrs,
|
||||
},
|
||||
#endif
|
||||
#if !defined(BOARD_DISPLAY_EXCLUDE_LCD)
|
||||
{
|
||||
.fxnTablePtr = &DisplayDogm1286_fxnTable,
|
||||
.object = &displayDogm1286Object,
|
||||
.hwAttrs = &displayDogm1286HWattrs
|
||||
},
|
||||
#endif
|
||||
{ NULL, NULL, NULL } // Terminator
|
||||
};
|
||||
|
||||
/*
|
||||
* ========================= Display end ======================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* ============================ GPTimer begin =================================
|
||||
* Remove unused entries to reduce flash usage both in Board.c and Board.h
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(GPTimerCC26XX_config, ".const:GPTimerCC26XX_config")
|
||||
#pragma DATA_SECTION(gptimerCC26xxHWAttrs, ".const:gptimerCC26xxHWAttrs")
|
||||
#endif
|
||||
|
||||
/* GPTimer hardware attributes, one per timer part (Timer 0A, 0B, 1A, 1B..) */
|
||||
const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1310DK_7XD_GPTIMERPARTSCOUNT] = {
|
||||
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
|
||||
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
|
||||
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
|
||||
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
|
||||
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
|
||||
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
|
||||
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
|
||||
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
|
||||
};
|
||||
|
||||
/* GPTimer objects, one per full-width timer (A+B) (Timer 0, Timer 1..) */
|
||||
GPTimerCC26XX_Object gptimerCC26XXObjects[CC1310DK_7XD_GPTIMERCOUNT];
|
||||
|
||||
/* GPTimer configuration (used as GPTimer_Handle by driver and application) */
|
||||
const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1310DK_7XD_GPTIMERPARTSCOUNT] = {
|
||||
{ &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[0], GPT_A },
|
||||
{ &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[1], GPT_B },
|
||||
{ &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[2], GPT_A },
|
||||
{ &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[3], GPT_B },
|
||||
{ &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[4], GPT_A },
|
||||
{ &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[5], GPT_B },
|
||||
{ &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[6], GPT_A },
|
||||
{ &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[7], GPT_B },
|
||||
};
|
||||
|
||||
/*
|
||||
* ============================ GPTimer end ===================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ============================= PWM begin ====================================
|
||||
* Remove unused entries to reduce flash usage both in Board.c and Board.h
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(PWM_config, ".const:PWM_config")
|
||||
#pragma DATA_SECTION(pwmtimerCC26xxHWAttrs, ".const:pwmtimerCC26xxHWAttrs")
|
||||
#endif
|
||||
|
||||
/* PWM configuration, one per PWM output. */
|
||||
PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1310DK_7XD_PWMCOUNT] = {
|
||||
{ .pwmPin = Board_PWMPIN0, .gpTimerUnit = Board_GPTIMER0A },
|
||||
{ .pwmPin = Board_PWMPIN1, .gpTimerUnit = Board_GPTIMER0B },
|
||||
{ .pwmPin = Board_PWMPIN2, .gpTimerUnit = Board_GPTIMER1A },
|
||||
{ .pwmPin = Board_PWMPIN3, .gpTimerUnit = Board_GPTIMER1B },
|
||||
{ .pwmPin = Board_PWMPIN4, .gpTimerUnit = Board_GPTIMER2A },
|
||||
{ .pwmPin = Board_PWMPIN5, .gpTimerUnit = Board_GPTIMER2B },
|
||||
{ .pwmPin = Board_PWMPIN6, .gpTimerUnit = Board_GPTIMER3A },
|
||||
{ .pwmPin = Board_PWMPIN7, .gpTimerUnit = Board_GPTIMER3B },
|
||||
};
|
||||
|
||||
/* PWM object, one per PWM output */
|
||||
PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1310DK_7XD_PWMCOUNT];
|
||||
|
||||
extern const PWM_FxnTable PWMTimerCC26XX_fxnTable;
|
||||
|
||||
/* PWM configuration (used as PWM_Handle by driver and application) */
|
||||
const PWM_Config PWM_config[CC1310DK_7XD_PWMCOUNT + 1] = {
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[0], &pwmtimerCC26xxHWAttrs[0] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[1], &pwmtimerCC26xxHWAttrs[1] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[2], &pwmtimerCC26xxHWAttrs[2] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[3], &pwmtimerCC26xxHWAttrs[3] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[4], &pwmtimerCC26xxHWAttrs[4] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[5], &pwmtimerCC26xxHWAttrs[5] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[6], &pwmtimerCC26xxHWAttrs[6] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[7], &pwmtimerCC26xxHWAttrs[7] },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ============================= PWM end ======================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ========================== ADCBuf begin =========================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(ADCBuf_config, ".const:ADCBuf_config")
|
||||
#pragma DATA_SECTION(adcBufCC26xxHWAttrs, ".const:adcBufCC26xxHWAttrs")
|
||||
#pragma DATA_SECTION(ADCBufCC26XX_adcChannelLut, ".const:ADCBufCC26XX_adcChannelLut")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/ADCBuf.h>
|
||||
#include <ti/drivers/adcbuf/ADCBufCC26XX.h>
|
||||
|
||||
/* ADC objects */
|
||||
ADCBufCC26XX_Object adcBufCC26xxObjects[CC1310DK_7XD_ADCBufCOUNT];
|
||||
|
||||
/*
|
||||
* This table converts a virtual adc channel into a dio and internal analogue input signal.
|
||||
* This table is necessary for the functioning of the adcBuf driver.
|
||||
* Comment out unused entries to save flash.
|
||||
* Dio and internal signal pairs are hardwired. Do not remap them in the table. You may reorder entire entries though.
|
||||
* The mapping of dio and internal signals is package dependent.
|
||||
*/
|
||||
const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[] = {
|
||||
{Board_ALS_OUT, ADC_COMPB_IN_AUXIO7},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}
|
||||
};
|
||||
|
||||
const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC1310DK_7XD_ADCBufCOUNT] = {
|
||||
{
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.adcChannelLut = ADCBufCC26XX_adcChannelLut,
|
||||
.gpTimerUnit = Board_GPTIMER0A,
|
||||
.gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A,
|
||||
}
|
||||
};
|
||||
|
||||
const ADCBuf_Config ADCBuf_config[] = {
|
||||
{&ADCBufCC26XX_fxnTable, &adcBufCC26xxObjects[0], &adcBufCC26xxHWAttrs[0]},
|
||||
{NULL, NULL, NULL},
|
||||
};
|
||||
/*
|
||||
* ========================== ADCBuf end =========================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ========================== ADC begin =========================================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(ADC_config, ".const:ADC_config")
|
||||
#pragma DATA_SECTION(adcCC26xxHWAttrs, ".const:adcCC26xxHWAttrs")
|
||||
#endif
|
||||
|
||||
/* Include drivers */
|
||||
#include <ti/drivers/ADC.h>
|
||||
#include <ti/drivers/adc/ADCCC26XX.h>
|
||||
|
||||
|
||||
/* ADC objects */
|
||||
ADCCC26XX_Object adcCC26xxObjects[CC1310DK_7XD_ADCCOUNT];
|
||||
|
||||
|
||||
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1310DK_7XD_ADCCOUNT] = {
|
||||
{
|
||||
.adcDIO = Board_ALS_OUT,
|
||||
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_DCOUPL,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_VSS,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_VDDS,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
|
||||
}
|
||||
};
|
||||
|
||||
const ADC_Config ADC_config[] = {
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[0], &adcCC26xxHWAttrs[0]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[1], &adcCC26xxHWAttrs[1]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[2], &adcCC26xxHWAttrs[2]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[3], &adcCC26xxHWAttrs[3]},
|
||||
{NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
/*
|
||||
* ========================== ADC end =========================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* =============================== Watchdog ===============================
|
||||
*/
|
||||
/* Place into subsections to allow the TI linker to remove items properly */
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
#pragma DATA_SECTION(Watchdog_config, ".const:Watchdog_config")
|
||||
#pragma DATA_SECTION(watchdogCC26XXHWAttrs, ".const:watchdogCC26XXHWAttrs")
|
||||
#endif
|
||||
|
||||
#include <ti/drivers/Watchdog.h>
|
||||
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
|
||||
|
||||
WatchdogCC26XX_Object watchdogCC26XXObjects[CC1310DK_7XD_WATCHDOGCOUNT];
|
||||
|
||||
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1310DK_7XD_WATCHDOGCOUNT] = {
|
||||
{
|
||||
.baseAddr = WDT_BASE,
|
||||
.intNum = INT_WDT_IRQ,
|
||||
.reloadValue = 1000 /* Reload value in milliseconds */
|
||||
},
|
||||
};
|
||||
|
||||
const Watchdog_Config Watchdog_config[] = {
|
||||
{
|
||||
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
|
||||
.object = &watchdogCC26XXObjects[0],
|
||||
.hwAttrs = &watchdogCC26XXHWAttrs[0]
|
||||
},
|
||||
{NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
/*
|
||||
* ======== CC26XX_LAUNCHXL_initWatchdog ========
|
||||
*/
|
||||
void CC26XX_LAUNCHXL_initWatchdog(void)
|
||||
{
|
||||
Watchdog_init();
|
||||
}
|
@ -1,289 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
/** ============================================================================
|
||||
* @file CC1310DK_7XD.h
|
||||
*
|
||||
* @brief CC1310EM_7XD_7793 Board Specific header file.
|
||||
* The project options should point to this file if this is the
|
||||
* CC1310EM you are developing code for.
|
||||
*
|
||||
* The CC1310 header file should be included in an application as follows:
|
||||
* @code
|
||||
* #include <Board.h>
|
||||
* @endcode
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
#ifndef __CC1310EM_7XD_7793_H__
|
||||
#define __CC1310EM_7XD_7793_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** ============================================================================
|
||||
* Symbol by generic Board.c to include the correct kit specific Board.c
|
||||
* ==========================================================================*/
|
||||
#define CC1310EM_7XD_7793
|
||||
#define CC1310DK_7XD
|
||||
|
||||
|
||||
/** ============================================================================
|
||||
* Includes
|
||||
* ==========================================================================*/
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <driverlib/ioc.h>
|
||||
|
||||
/** ============================================================================
|
||||
* Externs
|
||||
* ==========================================================================*/
|
||||
extern const PIN_Config BoardGpioInitTable[];
|
||||
|
||||
/** ============================================================================
|
||||
* Defines
|
||||
* ==========================================================================*/
|
||||
|
||||
/* Mapping of pins to board signals using general board aliases
|
||||
* <board signal alias> <pin mapping> <comments>
|
||||
*/
|
||||
/* Leds */
|
||||
#define Board_LED_ON 1 /* LEDs on SmartRF06 EB are active high */
|
||||
#define Board_LED_OFF 0
|
||||
#define Board_DK_LED1 IOID_25 /* P2.11 */
|
||||
#define Board_DK_LED2 IOID_27 /* P2.13 */
|
||||
#define Board_DK_LED3 IOID_7 /* P1.2 */
|
||||
#define Board_DK_LED4 IOID_6 /* P1.4 */
|
||||
/* Button Board */
|
||||
#define Board_KEY_SELECT IOID_11 /* P1.14 */
|
||||
#define Board_KEY_UP IOID_19 /* P1.10 */
|
||||
#define Board_KEY_DOWN IOID_12 /* P1.12 */
|
||||
#define Board_KEY_LEFT IOID_15 /* P1.6 */
|
||||
#define Board_KEY_RIGHT IOID_18 /* P1.8 */
|
||||
/* LCD Board */
|
||||
#define Board_LCD_MODE IOID_4 /* P1.11 */
|
||||
#define Board_LCD_RST IOID_5 /* P1.13 */
|
||||
#define Board_LCD_CSN IOID_14 /* P1.17 */
|
||||
/* UART Board */
|
||||
#define Board_UART_RX IOID_2 /* P1.7 */
|
||||
#define Board_UART_TX IOID_3 /* P1.9 */
|
||||
#define Board_UART_CTS IOID_22 /* P1.3 */
|
||||
#define Board_UART_RTS IOID_21 /* P2.18 */
|
||||
/* SPI Board */
|
||||
#define Board_SPI0_MISO IOID_8 /* P1.20 */
|
||||
#define Board_SPI0_MOSI IOID_9 /* P1.18 */
|
||||
#define Board_SPI0_CLK IOID_10 /* P1.16 */
|
||||
#define Board_SPI0_CSN PIN_UNASSIGNED /* P1.14, separate CSn for LCD, SDCARD, and ACC */
|
||||
#define Board_SPI1_MISO IOID_24 /* RF2.10 for testing only */
|
||||
#define Board_SPI1_MOSI IOID_23 /* RF2.5 for testing only */
|
||||
#define Board_SPI1_CLK IOID_30 /* RF2.12 for testing only */
|
||||
#define Board_SPI1_CSN PIN_UNASSIGNED /* RF2.6 for testing only */
|
||||
/* Ambient Light Sensor */
|
||||
#define Board_ALS_OUT IOID_23 /* P2.5 */
|
||||
#define Board_ALS_PWR IOID_26 /* P2.6 */
|
||||
/* Accelerometer */
|
||||
#define Board_ACC_PWR IOID_20 /* P2.8 */
|
||||
#define Board_ACC_CSN IOID_24 /* P2.10 */
|
||||
/* SD Card */
|
||||
#define Board_SDCARD_CSN IOID_30 /* P2.12 */
|
||||
/* Power Board */
|
||||
#define Board_3V3_EN IOID_13 /* P1.15 */
|
||||
/* PWM outputs */
|
||||
#define Board_PWMPIN0 Board_DK_LED1
|
||||
#define Board_PWMPIN1 Board_DK_LED2
|
||||
#define Board_PWMPIN2 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN3 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN4 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN5 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN6 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN7 PIN_UNASSIGNED
|
||||
/* Analog capable DIO's */
|
||||
#define Board_DIO23_ANALOG IOID_23
|
||||
#define Board_DIO24_ANALOG IOID_24
|
||||
#define Board_DIO25_ANALOG IOID_25
|
||||
#define Board_DIO26_ANALOG IOID_26
|
||||
#define Board_DIO27_ANALOG IOID_27
|
||||
#define Board_DIO28_ANALOG IOID_28
|
||||
#define Board_DIO29_ANALOG IOID_29
|
||||
#define Board_DIO30_ANALOG IOID_30
|
||||
|
||||
/** ============================================================================
|
||||
* Instance identifiers
|
||||
* ==========================================================================*/
|
||||
/* Generic SPI instance identifiers */
|
||||
#define Board_SPI0 CC1310DK_7XD_SPI0
|
||||
/* Generic UART instance identifiers */
|
||||
#define Board_UART CC1310DK_7XD_UART0
|
||||
/* Generic Crypto instance identifiers */
|
||||
#define Board_CRYPTO CC1310DK_7XD_CRYPTO0
|
||||
/* Generic GPTimer instance identifiers */
|
||||
#define Board_GPTIMER0A CC1310DK_7XD_GPTIMER0A
|
||||
#define Board_GPTIMER0B CC1310DK_7XD_GPTIMER0B
|
||||
#define Board_GPTIMER1A CC1310DK_7XD_GPTIMER1A
|
||||
#define Board_GPTIMER1B CC1310DK_7XD_GPTIMER1B
|
||||
#define Board_GPTIMER2A CC1310DK_7XD_GPTIMER2A
|
||||
#define Board_GPTIMER2B CC1310DK_7XD_GPTIMER2B
|
||||
#define Board_GPTIMER3A CC1310DK_7XD_GPTIMER3A
|
||||
#define Board_GPTIMER3B CC1310DK_7XD_GPTIMER3B
|
||||
/* Generic PWM instance identifiers */
|
||||
#define Board_PWM0 CC1310DK_7XD_PWM0
|
||||
#define Board_PWM1 CC1310DK_7XD_PWM1
|
||||
#define Board_PWM2 CC1310DK_7XD_PWM2
|
||||
#define Board_PWM3 CC1310DK_7XD_PWM3
|
||||
#define Board_PWM4 CC1310DK_7XD_PWM4
|
||||
#define Board_PWM5 CC1310DK_7XD_PWM5
|
||||
#define Board_PWM6 CC1310DK_7XD_PWM6
|
||||
#define Board_PWM7 CC1310DK_7XD_PWM7
|
||||
|
||||
/** ============================================================================
|
||||
* Number of peripherals and their names
|
||||
* ==========================================================================*/
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_CryptoName
|
||||
* @brief Enum of Crypto names on the CC1310 dev board
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_CryptoName {
|
||||
CC1310DK_7XD_CRYPTO0 = 0,
|
||||
CC1310DK_7XD_CRYPTOCOUNT
|
||||
} CC1310DK_7XD_CryptoName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_SPIName
|
||||
* @brief Enum of SPI names on the CC1310 dev board
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_SPIName {
|
||||
CC1310DK_7XD_SPI0 = 0,
|
||||
CC1310DK_7XD_SPI1,
|
||||
CC1310DK_7XD_SPICOUNT
|
||||
} CC1310DK_7XD_SPIName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_UARTName
|
||||
* @brief Enum of UARTs on the CC1310 dev board
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_UARTName {
|
||||
CC1310DK_7XD_UART0 = 0,
|
||||
CC1310DK_7XD_UARTCOUNT
|
||||
} CC1310DK_7XD_UARTName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_UdmaName
|
||||
* @brief Enum of DMA buffers
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_UdmaName {
|
||||
CC1310DK_7XD_UDMA0 = 0,
|
||||
CC1310DK_7XD_UDMACOUNT
|
||||
} CC1310DK_7XD_UdmaName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_GPTimerName
|
||||
* @brief Enum of GPTimer parts
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_GPTimerName
|
||||
{
|
||||
CC1310DK_7XD_GPTIMER0A = 0,
|
||||
CC1310DK_7XD_GPTIMER0B,
|
||||
CC1310DK_7XD_GPTIMER1A,
|
||||
CC1310DK_7XD_GPTIMER1B,
|
||||
CC1310DK_7XD_GPTIMER2A,
|
||||
CC1310DK_7XD_GPTIMER2B,
|
||||
CC1310DK_7XD_GPTIMER3A,
|
||||
CC1310DK_7XD_GPTIMER3B,
|
||||
CC1310DK_7XD_GPTIMERPARTSCOUNT
|
||||
} CC1310DK_7XD_GPTimerName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_GPTimers
|
||||
* @brief Enum of GPTimers
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_GPTimers
|
||||
{
|
||||
CC1310DK_7XD_GPTIMER0 = 0,
|
||||
CC1310DK_7XD_GPTIMER1,
|
||||
CC1310DK_7XD_GPTIMER2,
|
||||
CC1310DK_7XD_GPTIMER3,
|
||||
CC1310DK_7XD_GPTIMERCOUNT
|
||||
} CC1310DK_7XD_GPTimers;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_PWM
|
||||
* @brief Enum of PWM outputs on the board
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_PWM
|
||||
{
|
||||
CC1310DK_7XD_PWM0 = 0,
|
||||
CC1310DK_7XD_PWM1,
|
||||
CC1310DK_7XD_PWM2,
|
||||
CC1310DK_7XD_PWM3,
|
||||
CC1310DK_7XD_PWM4,
|
||||
CC1310DK_7XD_PWM5,
|
||||
CC1310DK_7XD_PWM6,
|
||||
CC1310DK_7XD_PWM7,
|
||||
CC1310DK_7XD_PWMCOUNT
|
||||
} CC1310DK_7XD_PWM;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD__ADCBufName
|
||||
* @brief Enum of ADC's
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_ADCBufName {
|
||||
CC1310DK_7XD_ADCBuf0 = 0,
|
||||
CC1310DK_7XD_ADCBufCOUNT
|
||||
} CC1310DK_7XD_ADCBufName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_ADCName
|
||||
* @brief Enum of ADCs
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_ADCName {
|
||||
CC1310DK_7XD_ADCALS = 0,
|
||||
CC1310DK_7XD_ADCDCOUPL,
|
||||
CC1310DK_7XD_ADCVSS,
|
||||
CC1310DK_7XD_ADCVDDS,
|
||||
CC1310DK_7XD_ADCCOUNT
|
||||
} CC1310DK_7XD_ADCName;
|
||||
|
||||
/*!
|
||||
* @def CC1310DK_7XD_WatchdogName
|
||||
* @brief Enum of Watchdogs on the CC1310DK_7XD dev board
|
||||
*/
|
||||
typedef enum CC1310DK_7XD_WatchdogName {
|
||||
CC1310DK_7XD_WATCHDOG0 = 0,
|
||||
|
||||
CC1310DK_7XD_WATCHDOGCOUNT
|
||||
} CC1310DK_7XD_WatchdogName;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CC1310EM_H__ */
|
@ -0,0 +1,749 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ====================== CC1350DK_7XD.c ===================================
|
||||
* This file is responsible for setting up the board specific items for the
|
||||
* CC1350DK_7XD board.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <ti/devices/cc26x0/driverlib/ioc.h>
|
||||
#include <ti/devices/cc26x0/driverlib/udma.h>
|
||||
#include <ti/devices/cc26x0/inc/hw_ints.h>
|
||||
#include <ti/devices/cc26x0/inc/hw_memmap.h>
|
||||
|
||||
#include "CC1350DK_7XD.h"
|
||||
|
||||
/*
|
||||
* =============================== ADCBuf ===============================
|
||||
*/
|
||||
#include <ti/drivers/ADCBuf.h>
|
||||
#include <ti/drivers/adcbuf/ADCBufCC26XX.h>
|
||||
|
||||
ADCBufCC26XX_Object adcBufCC26xxObjects[CC1350DK_7XD_ADCBUFCOUNT];
|
||||
|
||||
/*
|
||||
* This table converts a virtual adc channel into a dio and internal analogue
|
||||
* input signal. This table is necessary for the functioning of the adcBuf
|
||||
* driver. Comment out unused entries to save flash. Dio and internal signal
|
||||
* pairs are hardwired. Do not remap them in the table. You may reorder entire
|
||||
* entries. The mapping of dio and internal signals is package dependent.
|
||||
*/
|
||||
const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1350DK_7XD_ADCBUF0CHANNELCOUNT] = {
|
||||
{CC1350DK_7XD_ALS_OUT, ADC_COMPB_IN_AUXIO7},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
|
||||
{PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
|
||||
};
|
||||
|
||||
const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUFCOUNT] = {
|
||||
{
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.adcChannelLut = ADCBufCC26XX_adcChannelLut,
|
||||
.gpTimerUnit = CC1350DK_7XD_GPTIMER0A,
|
||||
.gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A,
|
||||
}
|
||||
};
|
||||
|
||||
const ADCBuf_Config ADCBuf_config[CC1350DK_7XD_ADCBUFCOUNT] = {
|
||||
{
|
||||
&ADCBufCC26XX_fxnTable,
|
||||
&adcBufCC26xxObjects[CC1350DK_7XD_ADCBUF0],
|
||||
&adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUF0]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t ADCBuf_count = CC1350DK_7XD_ADCBUFCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== ADC ===============================
|
||||
*/
|
||||
#include <ti/drivers/ADC.h>
|
||||
#include <ti/drivers/adc/ADCCC26XX.h>
|
||||
|
||||
ADCCC26XX_Object adcCC26xxObjects[CC1350DK_7XD_ADCCOUNT];
|
||||
|
||||
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350DK_7XD_ADCCOUNT] = {
|
||||
{
|
||||
.adcDIO = CC1350DK_7XD_DIO23_ANALOG,
|
||||
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
|
||||
.returnAdjustedVal = false
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_DCOUPL,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
|
||||
.returnAdjustedVal = false
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_VSS,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
|
||||
.returnAdjustedVal = false
|
||||
},
|
||||
{
|
||||
.adcDIO = PIN_UNASSIGNED,
|
||||
.adcCompBInput = ADC_COMPB_IN_VDDS,
|
||||
.refSource = ADCCC26XX_FIXED_REFERENCE,
|
||||
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
|
||||
.inputScalingEnabled = true,
|
||||
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
|
||||
.returnAdjustedVal = false
|
||||
}
|
||||
};
|
||||
|
||||
const ADC_Config ADC_config[CC1350DK_7XD_ADCCOUNT] = {
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCALS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCALS]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCDCOUPL]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVSS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVSS]},
|
||||
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVDDS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVDDS]},
|
||||
};
|
||||
|
||||
const uint_least8_t ADC_count = CC1350DK_7XD_ADCCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== Crypto ===============================
|
||||
*/
|
||||
#include <ti/drivers/crypto/CryptoCC26XX.h>
|
||||
|
||||
CryptoCC26XX_Object cryptoCC26XXObjects[CC1350DK_7XD_CRYPTOCOUNT];
|
||||
|
||||
const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTOCOUNT] = {
|
||||
{
|
||||
.baseAddr = CRYPTO_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
|
||||
.intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
|
||||
.intPriority = ~0,
|
||||
}
|
||||
};
|
||||
|
||||
const CryptoCC26XX_Config CryptoCC26XX_config[CC1350DK_7XD_CRYPTOCOUNT] = {
|
||||
{
|
||||
.object = &cryptoCC26XXObjects[CC1350DK_7XD_CRYPTO0],
|
||||
.hwAttrs = &cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTO0]
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== Display ===============================
|
||||
*/
|
||||
#include <ti/display/Display.h>
|
||||
#include <ti/display/DisplayUart.h>
|
||||
#include <ti/display/DisplaySharp.h>
|
||||
|
||||
#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
|
||||
|
||||
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,
|
||||
.baudRate = 115200,
|
||||
.mutexTimeout = (unsigned int)(-1),
|
||||
.strBuf = uartStringBuf,
|
||||
.strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
|
||||
};
|
||||
|
||||
const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
|
||||
.spiIndex = CC1350DK_7XD_SPI0,
|
||||
.csPin = CC1350DK_7XD_GPIO_LCD_CS,
|
||||
.powerPin = CC1350DK_7XD_GPIO_LCD_POWER,
|
||||
.enablePin = CC1350DK_7XD_GPIO_LCD_ENABLE,
|
||||
.pixelWidth = BOARD_DISPLAY_SHARP_SIZE,
|
||||
.pixelHeight = BOARD_DISPLAY_SHARP_SIZE,
|
||||
.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
|
||||
|
||||
/*
|
||||
* 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 (BOARD_DISPLAY_USE_UART_ANSI)
|
||||
.fxnTablePtr = &DisplayUartAnsi_fxnTable,
|
||||
# else /* Default to minimal UART with no cursor placement */
|
||||
.fxnTablePtr = &DisplayUartMin_fxnTable,
|
||||
# endif
|
||||
.object = &displayUartObject,
|
||||
.hwAttrs = &displayUartHWAttrs,
|
||||
},
|
||||
#endif
|
||||
#if (BOARD_DISPLAY_USE_LCD)
|
||||
{
|
||||
.fxnTablePtr = &DisplaySharp_fxnTable,
|
||||
.object = &displaySharpObject,
|
||||
.hwAttrs = &displaySharpHWattrs
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Config);
|
||||
|
||||
#else
|
||||
|
||||
const Display_Config *Display_config = NULL;
|
||||
const uint_least8_t Display_count = 0;
|
||||
|
||||
#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
|
||||
|
||||
/*
|
||||
* =============================== GPIO ===============================
|
||||
*/
|
||||
#include <ti/drivers/GPIO.h>
|
||||
#include <ti/drivers/gpio/GPIOCC26XX.h>
|
||||
|
||||
/*
|
||||
* Array of Pin configurations
|
||||
* NOTE: The order of the pin configurations must coincide with what was
|
||||
* defined in CC1350DK_7XD.h
|
||||
* NOTE: Pins not used for interrupts should be placed at the end of the
|
||||
* array. Callback entries can be omitted from callbacks array to
|
||||
* reduce memory usage.
|
||||
*/
|
||||
GPIO_PinConfig gpioPinConfigs[] = {
|
||||
/* Input pins */
|
||||
GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */
|
||||
GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */
|
||||
GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */
|
||||
GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */
|
||||
GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */
|
||||
|
||||
GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_MASTER_READY */
|
||||
GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_SLAVE_READY */
|
||||
|
||||
/* Output pins */
|
||||
GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */
|
||||
GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */
|
||||
GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */
|
||||
GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */
|
||||
|
||||
/* SDCARD */
|
||||
GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
|
||||
|
||||
/* Accelerometer */
|
||||
GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
|
||||
|
||||
/* Sharp Display - GPIO configurations will be done in the Display files */
|
||||
GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
|
||||
GPIOCC26XX_DIO_05 | GPIO_DO_NOT_CONFIG, /* LCD power control */
|
||||
GPIOCC26XX_DIO_04 | GPIO_DO_NOT_CONFIG, /* LCD enable */
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Array of callback function pointers
|
||||
* NOTE: The order of the pin configurations must coincide with what was
|
||||
* defined in CC2650_LAUNCH.h
|
||||
* NOTE: Pins not used for interrupts can be omitted from callbacks array to
|
||||
* reduce memory usage (if placed at end of gpioPinConfigs array).
|
||||
*/
|
||||
GPIO_CallbackFxn gpioCallbackFunctions[] = {
|
||||
NULL, /* Button 0 */
|
||||
NULL, /* Button 1 */
|
||||
NULL, /* CC1350DK_7XD_SPI_MASTER_READY */
|
||||
NULL, /* CC1350DK_7XD_SPI_SLAVE_READY */
|
||||
};
|
||||
|
||||
const GPIOCC26XX_Config GPIOCC26XX_config = {
|
||||
.pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
|
||||
.callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
|
||||
.numberOfPinConfigs = CC1350DK_7XD_GPIOCOUNT,
|
||||
.numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
|
||||
.intPriority = (~0)
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== GPTimer ===============================
|
||||
* Remove unused entries to reduce flash usage both in Board.c and Board.h
|
||||
*/
|
||||
#include <ti/drivers/timer/GPTimerCC26XX.h>
|
||||
|
||||
GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350DK_7XD_GPTIMERCOUNT];
|
||||
|
||||
const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMERPARTSCOUNT] = {
|
||||
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
|
||||
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
|
||||
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
|
||||
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
|
||||
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
|
||||
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
|
||||
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
|
||||
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
|
||||
};
|
||||
|
||||
const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350DK_7XD_GPTIMERPARTSCOUNT] = {
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0A], GPT_A },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0B], GPT_B },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1A], GPT_A },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1B], GPT_B },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2A], GPT_A },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2B], GPT_B },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3A], GPT_A },
|
||||
{ &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3B], GPT_B },
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== I2C ===============================
|
||||
*/
|
||||
#include <ti/drivers/I2C.h>
|
||||
#include <ti/drivers/i2c/I2CCC26XX.h>
|
||||
|
||||
I2CCC26XX_Object i2cCC26xxObjects[CC1350DK_7XD_I2CCOUNT];
|
||||
|
||||
const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_I2CCOUNT] = {
|
||||
{
|
||||
.baseAddr = I2C0_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_I2C0,
|
||||
.intNum = INT_I2C_IRQ,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.sdaPin = CC1350DK_7XD_I2C0_SDA0,
|
||||
.sclPin = CC1350DK_7XD_I2C0_SCL0,
|
||||
}
|
||||
};
|
||||
|
||||
const I2C_Config I2C_config[CC1350DK_7XD_I2CCOUNT] = {
|
||||
{
|
||||
.fxnTablePtr = &I2CCC26XX_fxnTable,
|
||||
.object = &i2cCC26xxObjects[CC1350DK_7XD_I2C0],
|
||||
.hwAttrs = &i2cCC26xxHWAttrs[CC1350DK_7XD_I2C0]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t I2C_count = CC1350DK_7XD_I2CCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== NVS ===============================
|
||||
*/
|
||||
#include <ti/drivers/NVS.h>
|
||||
#include <ti/drivers/nvs/NVSSPI25X.h>
|
||||
#include <ti/drivers/nvs/NVSCC26XX.h>
|
||||
|
||||
#define NVS_REGIONS_BASE 0x1A000
|
||||
#define SECTORSIZE 0x1000
|
||||
#define REGIONSIZE (SECTORSIZE * 4)
|
||||
|
||||
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
|
||||
|
||||
/*
|
||||
* Reserve flash sectors for NVS driver use by placing an uninitialized byte
|
||||
* array at the desired flash address.
|
||||
*/
|
||||
#if defined(__TI_COMPILER_VERSION__)
|
||||
|
||||
/*
|
||||
* Place uninitialized array at NVS_REGIONS_BASE
|
||||
*/
|
||||
#pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
|
||||
#pragma NOINIT(flashBuf);
|
||||
static char flashBuf[REGIONSIZE];
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__)
|
||||
|
||||
/*
|
||||
* Place uninitialized array at NVS_REGIONS_BASE
|
||||
*/
|
||||
static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
/*
|
||||
* Place the flash buffers in the .nvs section created in the gcc linker file.
|
||||
* The .nvs section enforces alignment on a sector boundary but may
|
||||
* be placed anywhere in flash memory. If desired the .nvs section can be set
|
||||
* to a fixed address by changing the following in the gcc linker file:
|
||||
*
|
||||
* .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
|
||||
* *(.nvs)
|
||||
* } > REGION_TEXT
|
||||
*/
|
||||
__attribute__ ((section (".nvs")))
|
||||
static char flashBuf[REGIONSIZE];
|
||||
|
||||
#endif
|
||||
|
||||
/* Allocate objects for NVS Internal Regions */
|
||||
NVSCC26XX_Object nvsCC26xxObjects[1];
|
||||
|
||||
/* Hardware attributes for NVS Internal Regions */
|
||||
const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
|
||||
{
|
||||
.regionBase = (void *)flashBuf,
|
||||
.regionSize = REGIONSIZE,
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
|
||||
|
||||
/* 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
|
||||
{
|
||||
.fxnTablePtr = &NVSCC26XX_fxnTable,
|
||||
.object = &nvsCC26xxObjects[0],
|
||||
.hwAttrs = &nvsCC26xxHWAttrs[0],
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
const uint_least8_t NVS_count = CC1350DK_7XD_NVSCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== PIN ===============================
|
||||
*/
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
|
||||
const PIN_Config BoardGpioInitTable[] = {
|
||||
|
||||
CC1350DK_7XD_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
CC1350DK_7XD_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
CC1350DK_7XD_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
CC1350DK_7XD_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
|
||||
CC1350DK_7XD_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
CC1350DK_7XD_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
CC1350DK_7XD_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
CC1350DK_7XD_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
|
||||
CC1350DK_7XD_LCD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
|
||||
CC1350DK_7XD_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
|
||||
CC1350DK_7XD_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
|
||||
CC1350DK_7XD_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
|
||||
CC1350DK_7XD_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
|
||||
CC1350DK_7XD_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
|
||||
CC1350DK_7XD_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
|
||||
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== Power ===============================
|
||||
*/
|
||||
#include <ti/drivers/Power.h>
|
||||
#include <ti/drivers/power/PowerCC26XX.h>
|
||||
|
||||
const PowerCC26XX_Config PowerCC26XX_config = {
|
||||
.policyInitFxn = NULL,
|
||||
.policyFxn = &PowerCC26XX_standbyPolicy,
|
||||
.calibrateFxn = &PowerCC26XX_calibrate,
|
||||
.enablePolicy = true,
|
||||
.calibrateRCOSC_LF = true,
|
||||
.calibrateRCOSC_HF = true,
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== PWM ===============================
|
||||
* Remove unused entries to reduce flash usage both in Board.c and Board.h
|
||||
*/
|
||||
#include <ti/drivers/PWM.h>
|
||||
#include <ti/drivers/pwm/PWMTimerCC26XX.h>
|
||||
|
||||
PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350DK_7XD_PWMCOUNT];
|
||||
|
||||
const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWMCOUNT] = {
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN0, .gpTimerUnit = CC1350DK_7XD_GPTIMER0A },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN1, .gpTimerUnit = CC1350DK_7XD_GPTIMER0B },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN2, .gpTimerUnit = CC1350DK_7XD_GPTIMER1A },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN3, .gpTimerUnit = CC1350DK_7XD_GPTIMER1B },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN4, .gpTimerUnit = CC1350DK_7XD_GPTIMER2A },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN5, .gpTimerUnit = CC1350DK_7XD_GPTIMER2B },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN6, .gpTimerUnit = CC1350DK_7XD_GPTIMER3A },
|
||||
{ .pwmPin = CC1350DK_7XD_PWMPIN7, .gpTimerUnit = CC1350DK_7XD_GPTIMER3B },
|
||||
};
|
||||
|
||||
const PWM_Config PWM_config[CC1350DK_7XD_PWMCOUNT] = {
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM0], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM0] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM1], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM1] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM2], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM2] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM3], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM3] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM4], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM4] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM5], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM5] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM6], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM6] },
|
||||
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM7], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM7] },
|
||||
};
|
||||
|
||||
const uint_least8_t PWM_count = CC1350DK_7XD_PWMCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== RF Driver ===============================
|
||||
*/
|
||||
#include <ti/drivers/rf/RF.h>
|
||||
|
||||
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
|
||||
.hwiPriority = ~0, /* Lowest HWI priority */
|
||||
.swiPriority = 0, /* Lowest SWI priority */
|
||||
.xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
|
||||
.globalCallback = NULL, /* No board specific callback */
|
||||
.globalEventMask = 0 /* No events subscribed to */
|
||||
};
|
||||
|
||||
/*
|
||||
* =============================== SD ===============================
|
||||
*/
|
||||
#include <ti/drivers/SD.h>
|
||||
#include <ti/drivers/sd/SDSPI.h>
|
||||
|
||||
SDSPI_Object sdspiObjects[CC1350DK_7XD_SDCOUNT];
|
||||
|
||||
const SDSPI_HWAttrs sdspiHWAttrs[CC1350DK_7XD_SDCOUNT] = {
|
||||
{
|
||||
.spiIndex = CC1350DK_7XD_SPI0,
|
||||
.spiCsGpioIndex = CC1350DK_7XD_SDCARD_CS
|
||||
}
|
||||
};
|
||||
|
||||
const SD_Config SD_config[CC1350DK_7XD_SDCOUNT] = {
|
||||
{
|
||||
.fxnTablePtr = &SDSPI_fxnTable,
|
||||
.object = &sdspiObjects[CC1350DK_7XD_SDSPI0],
|
||||
.hwAttrs = &sdspiHWAttrs[CC1350DK_7XD_SDSPI0]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t SD_count = CC1350DK_7XD_SDCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== SPI DMA ===============================
|
||||
*/
|
||||
#include <ti/drivers/SPI.h>
|
||||
#include <ti/drivers/spi/SPICC26XXDMA.h>
|
||||
|
||||
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT];
|
||||
|
||||
/*
|
||||
* 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[CC1350DK_7XD_SPICOUNT] = {
|
||||
{
|
||||
.baseAddr = SSI0_BASE,
|
||||
.intNum = INT_SSI0_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
|
||||
.defaultTxBufValue = 0xFF,
|
||||
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
|
||||
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
|
||||
.mosiPin = CC1350DK_7XD_SPI0_MOSI,
|
||||
.misoPin = CC1350DK_7XD_SPI0_MISO,
|
||||
.clkPin = CC1350DK_7XD_SPI0_CLK,
|
||||
.csnPin = CC1350DK_7XD_SPI0_CSN,
|
||||
.minDmaTransferSize = 10
|
||||
},
|
||||
{
|
||||
.baseAddr = SSI1_BASE,
|
||||
.intNum = INT_SSI1_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_SSI1,
|
||||
.defaultTxBufValue = 0xFF,
|
||||
.rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
|
||||
.txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
|
||||
.mosiPin = CC1350DK_7XD_SPI1_MOSI,
|
||||
.misoPin = CC1350DK_7XD_SPI1_MISO,
|
||||
.clkPin = CC1350DK_7XD_SPI1_CLK,
|
||||
.csnPin = CC1350DK_7XD_SPI1_CSN,
|
||||
.minDmaTransferSize = 10
|
||||
}
|
||||
};
|
||||
|
||||
const SPI_Config SPI_config[CC1350DK_7XD_SPICOUNT] = {
|
||||
{
|
||||
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
|
||||
.object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI0],
|
||||
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI0]
|
||||
},
|
||||
{
|
||||
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
|
||||
.object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI1],
|
||||
.hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI1]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t SPI_count = CC1350DK_7XD_SPICOUNT;
|
||||
|
||||
/*
|
||||
* =============================== UART ===============================
|
||||
*/
|
||||
#include <ti/drivers/UART.h>
|
||||
#include <ti/drivers/uart/UARTCC26XX.h>
|
||||
|
||||
UARTCC26XX_Object uartCC26XXObjects[CC1350DK_7XD_UARTCOUNT];
|
||||
|
||||
uint8_t uartCC26XXRingBuffer[CC1350DK_7XD_UARTCOUNT][32];
|
||||
|
||||
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = {
|
||||
{
|
||||
.baseAddr = UART0_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_UART0,
|
||||
.intNum = INT_UART0_COMB,
|
||||
.intPriority = ~0,
|
||||
.swiPriority = 0,
|
||||
.txPin = CC1350DK_7XD_UART_TX,
|
||||
.rxPin = CC1350DK_7XD_UART_RX,
|
||||
.ctsPin = PIN_UNASSIGNED,
|
||||
.rtsPin = PIN_UNASSIGNED,
|
||||
.ringBufPtr = uartCC26XXRingBuffer[CC1350DK_7XD_UART0],
|
||||
.ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350DK_7XD_UART0]),
|
||||
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
|
||||
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
|
||||
.errorFxn = NULL
|
||||
}
|
||||
};
|
||||
|
||||
const UART_Config UART_config[CC1350DK_7XD_UARTCOUNT] = {
|
||||
{
|
||||
.fxnTablePtr = &UARTCC26XX_fxnTable,
|
||||
.object = &uartCC26XXObjects[CC1350DK_7XD_UART0],
|
||||
.hwAttrs = &uartCC26XXHWAttrs[CC1350DK_7XD_UART0]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t UART_count = CC1350DK_7XD_UARTCOUNT;
|
||||
|
||||
/*
|
||||
* =============================== UDMA ===============================
|
||||
*/
|
||||
#include <ti/drivers/dma/UDMACC26XX.h>
|
||||
|
||||
UDMACC26XX_Object udmaObjects[CC1350DK_7XD_UDMACOUNT];
|
||||
|
||||
const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350DK_7XD_UDMACOUNT] = {
|
||||
{
|
||||
.baseAddr = UDMA0_BASE,
|
||||
.powerMngrId = PowerCC26XX_PERIPH_UDMA,
|
||||
.intNum = INT_DMA_ERR,
|
||||
.intPriority = ~0
|
||||
}
|
||||
};
|
||||
|
||||
const UDMACC26XX_Config UDMACC26XX_config[CC1350DK_7XD_UDMACOUNT] = {
|
||||
{
|
||||
.object = &udmaObjects[CC1350DK_7XD_UDMA0],
|
||||
.hwAttrs = &udmaHWAttrs[CC1350DK_7XD_UDMA0]
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* =============================== Watchdog ===============================
|
||||
*/
|
||||
#include <ti/drivers/Watchdog.h>
|
||||
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
|
||||
|
||||
WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOGCOUNT];
|
||||
|
||||
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOGCOUNT] = {
|
||||
{
|
||||
.baseAddr = WDT_BASE,
|
||||
.reloadValue = 1000 /* Reload value in milliseconds */
|
||||
},
|
||||
};
|
||||
|
||||
const Watchdog_Config Watchdog_config[CC1350DK_7XD_WATCHDOGCOUNT] = {
|
||||
{
|
||||
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
|
||||
.object = &watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOG0],
|
||||
.hwAttrs = &watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOG0]
|
||||
},
|
||||
};
|
||||
|
||||
const uint_least8_t Watchdog_count = CC1350DK_7XD_WATCHDOGCOUNT;
|
||||
|
||||
/*
|
||||
* Board-specific initialization function to disable external flash.
|
||||
* This function is defined in the file CC1350DK_7XD_fxns.c
|
||||
*/
|
||||
extern void Board_initHook(void);
|
||||
|
||||
/*
|
||||
* ======== CC1350DK_7XD_initGeneral ========
|
||||
*/
|
||||
void CC1350DK_7XD_initGeneral(void)
|
||||
{
|
||||
Power_init();
|
||||
|
||||
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
|
||||
/* Error with PIN_init */
|
||||
while (1);
|
||||
}
|
||||
|
||||
/* Perform board-specific initialization */
|
||||
Board_initHook();
|
||||
}
|
@ -0,0 +1,367 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
/** ============================================================================
|
||||
* @file CC1350DK_7XD.h
|
||||
*
|
||||
* @brief CC2650 LaunchPad Board Specific header file.
|
||||
*
|
||||
* The CC1350DK_7XD header file should be included in an application as
|
||||
* follows:
|
||||
* @code
|
||||
* #include "CC1350DK_7XD.h"
|
||||
* @endcode
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
#ifndef __CC1350DK_7XD_BOARD_H__
|
||||
#define __CC1350DK_7XD_BOARD_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes */
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <ti/devices/cc26x0/driverlib/ioc.h>
|
||||
|
||||
/* Externs */
|
||||
extern const PIN_Config BoardGpioInitTable[];
|
||||
|
||||
/* Defines */
|
||||
#define CC1350DK_7XD
|
||||
|
||||
/* Mapping of pins to board signals using general board aliases
|
||||
* <board signal alias> <pin mapping>
|
||||
*/
|
||||
|
||||
/* Analog Capable DIOs */
|
||||
#define CC1350DK_7XD_DIO23_ANALOG IOID_23
|
||||
#define CC1350DK_7XD_DIO24_ANALOG IOID_24
|
||||
#define CC1350DK_7XD_DIO25_ANALOG IOID_25
|
||||
#define CC1350DK_7XD_DIO26_ANALOG IOID_26
|
||||
#define CC1350DK_7XD_DIO27_ANALOG IOID_27
|
||||
#define CC1350DK_7XD_DIO28_ANALOG IOID_28
|
||||
#define CC1350DK_7XD_DIO29_ANALOG IOID_29
|
||||
#define CC1350DK_7XD_DIO30_ANALOG IOID_30
|
||||
|
||||
/* Digital IOs */
|
||||
#define CC1350DK_7XD_DIO0 IOID_0
|
||||
#define CC1350DK_7XD_DIO1_RFSW IOID_1
|
||||
#define CC1350DK_7XD_DIO12 IOID_12
|
||||
#define CC1350DK_7XD_DIO15 IOID_15
|
||||
#define CC1350DK_7XD_DIO16_TDO IOID_16
|
||||
#define CC1350DK_7XD_DIO17_TDI IOID_17
|
||||
#define CC1350DK_7XD_DIO21 IOID_21
|
||||
#define CC1350DK_7XD_DIO22 IOID_22
|
||||
|
||||
/* Discrete Inputs */
|
||||
#define CC1350DK_7XD_PIN_KEY_SELECT IOID_11
|
||||
#define CC1350DK_7XD_PIN_KEY_UP IOID_19
|
||||
#define CC1350DK_7XD_PIN_KEY_DOWN IOID_12
|
||||
#define CC1350DK_7XD_PIN_KEY_LEFT IOID_15
|
||||
#define CC1350DK_7XD_PIN_KEY_RIGHT IOID_18
|
||||
|
||||
/* GPIO */
|
||||
#define CC1350DK_7XD_GPIO_LED_ON 1
|
||||
#define CC1350DK_7XD_GPIO_LED_OFF 0
|
||||
|
||||
/* I2C */
|
||||
#define CC1350DK_7XD_I2C0_SCL0 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_I2C0_SDA0 PIN_UNASSIGNED
|
||||
|
||||
/* LEDs */
|
||||
#define CC1350DK_7XD_PIN_LED_ON 1
|
||||
#define CC1350DK_7XD_PIN_LED_OFF 0
|
||||
#define CC1350DK_7XD_PIN_LED1 IOID_25
|
||||
#define CC1350DK_7XD_PIN_LED2 IOID_27
|
||||
#define CC1350DK_7XD_PIN_LED3 IOID_7
|
||||
#define CC1350DK_7XD_PIN_LED4 IOID_6
|
||||
|
||||
/* PWM Outputs */
|
||||
#define CC1350DK_7XD_PWMPIN0 CC1350DK_7XD_PIN_LED1
|
||||
#define CC1350DK_7XD_PWMPIN1 CC1350DK_7XD_PIN_LED2
|
||||
#define CC1350DK_7XD_PWMPIN2 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_PWMPIN3 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_PWMPIN4 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_PWMPIN5 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_PWMPIN6 PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_PWMPIN7 PIN_UNASSIGNED
|
||||
|
||||
/* SPI Board */
|
||||
#define CC1350DK_7XD_SPI0_MISO IOID_8
|
||||
#define CC1350DK_7XD_SPI0_MOSI IOID_9
|
||||
#define CC1350DK_7XD_SPI0_CLK IOID_10
|
||||
#define CC1350DK_7XD_SPI0_CSN PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_SPI1_MISO PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_SPI1_MOSI PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_SPI1_CLK PIN_UNASSIGNED
|
||||
#define CC1350DK_7XD_SPI1_CSN PIN_UNASSIGNED
|
||||
|
||||
/* UART Board */
|
||||
#define CC1350DK_7XD_UART_RX IOID_2
|
||||
#define CC1350DK_7XD_UART_TX IOID_3
|
||||
#define CC1350DK_7XD_UART_CTS IOID_22
|
||||
#define CC1350DK_7XD_UART_RTS IOID_21
|
||||
|
||||
/* SD Card */
|
||||
#define CC1350DK_7XD_SDCARD_CS IOID_30
|
||||
|
||||
/* LCD Board */
|
||||
#define CC1350DK_7XD_LCD_MODE IOID_4
|
||||
#define CC1350DK_7XD_LCD_RST IOID_5
|
||||
#define CC1350DK_7XD_LCD_CS IOID_14
|
||||
|
||||
/* Ambient Light Sensor */
|
||||
#define CC1350DK_7XD_ALS_OUT IOID_23
|
||||
#define CC1350DK_7XD_ALS_PWR IOID_26
|
||||
|
||||
/* Accelerometer */
|
||||
#define CC1350DK_7XD_ACC_PWR IOID_20
|
||||
#define CC1350DK_7XD_ACC_CS IOID_24
|
||||
|
||||
/*!
|
||||
* @brief Initialize the general board specific settings
|
||||
*
|
||||
* This function initializes the general board specific settings.
|
||||
*/
|
||||
void CC1350DK_7XD_initGeneral(void);
|
||||
|
||||
/*!
|
||||
* @brief Turn off the external flash on LaunchPads
|
||||
*
|
||||
*/
|
||||
void CC1350DK_7XD_shutDownExtFlash(void);
|
||||
|
||||
/*!
|
||||
* @brief Wake up the external flash present on the board files
|
||||
*
|
||||
* This function toggles the chip select for the amount of time needed
|
||||
* to wake the chip up.
|
||||
*/
|
||||
void CC1350DK_7XD_wakeUpExtFlash(void);
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_ADCBufName
|
||||
* @brief Enum of ADCs
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_ADCBufName {
|
||||
CC1350DK_7XD_ADCBUF0 = 0,
|
||||
|
||||
CC1350DK_7XD_ADCBUFCOUNT
|
||||
} CC1350DK_7XD_ADCBufName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_ADCBuf0SourceName
|
||||
* @brief Enum of ADCBuf channels
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_ADCBuf0ChannelName {
|
||||
CC1350DK_7XD_ADCBUF0CHANNELADCALS = 0,
|
||||
CC1350DK_7XD_ADCBUF0CHANNELVDDS,
|
||||
CC1350DK_7XD_ADCBUF0CHANNELDCOUPL,
|
||||
CC1350DK_7XD_ADCBUF0CHANNELVSS,
|
||||
|
||||
CC1350DK_7XD_ADCBUF0CHANNELCOUNT
|
||||
} CC1350DK_7XD_ADCBuf0ChannelName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_ADCName
|
||||
* @brief Enum of ADCs
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_ADCName {
|
||||
CC1350DK_7XD_ADCALS = 0,
|
||||
CC1350DK_7XD_ADCDCOUPL,
|
||||
CC1350DK_7XD_ADCVSS,
|
||||
CC1350DK_7XD_ADCVDDS,
|
||||
|
||||
CC1350DK_7XD_ADCCOUNT
|
||||
} CC1350DK_7XD_ADCName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_CryptoName
|
||||
* @brief Enum of Crypto names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_CryptoName {
|
||||
CC1350DK_7XD_CRYPTO0 = 0,
|
||||
|
||||
CC1350DK_7XD_CRYPTOCOUNT
|
||||
} CC1350DK_7XD_CryptoName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_GPIOName
|
||||
* @brief Enum of GPIO names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_GPIOName {
|
||||
CC1350DK_7XD_GPIO_KEY_SELECT = 0,
|
||||
CC1350DK_7XD_GPIO_KEY_UP,
|
||||
CC1350DK_7XD_GPIO_KEY_DOWN,
|
||||
CC1350DK_7XD_GPIO_KEY_LEFT,
|
||||
CC1350DK_7XD_GPIO_KEY_RIGHT,
|
||||
CC1350DK_7XD_SPI_MASTER_READY,
|
||||
CC1350DK_7XD_SPI_SLAVE_READY,
|
||||
CC1350DK_7XD_GPIO_LED1,
|
||||
CC1350DK_7XD_GPIO_LED2,
|
||||
CC1350DK_7XD_GPIO_LED3,
|
||||
CC1350DK_7XD_GPIO_LED4,
|
||||
CC1350DK_7XD_GPIO_SDCARD_CS,
|
||||
CC1350DK_7XD_GPIO_ACC_CS,
|
||||
CC1350DK_7XD_GPIO_LCD_CS,
|
||||
CC1350DK_7XD_GPIO_LCD_POWER,
|
||||
CC1350DK_7XD_GPIO_LCD_ENABLE,
|
||||
|
||||
CC1350DK_7XD_GPIOCOUNT
|
||||
} CC1350DK_7XD_GPIOName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_GPTimerName
|
||||
* @brief Enum of GPTimer parts
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_GPTimerName {
|
||||
CC1350DK_7XD_GPTIMER0A = 0,
|
||||
CC1350DK_7XD_GPTIMER0B,
|
||||
CC1350DK_7XD_GPTIMER1A,
|
||||
CC1350DK_7XD_GPTIMER1B,
|
||||
CC1350DK_7XD_GPTIMER2A,
|
||||
CC1350DK_7XD_GPTIMER2B,
|
||||
CC1350DK_7XD_GPTIMER3A,
|
||||
CC1350DK_7XD_GPTIMER3B,
|
||||
|
||||
CC1350DK_7XD_GPTIMERPARTSCOUNT
|
||||
} CC1350DK_7XD_GPTimerName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_GPTimers
|
||||
* @brief Enum of GPTimers
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_GPTimers {
|
||||
CC1350DK_7XD_GPTIMER0 = 0,
|
||||
CC1350DK_7XD_GPTIMER1,
|
||||
CC1350DK_7XD_GPTIMER2,
|
||||
CC1350DK_7XD_GPTIMER3,
|
||||
|
||||
CC1350DK_7XD_GPTIMERCOUNT
|
||||
} CC1350DK_7XD_GPTimers;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_I2CName
|
||||
* @brief Enum of I2C names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_I2CName {
|
||||
CC1350DK_7XD_I2C0 = 0,
|
||||
|
||||
CC1350DK_7XD_I2CCOUNT
|
||||
} CC1350DK_7XD_I2CName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_NVSName
|
||||
* @brief Enum of NVS names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_NVSName {
|
||||
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
|
||||
CC1350DK_7XD_NVSCC26XX0 = 0,
|
||||
#endif
|
||||
|
||||
CC1350DK_7XD_NVSCOUNT
|
||||
} CC1350DK_7XD_NVSName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_PWM
|
||||
* @brief Enum of PWM outputs
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_PWMName {
|
||||
CC1350DK_7XD_PWM0 = 0,
|
||||
CC1350DK_7XD_PWM1,
|
||||
CC1350DK_7XD_PWM2,
|
||||
CC1350DK_7XD_PWM3,
|
||||
CC1350DK_7XD_PWM4,
|
||||
CC1350DK_7XD_PWM5,
|
||||
CC1350DK_7XD_PWM6,
|
||||
CC1350DK_7XD_PWM7,
|
||||
|
||||
CC1350DK_7XD_PWMCOUNT
|
||||
} CC1350DK_7XD_PWMName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_SDName
|
||||
* @brief Enum of SD names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_SDName {
|
||||
CC1350DK_7XD_SDSPI0 = 0,
|
||||
|
||||
CC1350DK_7XD_SDCOUNT
|
||||
} CC1350DK_7XD_SDName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_SPIName
|
||||
* @brief Enum of SPI names
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_SPIName {
|
||||
CC1350DK_7XD_SPI0 = 0,
|
||||
CC1350DK_7XD_SPI1,
|
||||
|
||||
CC1350DK_7XD_SPICOUNT
|
||||
} CC1350DK_7XD_SPIName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_UARTName
|
||||
* @brief Enum of UARTs
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_UARTName {
|
||||
CC1350DK_7XD_UART0 = 0,
|
||||
|
||||
CC1350DK_7XD_UARTCOUNT
|
||||
} CC1350DK_7XD_UARTName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_UDMAName
|
||||
* @brief Enum of DMA buffers
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_UDMAName {
|
||||
CC1350DK_7XD_UDMA0 = 0,
|
||||
|
||||
CC1350DK_7XD_UDMACOUNT
|
||||
} CC1350DK_7XD_UDMAName;
|
||||
|
||||
/*!
|
||||
* @def CC1350DK_7XD_WatchdogName
|
||||
* @brief Enum of Watchdogs
|
||||
*/
|
||||
typedef enum CC1350DK_7XD_WatchdogName {
|
||||
CC1350DK_7XD_WATCHDOG0 = 0,
|
||||
|
||||
CC1350DK_7XD_WATCHDOGCOUNT
|
||||
} CC1350DK_7XD_WatchdogName;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CC1350DK_7XD_BOARD_H__ */
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ======== CC1350DK_7XD_fxns.c ========
|
||||
* This file contains the board-specific initialization functions.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <ti/devices/cc26x0/driverlib/ioc.h>
|
||||
#include <ti/devices/cc26x0/driverlib/cpu.h>
|
||||
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
|
||||
#include "Board.h"
|
||||
|
||||
/*
|
||||
* ======== CC1350DK_7XD_wakeUpExtFlash ========
|
||||
*/
|
||||
void CC1350DK_7XD_wakeUpExtFlash(void)
|
||||
{
|
||||
/* No external flash on CC1350DK_7XD */
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== CC1350DK_7XD_shutDownExtFlash ========
|
||||
*/
|
||||
void CC1350DK_7XD_shutDownExtFlash(void)
|
||||
{
|
||||
/* No external flash on CC1350DK_7XD */
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== Board_initHook ========
|
||||
* Called by Board_init() to perform board-specific initialization.
|
||||
*/
|
||||
void Board_initHook()
|
||||
{
|
||||
CC1350DK_7XD_shutDownExtFlash();
|
||||
}
|
@ -5,7 +5,7 @@ SUBFAMILY = cc13x0-cc26x0
|
||||
DEVICE_FAMILY = CC13X0
|
||||
DEVICE_LINE = CC13XX
|
||||
|
||||
BOARD_SOURCEFILES += CC1310DK_7XD.c
|
||||
BOARD_SOURCEFILES += CC1310DK_7XD.c CC1310DK_7XD_fxns.c
|
||||
|
||||
SUPPORTS_PROP_MODE = 1
|
||||
SUPPORTS_IEEE_MODE = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||
* Copyright (c) 2015-2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,52 +33,131 @@
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
#define Board_CC2650DK_7ID
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ti/drivers/Power.h>
|
||||
|
||||
#include "CC2650DK_7ID.h"
|
||||
|
||||
#define Board_initGeneral() CC2650DK_7ID_initGeneral()
|
||||
#define Board_shutDownExtFlash() CC2650DK_7ID_shutDownExtFlash()
|
||||
#define Board_wakeUpExtFlash() CC2650DK_7ID_wakeUpExtFlash()
|
||||
|
||||
/* These #defines allow us to reuse TI-RTOS across other device families */
|
||||
#define Board_LED1 Board_DK_LED1
|
||||
#define Board_LED2 Board_DK_LED2
|
||||
#define Board_LED3 Board_DK_LED3
|
||||
#define Board_LED4 Board_DK_LED4
|
||||
|
||||
#define Board_LED0 Board_DK_LED4
|
||||
#define Board_ADCALS CC2650DK_7ID_ADCALS
|
||||
|
||||
#define Board_BUTTON0 Board_KEY_UP
|
||||
#define Board_BUTTON1 Board_KEY_DOWN
|
||||
#define Board_ADC0 CC2650DK_7ID_ADCVDDS
|
||||
#define Board_ADC1 CC2650DK_7ID_ADCALS
|
||||
|
||||
#define Board_UART0 Board_UART
|
||||
#define Board_AES0 Board_AES
|
||||
#define Board_WATCHDOG0 CC2650DK_7ID_WATCHDOG0
|
||||
#define Board_ADCBUF0 CC2650DK_7ID_ADCBUF0
|
||||
#define Board_ADCBUF0CHANNEL0 CC2650DK_7ID_ADCBUF0CHANNELVDDS
|
||||
#define Board_ADCBUF0CHANNEL1 CC2650DK_7ID_ADCBUF0CHANNELADCALS
|
||||
|
||||
#define Board_ADC0 CC2650DK_7ID_ADCVDDS
|
||||
#define Board_ADC1 CC2650DK_7ID_ADCALS
|
||||
#define Board_CRYPTO0 CC2650DK_7ID_CRYPTO0
|
||||
|
||||
#define Board_ADCBuf0 CC2650DK_7ID_ADCBuf0
|
||||
#define Board_ADCBufChannel0 (0)
|
||||
#define Board_ADCBufChannel1 (1)
|
||||
#define Board_DIO0 CC2650DK_7ID_DIO0
|
||||
#define Board_DIO1_RFSW CC2650DK_7ID_DIO1_RFSW
|
||||
#define Board_DIO12 CC2650DK_7ID_DIO12
|
||||
#define Board_DIO15 CC2650DK_7ID_DIO15
|
||||
#define Board_DIO16_TDO CC2650DK_7ID_DIO16_TDO
|
||||
#define Board_DIO17_TDI CC2650DK_7ID_DIO17_TDI
|
||||
#define Board_DIO21 CC2650DK_7ID_DIO21
|
||||
#define Board_DIO22 CC2650DK_7ID_DIO22
|
||||
|
||||
#define Board_initGeneral() { \
|
||||
Power_init(); \
|
||||
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
|
||||
{System_abort("Error with PIN_init\n"); \
|
||||
} \
|
||||
}
|
||||
#define Board_DIO23_ANALOG CC2650DK_7ID_DIO23_ANALOG
|
||||
#define Board_DIO24_ANALOG CC2650DK_7ID_DIO24_ANALOG
|
||||
#define Board_DIO25_ANALOG CC2650DK_7ID_DIO25_ANALOG
|
||||
#define Board_DIO26_ANALOG CC2650DK_7ID_DIO26_ANALOG
|
||||
#define Board_DIO27_ANALOG CC2650DK_7ID_DIO27_ANALOG
|
||||
#define Board_DIO28_ANALOG CC2650DK_7ID_DIO28_ANALOG
|
||||
#define Board_DIO29_ANALOG CC2650DK_7ID_DIO29_ANALOG
|
||||
#define Board_DIO30_ANALOG CC2650DK_7ID_DIO30_ANALOG
|
||||
|
||||
#define Board_initGPIO()
|
||||
#define Board_initPWM() PWM_init()
|
||||
#define Board_initSPI() SPI_init()
|
||||
#define Board_initUART() UART_init()
|
||||
#define Board_initWatchdog() Watchdog_init()
|
||||
#define Board_initADCBuf() ADCBuf_init()
|
||||
#define Board_initADC() ADC_init()
|
||||
#define GPIO_toggle(n)
|
||||
#define GPIO_write(n,m)
|
||||
#define Board_GPIO_BTN0 CC2650DK_7ID_PIN_KEY_SELECT
|
||||
#define Board_GPIO_BTN1 CC2650DK_7ID_PIN_KEY_UP
|
||||
#define Board_GPIO_BTN2 CC2650DK_7ID_PIN_KEY_DOWN
|
||||
#define Board_GPIO_BTN3 CC2650DK_7ID_PIN_KEY_LEFT
|
||||
#define Board_GPIO_BTN4 CC2650DK_7ID_PIN_KEY_RIGHT
|
||||
#define Board_GPIO_LED0 CC2650DK_7ID_PIN_LED1
|
||||
#define Board_GPIO_LED1 CC2650DK_7ID_PIN_LED2
|
||||
#define Board_GPIO_LED2 CC2650DK_7ID_PIN_LED3
|
||||
#define Board_GPIO_LED3 CC2650DK_7ID_PIN_LED4
|
||||
#define Board_GPIO_LED_ON CC2650DK_7ID_GPIO_LED_ON
|
||||
#define Board_GPIO_LED_OFF CC2650DK_7ID_GPIO_LED_OFF
|
||||
|
||||
#define Board_GPTIMER0A CC2650DK_7ID_GPTIMER0A
|
||||
#define Board_GPTIMER0B CC2650DK_7ID_GPTIMER0B
|
||||
#define Board_GPTIMER1A CC2650DK_7ID_GPTIMER1A
|
||||
#define Board_GPTIMER1B CC2650DK_7ID_GPTIMER1B
|
||||
#define Board_GPTIMER2A CC2650DK_7ID_GPTIMER2A
|
||||
#define Board_GPTIMER2B CC2650DK_7ID_GPTIMER2B
|
||||
#define Board_GPTIMER3A CC2650DK_7ID_GPTIMER3A
|
||||
#define Board_GPTIMER3B CC2650DK_7ID_GPTIMER3B
|
||||
|
||||
#define Board_I2C0 CC2650DK_7ID_I2C0
|
||||
|
||||
#define Board_NVSINTERNAL CC2650DK_7ID_NVSCC26XX0
|
||||
|
||||
#define Board_KEY_SELECT CC2650DK_7ID_PIN_KEY_SELECT
|
||||
#define Board_KEY_UP CC2650DK_7ID_PIN_KEY_UP
|
||||
#define Board_KEY_DOWN CC2650DK_7ID_PIN_KEY_DOWN
|
||||
#define Board_KEY_LEFT CC2650DK_7ID_PIN_KEY_LEFT
|
||||
#define Board_KEY_RIGHT CC2650DK_7ID_PIN_KEY_RIGHT
|
||||
|
||||
#define Board_PIN_BUTTON0 CC2650DK_7ID_PIN_KEY_SELECT
|
||||
#define Board_PIN_BUTTON1 CC2650DK_7ID_PIN_KEY_UP
|
||||
#define Board_PIN_BUTTON2 CC2650DK_7ID_PIN_KEY_DOWN
|
||||
#define Board_PIN_BUTTON3 CC2650DK_7ID_PIN_KEY_LEFT
|
||||
#define Board_PIN_BUTTON4 CC2650DK_7ID_PIN_KEY_RIGHT
|
||||
#define Board_PIN_BTN1 CC2650DK_7ID_PIN_KEY_SELECT
|
||||
#define Board_PIN_BTN2 CC2650DK_7ID_PIN_KEY_UP
|
||||
#define Board_PIN_BTN3 CC2650DK_7ID_PIN_KEY_DOWN
|
||||
#define Board_PIN_BTN4 CC2650DK_7ID_PIN_KEY_LEFT
|
||||
#define Board_PIN_BTN5 CC2650DK_7ID_PIN_KEY_RIGHT
|
||||
#define Board_PIN_LED0 CC2650DK_7ID_PIN_LED1
|
||||
#define Board_PIN_LED1 CC2650DK_7ID_PIN_LED2
|
||||
#define Board_PIN_LED2 CC2650DK_7ID_PIN_LED3
|
||||
#define Board_PIN_LED3 CC2650DK_7ID_PIN_LED4
|
||||
|
||||
#define Board_PWM0 CC2650DK_7ID_PWM0
|
||||
#define Board_PWM1 CC2650DK_7ID_PWM1
|
||||
#define Board_PWM2 CC2650DK_7ID_PWM2
|
||||
#define Board_PWM3 CC2650DK_7ID_PWM3
|
||||
#define Board_PWM4 CC2650DK_7ID_PWM4
|
||||
#define Board_PWM5 CC2650DK_7ID_PWM5
|
||||
#define Board_PWM6 CC2650DK_7ID_PWM6
|
||||
#define Board_PWM7 CC2650DK_7ID_PWM7
|
||||
|
||||
#define Board_SD0 CC2650DK_7ID_SDSPI0
|
||||
|
||||
#define Board_SPI0 CC2650DK_7ID_SPI0
|
||||
#define Board_SPI1 CC2650DK_7ID_SPI1
|
||||
#define Board_FLASH_CS_ON 0
|
||||
#define Board_FLASH_CS_OFF 1
|
||||
|
||||
#define Board_SPI_MASTER CC2650DK_7ID_SPI0
|
||||
#define Board_SPI_SLAVE CC2650DK_7ID_SPI0
|
||||
#define Board_SPI_MASTER_READY CC2650DK_7ID_SPI_MASTER_READY
|
||||
#define Board_SPI_SLAVE_READY CC2650DK_7ID_SPI_SLAVE_READY
|
||||
|
||||
#define Board_UART0 CC2650DK_7ID_UART0
|
||||
|
||||
#define Board_WATCHDOG0 CC2650DK_7ID_WATCHDOG0
|
||||
|
||||
#define Board_SDCARD_CS CC2650DK_7ID_SDCARD_CS
|
||||
|
||||
#define Board_LCD_MODE CC2650DK_7ID_LCD_MODE
|
||||
#define Board_LCD_RST CC2650DK_7ID_LCD_RST
|
||||
#define Board_LCD_CS CC2650DK_7ID_LCD_CS
|
||||
|
||||
#define Board_ALS_OUT CC2650DK_7ID_ALS_OUT
|
||||
#define Board_ALS_PWR CC2650DK_7ID_ALS_PWR
|
||||
|
||||
#define Board_ACC_PWR CC2650DK_7ID_ACC_PWR
|
||||
#define Board_ACC_CS CC2650DK_7ID_ACC_CS
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||
* Copyright (c) 2015-2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -32,235 +32,166 @@
|
||||
/** ============================================================================
|
||||
* @file CC2650DK_7ID.h
|
||||
*
|
||||
* @brief CC2650EM_7ID Board Specific header file.
|
||||
* The project options should point to this file if this is the
|
||||
* CC2650EM you are developing code for.
|
||||
* @brief CC2650 LaunchPad Board Specific header file.
|
||||
*
|
||||
* The CC2650 header file should be included in an application as follows:
|
||||
* The CC2650DK_7ID header file should be included in an application as
|
||||
* follows:
|
||||
* @code
|
||||
* #include <Board.h>
|
||||
* #include "CC2650DK_7ID.h"
|
||||
* @endcode
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
#ifndef __CC2650EM_7ID_H__
|
||||
#define __CC2650EM_7ID_H__
|
||||
#ifndef __CC2650DK_7ID_BOARD_H__
|
||||
#define __CC2650DK_7ID_BOARD_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** ============================================================================
|
||||
* Symbol by generic Board.c to include the correct kit specific Board.c
|
||||
* ==========================================================================*/
|
||||
#define CC2650EM_7ID
|
||||
#define CC2650DK_7ID
|
||||
|
||||
|
||||
/** ============================================================================
|
||||
* Includes
|
||||
* ==========================================================================*/
|
||||
/* Includes */
|
||||
#include <ti/drivers/PIN.h>
|
||||
#include <driverlib/ioc.h>
|
||||
#include <ti/devices/cc26x0/driverlib/ioc.h>
|
||||
|
||||
/** ============================================================================
|
||||
* Externs
|
||||
* ==========================================================================*/
|
||||
/* Externs */
|
||||
extern const PIN_Config BoardGpioInitTable[];
|
||||
|
||||
/** ============================================================================
|
||||
* Defines
|
||||
* ==========================================================================*/
|
||||
/* Defines */
|
||||
#define CC2650DK_7ID
|
||||
|
||||
/* Mapping of pins to board signals using general board aliases
|
||||
* <board signal alias> <pin mapping>
|
||||
* <board signal alias> <pin mapping>
|
||||
*/
|
||||
/* Leds */
|
||||
#define Board_LED_ON 1 /* LEDs on SmartRF06 EB are active high */
|
||||
#define Board_LED_OFF 0
|
||||
#define Board_DK_LED1 IOID_25 /* P2.11 */
|
||||
#define Board_DK_LED2 IOID_27 /* P2.13 */
|
||||
#define Board_DK_LED3 IOID_7 /* P1.2 */
|
||||
#define Board_DK_LED4 IOID_6 /* P1.4 */
|
||||
/* Button Board */
|
||||
#define Board_KEY_SELECT IOID_11 /* P1.14 */
|
||||
#define Board_KEY_UP IOID_19 /* P1.10 */
|
||||
#define Board_KEY_DOWN IOID_12 /* P1.12 */
|
||||
#define Board_KEY_LEFT IOID_15 /* P1.6 */
|
||||
#define Board_KEY_RIGHT IOID_18 /* P1.8 */
|
||||
/* LCD Board */
|
||||
#define Board_LCD_MODE IOID_4 /* P1.11 */
|
||||
#define Board_LCD_RST IOID_5 /* P1.13 */
|
||||
#define Board_LCD_CSN IOID_14 /* P1.17 */
|
||||
/* UART Board */
|
||||
#define Board_UART_RX IOID_2 /* P1.7 */
|
||||
#define Board_UART_TX IOID_3 /* P1.9 */
|
||||
#define Board_UART_CTS IOID_0 /* P1.3 */
|
||||
#define Board_UART_RTS IOID_21 /* P2.18 */
|
||||
|
||||
/* Analog Capable DIOs */
|
||||
#define CC2650DK_7ID_DIO23_ANALOG IOID_23
|
||||
#define CC2650DK_7ID_DIO24_ANALOG IOID_24
|
||||
#define CC2650DK_7ID_DIO25_ANALOG IOID_25
|
||||
#define CC2650DK_7ID_DIO26_ANALOG IOID_26
|
||||
#define CC2650DK_7ID_DIO27_ANALOG IOID_27
|
||||
#define CC2650DK_7ID_DIO28_ANALOG IOID_28
|
||||
#define CC2650DK_7ID_DIO29_ANALOG IOID_29
|
||||
#define CC2650DK_7ID_DIO30_ANALOG IOID_30
|
||||
|
||||
/* Digital IOs */
|
||||
#define CC2650DK_7ID_DIO0 IOID_0
|
||||
#define CC2650DK_7ID_DIO1_RFSW IOID_1
|
||||
#define CC2650DK_7ID_DIO12 IOID_12
|
||||
#define CC2650DK_7ID_DIO15 IOID_15
|
||||
#define CC2650DK_7ID_DIO16_TDO IOID_16
|
||||
#define CC2650DK_7ID_DIO17_TDI IOID_17
|
||||
#define CC2650DK_7ID_DIO21 IOID_21
|
||||
#define CC2650DK_7ID_DIO22 IOID_22
|
||||
|
||||
/* Discrete Inputs */
|
||||
#define CC2650DK_7ID_PIN_KEY_SELECT IOID_11
|
||||
#define CC2650DK_7ID_PIN_KEY_UP IOID_19
|
||||
#define CC2650DK_7ID_PIN_KEY_DOWN IOID_12
|
||||
#define CC2650DK_7ID_PIN_KEY_LEFT IOID_15
|
||||
#define CC2650DK_7ID_PIN_KEY_RIGHT IOID_18
|
||||
|
||||
/* GPIO */
|
||||
#define CC2650DK_7ID_GPIO_LED_ON 1
|
||||
#define CC2650DK_7ID_GPIO_LED_OFF 0
|
||||
|
||||
/* I2C */
|
||||
#define CC2650DK_7ID_I2C0_SCL0 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_I2C0_SDA0 PIN_UNASSIGNED
|
||||
|
||||
/* LEDs */
|
||||
#define CC2650DK_7ID_PIN_LED_ON 1
|
||||
#define CC2650DK_7ID_PIN_LED_OFF 0
|
||||
#define CC2650DK_7ID_PIN_LED1 IOID_25
|
||||
#define CC2650DK_7ID_PIN_LED2 IOID_27
|
||||
#define CC2650DK_7ID_PIN_LED3 IOID_7
|
||||
#define CC2650DK_7ID_PIN_LED4 IOID_6
|
||||
|
||||
/* PWM Outputs */
|
||||
#define CC2650DK_7ID_PWMPIN0 CC2650DK_7ID_PIN_LED1
|
||||
#define CC2650DK_7ID_PWMPIN1 CC2650DK_7ID_PIN_LED2
|
||||
#define CC2650DK_7ID_PWMPIN2 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_PWMPIN3 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_PWMPIN4 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_PWMPIN5 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_PWMPIN6 PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_PWMPIN7 PIN_UNASSIGNED
|
||||
|
||||
/* SPI Board */
|
||||
#define Board_SPI0_MISO IOID_8 /* P1.20 */
|
||||
#define Board_SPI0_MOSI IOID_9 /* P1.18 */
|
||||
#define Board_SPI0_CLK IOID_10 /* P1.16 */
|
||||
#define Board_SPI0_CSN PIN_UNASSIGNED /* P1.14, separate CSn for LCD, SDCARD, and ACC */
|
||||
#define Board_SPI1_MISO IOID_24 /* RF2.10 for testing only */
|
||||
#define Board_SPI1_MOSI IOID_23 /* RF2.5 for testing only */
|
||||
#define Board_SPI1_CLK IOID_30 /* RF2.12 for testing only */
|
||||
#define Board_SPI1_CSN PIN_UNASSIGNED /* RF2.6 for testing only */
|
||||
/* Ambient Light Sensor */
|
||||
#define Board_ALS_OUT IOID_23 /* P2.5 */
|
||||
#define Board_ALS_PWR IOID_26 /* P2.6 */
|
||||
/* Accelerometer */
|
||||
#define Board_ACC_PWR IOID_20 /* P2.8 */
|
||||
#define Board_ACC_CSN IOID_24 /* P2.10 */
|
||||
#define CC2650DK_7ID_SPI0_MISO IOID_8
|
||||
#define CC2650DK_7ID_SPI0_MOSI IOID_9
|
||||
#define CC2650DK_7ID_SPI0_CLK IOID_10
|
||||
#define CC2650DK_7ID_SPI0_CSN PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_SPI1_MISO PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_SPI1_MOSI PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_SPI1_CLK PIN_UNASSIGNED
|
||||
#define CC2650DK_7ID_SPI1_CSN PIN_UNASSIGNED
|
||||
|
||||
/* UART Board */
|
||||
#define CC2650DK_7ID_UART_RX IOID_2
|
||||
#define CC2650DK_7ID_UART_TX IOID_3
|
||||
#define CC2650DK_7ID_UART_CTS IOID_0
|
||||
#define CC2650DK_7ID_UART_RTS IOID_21
|
||||
|
||||
/* SD Card */
|
||||
#define Board_SDCARD_CSN IOID_30 /* P2.12 */
|
||||
/* Power Board */
|
||||
#define Board_3V3_EN IOID_13 /* P1.15 */
|
||||
/* PWM outputs */
|
||||
#define Board_PWMPIN0 Board_DK_LED1
|
||||
#define Board_PWMPIN1 Board_DK_LED2
|
||||
#define Board_PWMPIN2 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN3 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN4 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN5 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN6 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN7 PIN_UNASSIGNED
|
||||
/* Analog capable DIO's */
|
||||
#define Board_DIO23_ANALOG IOID_23
|
||||
#define Board_DIO24_ANALOG IOID_24
|
||||
#define Board_DIO25_ANALOG IOID_25
|
||||
#define Board_DIO26_ANALOG IOID_26
|
||||
#define Board_DIO27_ANALOG IOID_27
|
||||
#define Board_DIO28_ANALOG IOID_28
|
||||
#define Board_DIO29_ANALOG IOID_29
|
||||
#define Board_DIO30_ANALOG IOID_30
|
||||
#define CC2650DK_7ID_SDCARD_CS IOID_30
|
||||
|
||||
/** ============================================================================
|
||||
* Instance identifiers
|
||||
* ==========================================================================*/
|
||||
/* Generic SPI instance identifiers */
|
||||
#define Board_SPI0 CC2650DK_7ID_SPI0
|
||||
#define Board_SPI1 CC2650DK_7ID_SPI1
|
||||
/* Generic UART instance identifiers */
|
||||
#define Board_UART CC2650DK_7ID_UART0
|
||||
/* Generic Crypto instance identifiers */
|
||||
#define Board_CRYPTO CC2650DK_7ID_CRYPTO0
|
||||
/* Generic GPTimer instance identifiers */
|
||||
#define Board_GPTIMER0A CC2650DK_7ID_GPTIMER0A
|
||||
#define Board_GPTIMER0B CC2650DK_7ID_GPTIMER0B
|
||||
#define Board_GPTIMER1A CC2650DK_7ID_GPTIMER1A
|
||||
#define Board_GPTIMER1B CC2650DK_7ID_GPTIMER1B
|
||||
#define Board_GPTIMER2A CC2650DK_7ID_GPTIMER2A
|
||||
#define Board_GPTIMER2B CC2650DK_7ID_GPTIMER2B
|
||||
#define Board_GPTIMER3A CC2650DK_7ID_GPTIMER3A
|
||||
#define Board_GPTIMER3B CC2650DK_7ID_GPTIMER3B
|
||||
/* Generic PWM instance identifiers */
|
||||
#define Board_PWM0 CC2650DK_7ID_PWM0
|
||||
#define Board_PWM1 CC2650DK_7ID_PWM1
|
||||
#define Board_PWM2 CC2650DK_7ID_PWM2
|
||||
#define Board_PWM3 CC2650DK_7ID_PWM3
|
||||
#define Board_PWM4 CC2650DK_7ID_PWM4
|
||||
#define Board_PWM5 CC2650DK_7ID_PWM5
|
||||
#define Board_PWM6 CC2650DK_7ID_PWM6
|
||||
#define Board_PWM7 CC2650DK_7ID_PWM7
|
||||
/* LCD Board */
|
||||
#define CC2650DK_7ID_LCD_MODE IOID_4
|
||||
#define CC2650DK_7ID_LCD_RST IOID_5
|
||||
#define CC2650DK_7ID_LCD_CS IOID_14
|
||||
|
||||
/** ============================================================================
|
||||
* Number of peripherals and their names
|
||||
* ==========================================================================*/
|
||||
/* Ambient Light Sensor */
|
||||
#define CC2650DK_7ID_ALS_OUT IOID_23
|
||||
#define CC2650DK_7ID_ALS_PWR IOID_26
|
||||
|
||||
/* Accelerometer */
|
||||
#define CC2650DK_7ID_ACC_PWR IOID_20
|
||||
#define CC2650DK_7ID_ACC_CS IOID_24
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_CryptoName
|
||||
* @brief Enum of Crypto names on the CC2650 dev board
|
||||
* @brief Initialize the general board specific settings
|
||||
*
|
||||
* This function initializes the general board specific settings.
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_CryptoName {
|
||||
CC2650DK_7ID_CRYPTO0 = 0,
|
||||
CC2650DK_7ID_CRYPTOCOUNT
|
||||
} CC2650DK_7ID_CryptoName;
|
||||
void CC2650DK_7ID_initGeneral(void);
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_SPIName
|
||||
* @brief Enum of SPI names on the CC2650 dev board
|
||||
* @brief Turn off the external flash on LaunchPads
|
||||
*
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_SPIName {
|
||||
CC2650DK_7ID_SPI0 = 0,
|
||||
CC2650DK_7ID_SPI1,
|
||||
CC2650DK_7ID_SPICOUNT
|
||||
} CC2650DK_7ID_SPIName;
|
||||
void CC2650DK_7ID_shutDownExtFlash(void);
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_UARTName
|
||||
* @brief Enum of UARTs on the CC2650 dev board
|
||||
* @brief Wake up the external flash present on the board files
|
||||
*
|
||||
* This function toggles the chip select for the amount of time needed
|
||||
* to wake the chip up.
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_UARTName {
|
||||
CC2650DK_7ID_UART0 = 0,
|
||||
CC2650DK_7ID_UARTCOUNT
|
||||
} CC2650DK_7ID_UARTName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_UdmaName
|
||||
* @brief Enum of DMA buffers
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_UdmaName {
|
||||
CC2650DK_7ID_UDMA0 = 0,
|
||||
CC2650DK_7ID_UDMACOUNT
|
||||
} CC2650DK_7ID_UdmaName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_GPTimerName
|
||||
* @brief Enum of GPTimer parts
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_GPTimerName
|
||||
{
|
||||
CC2650DK_7ID_GPTIMER0A = 0,
|
||||
CC2650DK_7ID_GPTIMER0B,
|
||||
CC2650DK_7ID_GPTIMER1A,
|
||||
CC2650DK_7ID_GPTIMER1B,
|
||||
CC2650DK_7ID_GPTIMER2A,
|
||||
CC2650DK_7ID_GPTIMER2B,
|
||||
CC2650DK_7ID_GPTIMER3A,
|
||||
CC2650DK_7ID_GPTIMER3B,
|
||||
CC2650DK_7ID_GPTIMERPARTSCOUNT
|
||||
} CC2650DK_7ID_GPTimerName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_GPTimers
|
||||
* @brief Enum of GPTimers
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_GPTimers
|
||||
{
|
||||
CC2650DK_7ID_GPTIMER0 = 0,
|
||||
CC2650DK_7ID_GPTIMER1,
|
||||
CC2650DK_7ID_GPTIMER2,
|
||||
CC2650DK_7ID_GPTIMER3,
|
||||
CC2650DK_7ID_GPTIMERCOUNT
|
||||
} CC2650DK_7ID_GPTimers;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_PWM
|
||||
* @brief Enum of PWM outputs on the board
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_PWM
|
||||
{
|
||||
CC2650DK_7ID_PWM0 = 0,
|
||||
CC2650DK_7ID_PWM1,
|
||||
CC2650DK_7ID_PWM2,
|
||||
CC2650DK_7ID_PWM3,
|
||||
CC2650DK_7ID_PWM4,
|
||||
CC2650DK_7ID_PWM5,
|
||||
CC2650DK_7ID_PWM6,
|
||||
CC2650DK_7ID_PWM7,
|
||||
CC2650DK_7ID_PWMCOUNT
|
||||
} CC2650DK_7ID_PWM;
|
||||
void CC2650DK_7ID_wakeUpExtFlash(void);
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_ADCBufName
|
||||
* @brief Enum of ADCBufs
|
||||
* @brief Enum of ADCs
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_ADCBufName {
|
||||
CC2650DK_7ID_ADCBuf0 = 0,
|
||||
CC2650DK_7ID_ADCBufCOUNT
|
||||
CC2650DK_7ID_ADCBUF0 = 0,
|
||||
|
||||
CC2650DK_7ID_ADCBUFCOUNT
|
||||
} CC2650DK_7ID_ADCBufName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_ADCBuf0SourceName
|
||||
* @brief Enum of ADCBuf channels
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_ADCBuf0ChannelName {
|
||||
CC2650DK_7ID_ADCBUF0CHANNELADCALS = 0,
|
||||
CC2650DK_7ID_ADCBUF0CHANNELVDDS,
|
||||
CC2650DK_7ID_ADCBUF0CHANNELDCOUPL,
|
||||
CC2650DK_7ID_ADCBUF0CHANNELVSS,
|
||||
|
||||
CC2650DK_7ID_ADCBUF0CHANNELCOUNT
|
||||
} CC2650DK_7ID_ADCBuf0ChannelName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_ADCName
|
||||
* @brief Enum of ADCs
|
||||
@ -270,12 +201,158 @@ typedef enum CC2650DK_7ID_ADCName {
|
||||
CC2650DK_7ID_ADCDCOUPL,
|
||||
CC2650DK_7ID_ADCVSS,
|
||||
CC2650DK_7ID_ADCVDDS,
|
||||
|
||||
CC2650DK_7ID_ADCCOUNT
|
||||
} CC2650DK_7ID_ADCName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_CryptoName
|
||||
* @brief Enum of Crypto names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_CryptoName {
|
||||
CC2650DK_7ID_CRYPTO0 = 0,
|
||||
|
||||
CC2650DK_7ID_CRYPTOCOUNT
|
||||
} CC2650DK_7ID_CryptoName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_GPIOName
|
||||
* @brief Enum of GPIO names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_GPIOName {
|
||||
CC2650DK_7ID_GPIO_KEY_SELECT = 0,
|
||||
CC2650DK_7ID_GPIO_KEY_UP,
|
||||
CC2650DK_7ID_GPIO_KEY_DOWN,
|
||||
CC2650DK_7ID_GPIO_KEY_LEFT,
|
||||
CC2650DK_7ID_GPIO_KEY_RIGHT,
|
||||
CC2650DK_7ID_SPI_MASTER_READY,
|
||||
CC2650DK_7ID_SPI_SLAVE_READY,
|
||||
CC2650DK_7ID_GPIO_LED1,
|
||||
CC2650DK_7ID_GPIO_LED2,
|
||||
CC2650DK_7ID_GPIO_LED3,
|
||||
CC2650DK_7ID_GPIO_LED4,
|
||||
CC2650DK_7ID_GPIO_SDCARD_CS,
|
||||
CC2650DK_7ID_GPIO_ACC_CS,
|
||||
CC2650DK_7ID_GPIO_LCD_CS,
|
||||
CC2650DK_7ID_GPIO_LCD_POWER,
|
||||
CC2650DK_7ID_GPIO_LCD_ENABLE,
|
||||
|
||||
CC2650DK_7ID_GPIOCOUNT
|
||||
} CC2650DK_7ID_GPIOName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_GPTimerName
|
||||
* @brief Enum of GPTimer parts
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_GPTimerName {
|
||||
CC2650DK_7ID_GPTIMER0A = 0,
|
||||
CC2650DK_7ID_GPTIMER0B,
|
||||
CC2650DK_7ID_GPTIMER1A,
|
||||
CC2650DK_7ID_GPTIMER1B,
|
||||
CC2650DK_7ID_GPTIMER2A,
|
||||
CC2650DK_7ID_GPTIMER2B,
|
||||
CC2650DK_7ID_GPTIMER3A,
|
||||
CC2650DK_7ID_GPTIMER3B,
|
||||
|
||||
CC2650DK_7ID_GPTIMERPARTSCOUNT
|
||||
} CC2650DK_7ID_GPTimerName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_GPTimers
|
||||
* @brief Enum of GPTimers
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_GPTimers {
|
||||
CC2650DK_7ID_GPTIMER0 = 0,
|
||||
CC2650DK_7ID_GPTIMER1,
|
||||
CC2650DK_7ID_GPTIMER2,
|
||||
CC2650DK_7ID_GPTIMER3,
|
||||
|
||||
CC2650DK_7ID_GPTIMERCOUNT
|
||||
} CC2650DK_7ID_GPTimers;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_I2CName
|
||||
* @brief Enum of I2C names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_I2CName {
|
||||
CC2650DK_7ID_I2C0 = 0,
|
||||
|
||||
CC2650DK_7ID_I2CCOUNT
|
||||
} CC2650DK_7ID_I2CName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_NVSName
|
||||
* @brief Enum of NVS names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_NVSName {
|
||||
#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
|
||||
CC2650DK_7ID_NVSCC26XX0 = 0,
|
||||
#endif
|
||||
|
||||
CC2650DK_7ID_NVSCOUNT
|
||||
} CC2650DK_7ID_NVSName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_PWM
|
||||
* @brief Enum of PWM outputs
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_PWMName {
|
||||
CC2650DK_7ID_PWM0 = 0,
|
||||
CC2650DK_7ID_PWM1,
|
||||
CC2650DK_7ID_PWM2,
|
||||
CC2650DK_7ID_PWM3,
|
||||
CC2650DK_7ID_PWM4,
|
||||
CC2650DK_7ID_PWM5,
|
||||
CC2650DK_7ID_PWM6,
|
||||
CC2650DK_7ID_PWM7,
|
||||
|
||||
CC2650DK_7ID_PWMCOUNT
|
||||
} CC2650DK_7ID_PWMName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_SDName
|
||||
* @brief Enum of SD names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_SDName {
|
||||
CC2650DK_7ID_SDSPI0 = 0,
|
||||
|
||||
CC2650DK_7ID_SDCOUNT
|
||||
} CC2650DK_7ID_SDName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_SPIName
|
||||
* @brief Enum of SPI names
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_SPIName {
|
||||
CC2650DK_7ID_SPI0 = 0,
|
||||
CC2650DK_7ID_SPI1,
|
||||
|
||||
CC2650DK_7ID_SPICOUNT
|
||||
} CC2650DK_7ID_SPIName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_UARTName
|
||||
* @brief Enum of UARTs
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_UARTName {
|
||||
CC2650DK_7ID_UART0 = 0,
|
||||
|
||||
CC2650DK_7ID_UARTCOUNT
|
||||
} CC2650DK_7ID_UARTName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_UDMAName
|
||||
* @brief Enum of DMA buffers
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_UDMAName {
|
||||
CC2650DK_7ID_UDMA0 = 0,
|
||||
|
||||
CC2650DK_7ID_UDMACOUNT
|
||||
} CC2650DK_7ID_UDMAName;
|
||||
|
||||
/*!
|
||||
* @def CC2650DK_7ID_WatchdogName
|
||||
* @brief Enum of Watchdogs on the CC2650DK_7ID dev board
|
||||
* @brief Enum of Watchdogs
|
||||
*/
|
||||
typedef enum CC2650DK_7ID_WatchdogName {
|
||||
CC2650DK_7ID_WATCHDOG0 = 0,
|
||||
@ -287,4 +364,4 @@ typedef enum CC2650DK_7ID_WatchdogName {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CC2650EM_H__ */
|
||||
#endif /* __CC2650DK_7ID_BOARD_H__ */
|
||||
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Texas Instruments Incorporated
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Texas Instruments Incorporated 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 OWNER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ======== CC2650DK_7ID_fxns.c ========
|
||||
* This file contains the board-specific initialization functions.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <ti/devices/cc26x0/driverlib/ioc.h>
|
||||
#include <ti/devices/cc26x0/driverlib/cpu.h>
|
||||
|
||||
#include <ti/drivers/pin/PINCC26XX.h>
|
||||
|
||||
#include "Board.h"
|
||||
|
||||
/*
|
||||
* ======== CC2650DK_7ID_wakeUpExtFlash ========
|
||||
*/
|
||||
void CC2650DK_7ID_wakeUpExtFlash(void)
|
||||
{
|
||||
/* No external flash on CC2650DK_7ID */
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== CC2650DK_7ID_shutDownExtFlash ========
|
||||
*/
|
||||
void CC2650DK_7ID_shutDownExtFlash(void)
|
||||
{
|
||||
/* No external flash on CC2650DK_7ID */
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== Board_initHook ========
|
||||
* Called by Board_init() to perform board-specific initialization.
|
||||
*/
|
||||
void Board_initHook()
|
||||
{
|
||||
CC2650DK_7ID_shutDownExtFlash();
|
||||
}
|
@ -5,7 +5,7 @@ SUBFAMILY = cc13x0-cc26x0
|
||||
DEVICE_FAMILY = CC26X0
|
||||
DEVICE_LINE = CC26XX
|
||||
|
||||
BOARD_SOURCEFILES += CC2650DK_7ID.c
|
||||
BOARD_SOURCEFILES += CC2650DK_7ID.c CC2650DK_7ID_fxns.c
|
||||
|
||||
SUPPORTS_PROP_MODE = 0
|
||||
SUPPORTS_IEEE_MODE = 1
|
||||
|
@ -29,62 +29,26 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup srf06-common-peripherals
|
||||
* \addtogroup simplelink-platform
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Driver for the SmartRF06EB LEDs when a CC13xx/CC26xx EM is mounted on it
|
||||
* Driver for LaunchPad LEDs
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Contiki API */
|
||||
#include "contiki.h"
|
||||
#include "dev/leds.h"
|
||||
#include "ti-lib.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned char c;
|
||||
static int inited = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
if(inited) {
|
||||
return;
|
||||
}
|
||||
inited = 1;
|
||||
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_1);
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_2);
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_3);
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_LED_4);
|
||||
#include <Board.h>
|
||||
|
||||
ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL);
|
||||
}
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
leds_arch_get(void)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
c = leds;
|
||||
|
||||
/* Clear everything */
|
||||
ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL);
|
||||
|
||||
if((leds & LEDS_RED) == LEDS_RED) {
|
||||
ti_lib_gpio_set_dio(BOARD_IOID_LED_1);
|
||||
}
|
||||
if((leds & LEDS_YELLOW) == LEDS_YELLOW) {
|
||||
ti_lib_gpio_set_dio(BOARD_IOID_LED_2);
|
||||
}
|
||||
if((leds & LEDS_GREEN) == LEDS_GREEN) {
|
||||
ti_lib_gpio_set_dio(BOARD_IOID_LED_3);
|
||||
}
|
||||
if((leds & LEDS_ORANGE) == LEDS_ORANGE) {
|
||||
ti_lib_gpio_set_dio(BOARD_IOID_LED_4);
|
||||
}
|
||||
}
|
||||
const leds_t leds_arch_leds[] = {
|
||||
{ .pin = Board_PIN_LED0, .negative_logic = false },
|
||||
{ .pin = Board_PIN_LED1, .negative_logic = false },
|
||||
{ .pin = Board_PIN_LED2, .negative_logic = false },
|
||||
{ .pin = Board_PIN_LED3, .negative_logic = false },
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -36,20 +36,12 @@
|
||||
* Generic module controlling Simplelink sensors
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <contiki.h>
|
||||
#include <lib/sensors.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "common/button-sensor.h"
|
||||
#include "contiki.h"
|
||||
#include "lib/sensors.h"
|
||||
|
||||
#include "board-peripherals.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Exports a global symbol to be used by the sensor API */
|
||||
SENSORS(
|
||||
#ifdef BUTTON_SENSOR_ARCH_BTN1
|
||||
&button_sensor,
|
||||
#endif
|
||||
#ifdef BUTTON_SENSOR_ARCH_BTN2
|
||||
&button_sensor2,
|
||||
#endif
|
||||
NULL
|
||||
);
|
||||
SENSORS(&als_sensor);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -1,112 +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 srf06-common-peripherals
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Board-initialisation for the Srf06EB with a CC13xx/CC26xx EM.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "ti-lib.h"
|
||||
#include "lpm.h"
|
||||
#include "prcm.h"
|
||||
#include "hw_sysctl.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
lpm_handler(uint8_t mode)
|
||||
{
|
||||
/* Ambient light sensor (off, output low) */
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR);
|
||||
ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR);
|
||||
ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT);
|
||||
ti_lib_ioc_io_port_pull_set(BOARD_IOID_ALS_OUT, IOC_NO_IOPULL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
wakeup_handler(void)
|
||||
{
|
||||
/* Turn on the PERIPH PD */
|
||||
ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH);
|
||||
while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH)
|
||||
!= PRCM_DOMAIN_POWER_ON));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Declare a data structure to register with LPM.
|
||||
* We don't care about what power mode we'll drop to, we don't care about
|
||||
* getting notified before deep sleep. All we need is to be notified when we
|
||||
* wake up so we can turn power domains back on
|
||||
*/
|
||||
LPM_MODULE(srf_module, NULL, lpm_handler, wakeup_handler, LPM_DOMAIN_NONE);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
configure_unused_pins(void)
|
||||
{
|
||||
/* Turn off 3.3-V domain (lcd/sdcard power, output low) */
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_3V3_EN);
|
||||
ti_lib_gpio_clear_dio(BOARD_IOID_3V3_EN);
|
||||
|
||||
/* Accelerometer (PWR output low, CSn output, high) */
|
||||
ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ACC_PWR);
|
||||
ti_lib_gpio_clear_dio(BOARD_IOID_ACC_PWR);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
board_init()
|
||||
{
|
||||
uint8_t int_disabled = ti_lib_int_master_disable();
|
||||
|
||||
/* Turn on relevant PDs */
|
||||
wakeup_handler();
|
||||
|
||||
/* Enable GPIO peripheral */
|
||||
ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO);
|
||||
|
||||
/* Apply settings and wait for them to take effect */
|
||||
ti_lib_prcm_load_set();
|
||||
while(!ti_lib_prcm_load_get());
|
||||
|
||||
lpm_register_module(&srf_module);
|
||||
|
||||
configure_unused_pins();
|
||||
|
||||
/* Re-enable interrupt if initially enabled. */
|
||||
if(!int_disabled) {
|
||||
ti_lib_int_master_enable();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -83,6 +83,7 @@
|
||||
#include "dev/gpio-hal.h"
|
||||
#include "sys/clock.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "sys/process.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -74,7 +74,7 @@
|
||||
/**
|
||||
* \brief GPIO pin number representation
|
||||
*/
|
||||
typedef uint8_t gpio_hal_pin_t;
|
||||
typedef uint_fast8_t gpio_hal_pin_t;
|
||||
|
||||
/**
|
||||
* \brief GPIO pin configuration
|
||||
@ -82,7 +82,7 @@ typedef uint8_t gpio_hal_pin_t;
|
||||
* A logical representation of a pin's configuration. It is an OR combination
|
||||
* of GPIO_HAL_PIN_CFG_xyz macros.
|
||||
*/
|
||||
typedef uint32_t gpio_hal_pin_cfg_t;
|
||||
typedef uint_least32_t gpio_hal_pin_cfg_t;
|
||||
|
||||
#ifdef GPIO_HAL_CONF_PIN_COUNT
|
||||
#define GPIO_HAL_PIN_COUNT GPIO_HAL_CONF_PIN_COUNT
|
||||
@ -90,34 +90,73 @@ typedef uint32_t gpio_hal_pin_cfg_t;
|
||||
#define GPIO_HAL_PIN_COUNT 32
|
||||
#endif
|
||||
|
||||
#if GPIO_HAL_PIN_COUNT > 32
|
||||
typedef uint64_t gpio_hal_pin_mask_t;
|
||||
#else
|
||||
/**
|
||||
* \brief GPIO pin mask representation
|
||||
*/
|
||||
typedef uint32_t gpio_hal_pin_mask_t;
|
||||
#if GPIO_HAL_PIN_COUNT > 32
|
||||
typedef uint_least64_t gpio_hal_pin_mask_t;
|
||||
#else
|
||||
typedef uint_least32_t gpio_hal_pin_mask_t;
|
||||
#endif
|
||||
|
||||
typedef void (*gpio_hal_callback_t)(gpio_hal_pin_mask_t pin_mask);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define GPIO_HAL_PIN_CFG_PULL_NONE (0)
|
||||
#define GPIO_HAL_PIN_CFG_PULL_UP (1 << 0)
|
||||
#define GPIO_HAL_PIN_CFG_PULL_DOWN (1 << 1)
|
||||
/*
|
||||
* Configuration bits
|
||||
* bit 8 -> bit 0 ->
|
||||
* xxxxxxff eedccbba
|
||||
*
|
||||
* Input config:
|
||||
* a - 1 bit - hystersis
|
||||
* b - 2 bits - pulling
|
||||
*
|
||||
* Output config:
|
||||
* c - 2 bits - output buffer
|
||||
* d - 1 bit - slew control
|
||||
* e - 2 bits - drive strength
|
||||
*
|
||||
* Interrupt config:
|
||||
* f - 2 bits - interrupt mode
|
||||
*
|
||||
* Unused config:
|
||||
* x: unused
|
||||
*/
|
||||
|
||||
#define GPIO_HAL_PIN_CFG_PULL_MASK ( GPIO_HAL_PIN_CFG_PULL_UP \
|
||||
| GPIO_HAL_PIN_CFG_PULL_DOWN \
|
||||
)
|
||||
#define GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS (1 << 0)
|
||||
#define GPIO_HAL_PIN_CFG_INPUT_NOPULL (0 << 1)
|
||||
#define GPIO_HAL_PIN_CFG_INPUT_PULLUP (1 << 1)
|
||||
#define GPIO_HAL_PIN_CFG_INPUT_PULLDOWN (2 << 1)
|
||||
|
||||
#define GPIO_HAL_PIN_CFG_INT_DISABLE (0)
|
||||
#define GPIO_HAL_PIN_CFG_INT_FALLING (1 << 2)
|
||||
#define GPIO_HAL_PIN_CFG_INT_RISING (1 << 3)
|
||||
#define GPIO_HAL_PIN_CFG_INT_BOTH (1 << 4)
|
||||
#define GPIO_HAL_PIN_BM_INPUT_HYSTERESIS (0b00000001 << 0)
|
||||
#define GPIO_HAL_PIN_BM_INPUT_PULLING (0b00000110 << 0)
|
||||
#define GPIO_HAL_PIN_BM_INPUT ( GPIO_HAL_PIN_BM_INPUT_HYSTERESIS \
|
||||
| GPIO_HAL_PIN_BM_INPUT_PULLING)
|
||||
|
||||
#define GPIO_HAL_PIN_CFG_INT_MASK ( GPIO_HAL_PIN_CFG_INT_RISING \
|
||||
| GPIO_HAL_PIN_CFG_INT_FALLING \
|
||||
| GPIO_HAL_PIN_CFG_INT_BOTH \
|
||||
)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_PUSHPULL (0 << 3)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_OPENDRAIN (1 << 3)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_OPENSOURCE (2 << 3)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_SLEWCTRL (1 << 5)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MIN (0 << 6)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MED (1 << 6)
|
||||
#define GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MAX (2 << 6)
|
||||
|
||||
#define GPIO_HAL_PIN_BM_OUTPUT_BUF (0b00011000 << 0)
|
||||
#define GPIO_HAL_PIN_BM_OUTPUT_SLEWCTRL (0b00100000 << 0)
|
||||
#define GPIO_HAL_PIN_BM_OUTPUT_DRVSTR (0b11000000 << 0)
|
||||
#define GPIO_HAL_PIN_BM_OUTPUT ( GPIO_HAL_PIN_BM_OUTPUT_BUF \
|
||||
| GPIO_HAL_PIN_BM_OUTPUT_SLEWCTRL \
|
||||
| GPIO_HAL_PIN_BM_OUTPUT_DRVSTR)
|
||||
|
||||
#define GPIO_HAL_PIN_CFG_INT_DISABLE (0 << 8)
|
||||
#define GPIO_HAL_PIN_CFG_INT_FALLING (1 << 8)
|
||||
#define GPIO_HAL_PIN_CFG_INT_RISING (2 << 8)
|
||||
#define GPIO_HAL_PIN_CFG_INT_BOTH (3 << 8)
|
||||
|
||||
#define GPIO_HAL_PIN_BM_INT (0b00000011 << 8)
|
||||
|
||||
#define GPIO_HAL_PIN_BM_ALL ( GPIO_HAL_PIN_BM_INPUT \
|
||||
| GPIO_HAL_PIN_BM_OUTPUT \
|
||||
| GPIO_HAL_PIN_BM_INT)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Datatype for GPIO event handlers
|
||||
|
Loading…
Reference in New Issue
Block a user