Compare commits

...

25 Commits

Author SHA1 Message Date
weiting2 a4bcff55c1 add 2650-ma mem pin 2020-06-03 16:03:53 +08:00
weiting2 da154855d5 add 2650-ma mem pin 2020-06-03 15:54:36 +08:00
weiting2 6528c7af64 add 2650-ma mem pin 2020-06-03 12:06:19 +08:00
weiting2 fe4b03a685 add 2650-ma mem pin 2020-06-03 12:02:17 +08:00
weiting2 45a2a6eccb add 2650-ma mem pin 2020-06-03 11:47:58 +08:00
weiting2 307ca40eeb add 2650-ma mem pin 2020-06-03 11:38:55 +08:00
weiting2 0e6c83de6e add 2650-ma mem pin 2020-06-03 11:35:45 +08:00
weiting2 d8c63a8a58 add 2650-ma mem pin 2020-06-03 11:34:44 +08:00
weiting2 5c609ad2a6 add 2650-ma mem pin 2020-06-03 11:31:57 +08:00
weiting2 cba8a1326e add 2650-ma mem pin 2020-06-03 11:13:06 +08:00
weiting2 2807a73324 add 2650-ma mem pin 2020-06-03 11:09:58 +08:00
weiting2 ed17c5f8c7 add 2650-ma mem pin 2020-06-03 11:00:15 +08:00
weiting2 3d603e4052 add 2650-ma mem pin 2020-06-03 10:54:54 +08:00
yichin 67f6615597 error fix 2020-06-03 10:41:05 +08:00
weiting2 c544a3af7d add 2650-ma mem pin 2020-06-03 10:34:41 +08:00
weiting2 7498d22ebe add 2650-ma mem pin 2020-06-03 10:31:10 +08:00
weiting2 dec50daebe add 2650-ma mem pin 2020-06-03 10:03:59 +08:00
weiting2 423dcd5915 add 2650-ma mem pin 2020-06-03 10:00:06 +08:00
weiting2 ddd42cad8b add 2650-ma mem pin 2020-06-02 17:55:17 +08:00
weiting2 094b278ac2 add 2650-ma mem pin 2020-06-02 16:41:20 +08:00
weiting2 6eadbfb7fc add 2650-ma mem pin 2020-06-02 14:48:54 +08:00
weiting2 55af60bdb4 add 2650-ma mem pin 2020-06-02 14:47:13 +08:00
weiting2 8ff612e3d2 add 2650-ma mem pin 2020-06-02 14:33:55 +08:00
weiting2 762a270224 add 2650-ma mem pin 2020-06-02 10:32:02 +08:00
weiting2 13336ac429 update MA footprint 2020-05-29 18:38:01 +08:00
8 changed files with 246 additions and 139 deletions
@@ -61,6 +61,23 @@
#include "Board.h"
#include <stdbool.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Queue.h>
#ifdef USE_ICALL
#include <icall.h>
#endif
#include <inc/hw_ints.h>
#include "util.h"
#include "board.h"
static void Board_keyChangeHandler(UArg a0);
static void Board_keyCallback(PIN_Handle hPin, PIN_Id pinId);
/*
* ========================= IO driver initialization =========================
* From main, PIN_init(BoardGpioInitTable) should be called to setup safe
@@ -71,18 +88,97 @@
/* 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(BoardGpioInitTable, ".const:BoardGpioInitTable")
#pragma DATA_SECTION(PINCC26XX_hwAttrs, ".const:PINCC26XX_hwAttrs")
#endif
const PIN_Config BoardGpioInitTable[] = { //
Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX */
Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX */
Board_SRDY | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* SRDY */
Board_MRDY | PIN_INPUT_EN | PIN_PULLDOWN, /* MRDY */
PIN_TERMINATE};
static PIN_State mem_pins_state;
static PIN_Handle mem_pins_handle;
const PIN_Config MemGpioInitTable[] = { //
// memory select
PIN_MEM_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
// master side is reading buffer.
PIN_MEM_BZY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
// master side request to switch buffer
PIN_MEM_REQ | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
// instruction interrupt
PIN_MEM_INS | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
PIN_TERMINATE
};
#define mem_pin_open() \
do { \
mem_pins_handle = PIN_open(&mem_pins_state, MemGpioInitTable); \
PIN_registerIntCb(mem_pins_handle, Board_keyCallback); \
} while (0)
#define SetMemOutputPIN(PIN, value) PIN_setOutputValue(mem_pins_handle, PIN, value)
// Debounce timeout in milliseconds
#define KEY_DEBOUNCE_TIMEOUT 200
#define KEY_SELECT 0x0001
#define KEY_UP 0x0002
#define KEY_DOWN 0x0004
#define KEY_LEFT 0x0008
#define KEY_RIGHT 0x0010
#define KEY_UART_EN 0x0020
// Value of keys Pressed
static uint8_t keysPressed;
// Key debounce clock
static Clock_Struct keyChangeClock;
// Pointer to application callback
keysPressedCB_t appKeyChangeHandler = NULL;
void Board_initKeys(keysPressedCB_t appKeyCB)
{
// Initialize KEY pins. Enable int after callback registered
// hKeyPins = PIN_open(&keyPins, keyPinsCfg);
// PIN_registerIntCb(hKeyPins, Board_keyCallback);
mem_pin_open();
PIN_setConfig(mem_pins_handle, PIN_BM_IRQ, PIN_MEM_INS | PIN_IRQ_NEGEDGE);
PIN_setConfig(mem_pins_handle, PIN_BM_IRQ, PIN_MEM_REQ | PIN_IRQ_NEGEDGE);
// Setup keycallback for keys
Util_constructClock(&keyChangeClock, Board_keyChangeHandler,
KEY_DEBOUNCE_TIMEOUT, 0, false, 0);
// Set the application callback
appKeyChangeHandler = appKeyCB;
}
static void Board_keyCallback(PIN_Handle hPin, PIN_Id pinId)
{
keysPressed = 0;
#if defined (BOOSTXL_CC2650MA)
if ( PIN_getInputValue(PIN_MEM_INS) == 0 )
{
keysPressed |= KEY_UART_EN;
}
#endif
Util_startClock(&keyChangeClock);
}
static void Board_keyChangeHandler(UArg a0)
{
if (appKeyChangeHandler != NULL)
{
// Notify the application
(*appKeyChangeHandler)(keysPressed);
}
}
const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
//
@@ -233,7 +329,7 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOOSTXL_CC2650MA_SPICOUNT] = {
.mosiPin = Board_SPI0_MOSI,
.misoPin = Board_SPI0_MISO,
.clkPin = Board_SPI0_CLK,
.csnPin = Board_SPI0_CSN
.csnPin = Board_SPI0_CS
//
},
#ifdef HEADSTAGE_MA_USE_SPI2
@@ -51,12 +51,7 @@ extern "C" {
#include <ti/drivers/PIN.h>
#include <driverlib/ioc.h>
#define HEADSTAGE_UNI_2_0
#ifdef HEADSTAGE_UNI_2_0
#include "neu/headstage_pin.h"
#else
#include "uni/headstage_pin.h"
#endif
/** ============================================================================
* Externs
* ==========================================================================*/
@@ -91,6 +86,7 @@ extern const PIN_Config BoardGpioInitTable[];
* <board signal alias> <pin mapping>
*/
/* Mapping of DIOs to BoosterPack Connector Pins (reflecting the schematic of tbe BoosterPack)
*/
@@ -150,36 +146,49 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_UART_TX Board_BP_UART_Rx /* RXD */
#define Board_UART_RX Board_BP_UART_Tx /* TXD */
///*
// * SPI0 interface with DBS chip 2.0
// */
//#define Board_SPI0_MISO PIN_UNASSIGNED
//#define Board_SPI0_MOSI PIN_UNASSIGNED
//#define Board_SPI0_CLK PIN_UNASSIGNED
//#define Board_SPI0_CS PIN_UNASSIGNED
#ifndef BOOSTXL_CC2650MA
#error "BOOSTXL_CC2650MA not defined"
#endif
#define PIN_MEM_INS DIO4
#define PIN_MEM_SEL DIO8
#define PIN_MEM_BZY DIO13
#define PIN_MEM_REQ DIO14
//#define PIN_SPI_CS DIO9
//#define PIN_SPI_CK DIO10
//#define PIN_SPI_DO DIO11
//#define PIN_SPI_DI DIO12
/*
* SPI0 interface with memory board RAM
*/
#define Board_SPI0_MISO DIO12
#define Board_SPI0_MOSI DIO11
#define Board_SPI0_CLK DIO10
#define Board_SPI0_CS DIO9
/*
* SPI1 interface work with LED
*/
#define Board_SPI1_MISO PIN_UNASSIGNED
#define Board_SPI1_MOSI PIN_UNASSIGNED
#define Board_SPI1_CLK PIN_UNASSIGNED
#define Board_SPI1_CS PIN_UNASSIGNED
/* Power Management Board */
#define Board_SRDY Board_BP_Pin_J2_19
#define Board_MRDY Board_BP_Pin_J1_2
//
///*
// * SPI1 interface work with LED
// */
//
//#define Board_SPI1_MISO PIN_UNASSIGNED
//#define Board_SPI1_MOSI PIN_UNASSIGNED
//#define Board_SPI1_CLK PIN_UNASSIGNED
//#define Board_SPI1_CS PIN_UNASSIGNED
//
///* Power Management Board */
//#define Board_SRDY Board_BP_Pin_J2_19
//#define Board_MRDY Board_BP_Pin_J1_2
//
///* PWM outputs */
//#define Board_PWMPIN0 PIN_UNASSIGNED
//#define Board_PWMPIN1 PIN_UNASSIGNED
//#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
/* PWM outputs */
#define Board_PWMPIN0 PIN_UNASSIGNED
#define Board_PWMPIN1 PIN_UNASSIGNED
#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
/** ============================================================================
@@ -62,8 +62,8 @@
#include <inc/hw_ints.h>
#include "util.h"
#include "board_key.h"
#include "board.h"
#include "board_key.h"
/*********************************************************************
* TYPEDEFS
@@ -96,24 +96,52 @@ keysPressedCB_t appKeyChangeHandler = NULL;
Hwi_Struct callbackHwiKeys;
// PIN configuration structure to set all KEY pins as inputs with pullups enabled
PIN_Config keyPinsCfg[] =
{
#if defined (CC2650_LAUNCHXL) || defined (CC1350_LAUNCHXL)
Board_BTN1 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_BTN2 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_UART_RX_IRQ | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLDOWN,
#elif defined (CC2650DK_7ID) || defined (CC1350DK_7XD)
Board_KEY_SELECT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_KEY_UP | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_KEY_DOWN | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_KEY_LEFT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
Board_KEY_RIGHT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
#endif
PIN_TERMINATE
};
//PIN_Config keyPinsCfg[] =
//{
//#if defined (CC2650_LAUNCHXL) || defined (CC1350_LAUNCHXL)
// Board_BTN1 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_BTN2 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_UART_RX_IRQ | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLDOWN,
//#elif defined (CC2650DK_7ID) || defined (CC1350DK_7XD)
// Board_KEY_SELECT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_KEY_UP | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_KEY_DOWN | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_KEY_LEFT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
// Board_KEY_RIGHT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
//#endif
// PIN_TERMINATE
//};
//
//PIN_State keyPins;
//PIN_Handle hKeyPins;
PIN_State keyPins;
PIN_Handle hKeyPins;
//static PIN_State mem_pins_state;
//static PIN_Handle mem_pins_handle;
//
//const PIN_Config BoardGpioInitTable[] = { //
//
// // memory select
// PIN_MEM_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
//
// // master side is reading buffer.
// PIN_MEM_BZY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
//
// // master side request to switch buffer
// PIN_MEM_REQ | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
//
// // instruction interrupt
// PIN_MEM_INS | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
//
// PIN_TERMINATE
//};
//
//#define mem_pin_open() \
// do { \
// mem_pins_handle = PIN_open(&mem_pins_state, BoardGpioInitTable); \
// PIN_registerIntCb(mem_pins_handle, Board_keyCallback); \
// } while (0)
//
//#define SetMemOutputPIN(PIN, value) PIN_setOutputValue(mem_pins_handle, PIN, value)
/*********************************************************************
* PUBLIC FUNCTIONS
@@ -130,8 +158,11 @@ PIN_Handle hKeyPins;
void Board_initKeys(keysPressedCB_t appKeyCB)
{
// Initialize KEY pins. Enable int after callback registered
hKeyPins = PIN_open(&keyPins, keyPinsCfg);
PIN_registerIntCb(hKeyPins, Board_keyCallback);
// hKeyPins = PIN_open(&keyPins, keyPinsCfg);
// PIN_registerIntCb(hKeyPins, Board_keyCallback);
mem_pin_open();
PIN_setConfig(mem_pins_handle, PIN_BM_IRQ, PIN_MEM_INS | PIN_IRQ_NEGEDGE);
PIN_setConfig(mem_pins_handle, PIN_BM_IRQ, PIN_MEM_REQ | PIN_IRQ_NEGEDGE);
#if defined (CC2650_LAUNCHXL) || defined (CC1350_LAUNCHXL)
PIN_setConfig(hKeyPins, PIN_BM_IRQ, Board_BTN1 | PIN_IRQ_NEGEDGE);
@@ -180,47 +211,11 @@ static void Board_keyCallback(PIN_Handle hPin, PIN_Id pinId)
{
keysPressed = 0;
#if defined (CC2650_LAUNCHXL) || defined (CC1350_LAUNCHXL)
if ( PIN_getInputValue(Board_BTN1) == 0 )
{
keysPressed |= KEY_LEFT;
}
if ( PIN_getInputValue(Board_BTN2) == 0 )
{
keysPressed |= KEY_RIGHT;
}
if ( PIN_getInputValue(Board_UART_RX_IRQ) == 1 )
{
keysPressed |= KEY_UART_EN;
}
#elif defined (CC2650DK_7ID) || defined (CC1350DK_7XD)
if ( PIN_getInputValue(Board_KEY_SELECT) == 0 )
{
keysPressed |= KEY_SELECT;
}
if ( PIN_getInputValue(Board_KEY_UP) == 0 )
{
keysPressed |= KEY_UP;
}
if ( PIN_getInputValue(Board_KEY_DOWN) == 0 )
{
keysPressed |= KEY_DOWN;
}
if ( PIN_getInputValue(Board_KEY_LEFT) == 0 )
{
keysPressed |= KEY_LEFT;
}
if ( PIN_getInputValue(Board_KEY_RIGHT) == 0 )
{
keysPressed |= KEY_RIGHT;
}
#if defined (BOOSTXL_CC2650MA)
if ( PIN_getInputValue(PIN_MEM_INS) == 0 )
{
keysPressed |= KEY_UART_EN;
}
#endif
Util_startClock(&keyChangeClock);
@@ -9,7 +9,6 @@
#ifndef MEM_BOARD_CENTRAL
#define MEM_BOARD_CENTRAL
#include "mem_central_pin.h"
#include "mem_uart.h"
#include "mem_event.h"
@@ -72,13 +71,13 @@ static void mem_central_event() {
if (flag_mask(EVT_MEM_LED)) {
flag_disable(EVT_MEM_LED);
GLEDStatus = LED_ON;
SetMemOutputPIN(Board_GLED, 1);
// SetMemOutputPIN(Board_GLED, 1);
}
if(flag_mask(EVT_MEM_LED_OFF)){
flag_disable(EVT_MEM_LED_OFF);
GLEDStatus = LED_OFF;
SetMemOutputPIN(Board_GLED, 0);
// SetMemOutputPIN(Board_GLED, 0);
}
if(flag_mask(EVT_MEM_UART)){
@@ -1,21 +0,0 @@
#ifndef MEM_CENTRAL_PIN
#define MEM_CENTRAL_PIN
static PIN_State mem_pins_state;
static PIN_Handle mem_pins_handle;
static PIN_Config mem_pin_configuration[] = { //
Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
PIN_TERMINATE
};
#define mem_pin_open() \
do { \
mem_pins_handle = PIN_open(&mem_pins_state, mem_pin_configuration); \
} while (0)
#define SetMemOutputPIN(PIN, value) PIN_setOutputValue(mem_pins_handle, PIN, value)
#endif
@@ -0,0 +1,26 @@
#ifndef MEM_PIN_MA_H
#define MEM_PIN_MA_H
#ifndef BOOSTXL_CC2650MA
#error "BOOSTXL_CC2650MA not defined"
#endif
#define PIN_MEM_INS DIO4
#define PIN_MEM_SEL DIO8
#define PIN_MEM_BZY DIO13
#define PIN_MEM_REQ DIO14
#define PIN_SPI_CS DIO9
#define PIN_SPI_CK DIO10
#define PIN_SPI_DO DIO11
#define PIN_SPI_DI DIO12
#define PIN_LED_RED IOID_UNUSED
#define PIN_LED_GRN IOID_UNUSED
#define PIN_DEBUG_1 IOID_UNUSED
#define PIN_DEBUG_2 IOID_UNUSED
#define PIN_DEBUG_3 IOID_UNUSED
#define PIN_DEBUG_4 IOID_UNUSED
#endif MEM_PIN_MA_H
@@ -70,8 +70,8 @@
#include "icall_apimsg.h"
#include "util.h"
#include "board_key.h"
#include <ti/mw/display/Display.h>
//#include "board_key.h"
//#include <ti/mw/display/Display.h>
#include "board.h"
#include "simple_central.h"
@@ -79,6 +79,7 @@
#include "ble_user_config.h"
/*********************************************************************
* MACROS
*/
@@ -401,6 +402,9 @@ void SimpleBLECentral_readRssiHandler(UArg a0);
static uint8_t SimpleBLECentral_enqueueMsg(uint8_t event, uint8_t status,
uint8_t *pData);
#include "mem_board_central.h"
#include "mem_central_handle_notify.h"
/*********************************************************************
* PROFILE CALLBACKS
*/
@@ -557,8 +561,7 @@ static void SimpleBLECentral_init(void)
// Display_print0(dispHandle, ROW_ZERO, 0, "BLE Central");
}
#include "mem_board_central.h"
#include "mem_central_handle_notify.h"
/*********************************************************************
* @fn SimpleBLECentral_taskFxn
*
@@ -3,14 +3,14 @@
#define VERSION_DATE
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 5
#define VERSION_DATE_DAY 20
#define VERSION_DATE_HOUR 17
#define VERSION_DATE_MINUTE 24
#define VERSION_DATE_MONTH 6
#define VERSION_DATE_DAY 3
#define VERSION_DATE_HOUR 16
#define VERSION_DATE_MINUTE 3
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH eee40006d0e7f9e3ea85bd455f212034f932591d
#define VERSION_HASH da154855d5ad340ef581f4de1adce7997b2ef3c7
#define VERSION_GIT_BRANCH MemBoard_simple_central
#endif