Doc: new IDE setting image & clean unused function

This commit is contained in:
Roy
2023-06-07 17:18:03 +08:00
parent 334a68c6fe
commit 9e285b43fb
28 changed files with 0 additions and 280 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

@@ -13,8 +13,6 @@ static GPTimerCC26XX_Handle gptimer_handle;
static void elite_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask);
#define elite_gptimer_start() GPTimerCC26XX_start(gptimer_handle)
#define elite_gptimer_stop() GPTimerCC26XX_stop(gptimer_handle)
#define elite_gptimer_close() GPTimerCC26XX_close(gptimer_handle)
#define CLOCK_FREQ 4800 // clock freq = 0.1 ms(4800), Measured(4769)
#define elite_gptimer_open() \
@@ -15,44 +15,28 @@
#include "mem_central_handle_notify.h"
#include "mem_uart_routine.h"
//#include "uart_printf.h"
//#include <xdc/runtime/System.h>
#define BLE_CDR_SAMLL_SIZE 10
#define BLE_CHAR2_HANDLE 0x0021 // read CIS return data
#define BLE_CHAR3_HANDLE 0x0024 // send instruction
#define BLE_CHAR4_CONFIG_HANDLE 0x0028 // notify enable: 0100=enable; 0000=disable
#define RET_INFO_BUF_SIZE 52
#define CIS_BUFF_PREFIX 3
#define CIS_BUFF_SUFFIX 2
#define CIS_DATA_LEN 50
static uint16_t CIS_length = 10;
static char CIS_data[CIS_DATA_LEN];
static void mem_central_event();
static void mem_recv_ins();
static void mem_connect_device(uint8_t addrType, uint8_t *peerAddr);
static void mem_send_ins(uint16_t hadnle, uint8_t *value);
static void mem_read_data_and_return();
static void mem_central_get_cis(uint8_t handle);
static void mem_connection_timeout();
static void MemBoard_init(void){
mem_UART_init();
master_spi_open();
central_ram_init();
central_reset();
flag_enable(EVT_MEM_UART_ROUTINE);
// uint8_t txBuf[] = "Simple Central memory board MA\n\r"; // Transmit buffer
// UART_txBuf = txBuf;
// UART_write(uart_handle, txBuf, sizeof(txBuf));
// mem_UART_display(txBuf);
}
static EventTableEntry EVENT_TABLE[] = { //
@@ -74,57 +58,17 @@ static void mem_event_handle() {
}
}
typedef enum{
LED_OFF,
LED_ON
} LED_Status;
typedef enum{
UART_NO_DATA,
UART_RECEIVED_DATA
} UART_DATA_Status;
static LED_Status GLEDStatus = LED_OFF;
static UART_DATA_Status UARTStatus = UART_NO_DATA;
static void mem_central_event() {
if(flag_mask(EVT_MEM_NOTIFY_HANDLE)){
flag_disable(EVT_MEM_NOTIFY_HANDLE);
// notify_handle_done = false;
central_handle_notify();
}
// if (flag_mask(EVT_PIN_REQST)){
// flag_disable(EVT_PIN_REQST);
//
// // spi idle
// if (notify_handle_done){
// master_switch_memory();
// }
// // spi busy
// else{
// ram_sw = true;
// }
// }
if(flag_mask(EVT_MEM_UART_ROUTINE)){
flag_disable(EVT_MEM_UART_ROUTINE);
mem_uart_routine();
}
// if (flag_mask(EVT_MEM_LED)) {
// flag_disable(EVT_MEM_LED);
// GLEDStatus = LED_ON;
//// SetMemOutputPIN(Board_GLED, 1);
// }
//
// if(flag_mask(EVT_MEM_LED_OFF)){
// flag_disable(EVT_MEM_LED_OFF);
// GLEDStatus = LED_OFF;
//// SetMemOutputPIN(Board_GLED, 0);
// }
if(flag_mask(EVT_MEM_INS_CHECK_SURVIVE)){
flag_disable(EVT_MEM_INS_CHECK_SURVIVE);
@@ -168,94 +112,10 @@ static void mem_central_event() {
mem_read_data_and_return();
}
if(flag_mask(EVT_MEM_CONN_TIMEOUT)){
flag_disable(EVT_MEM_CONN_TIMEOUT);
mem_connection_timeout();
}
}
static Control_Ins ins = INS_IDLE;
static void mem_recv_ins(){
extern uint8_t keysPressed;
extern Clock_Struct keyChangeClock;
switch(UART_rxBuf[0]){
case INS_IDLE:{
break;
}
case INS_RESET:{
state = BLE_STATE_IDLE;
connHandle = GAP_CONNHANDLE_INIT;
discState = BLE_DISC_STATE_IDLE;
break;
}
case INS_KEY:{
if(UART_rxBuf[2] == 1){
keysPressed = KEY_LEFT;
Util_startClock(&keyChangeClock);
}
else if(UART_rxBuf[2] == 2){
keysPressed = KEY_RIGHT;
Util_startClock(&keyChangeClock);
}
break;
}
case INS_SCAN:{
SimpleBLECentral_discoverDevices();
break;
}
// instruction format:
// ins[0]: INS_SCAN_RESPONSE = 0x04
// ins[1]: scan_response (device number)=0, a certain device = device_id
// ins[2]: attr_length=0, e.g. len(addr)=6, len(company_code)=4, len(localName)=20
// addr=1, localName=2, company_code=3, version_info=4, battery_info=5
case INS_CONNECT:{
mem_connect_device(UART_rxBuf[2], UART_rxBuf+3);
break;
}
case INS_WRITE:{
if(state == BLE_STATE_CONNECTED){
// This is done by SimpleBLECentral_processRoleEvent() in the case "GAP_LINK_ESTABLISHED_EVENT"
mem_send_ins(UART_rxBuf[2], UART_rxBuf+3);
}
break;
}
case INS_READ:{
if(state == BLE_STATE_CONNECTED){
mem_central_get_cis(UART_rxBuf[2]);
}
break;
}
case INS_DISCONNECT:{
// clear scan result
GAPCentralRole_TerminateLink(connHandle);
state = BLE_STATE_DISCONNECTING;
break;
}
default:{
uint8_t error_msg[35] = "error";
error_msg[6] = state;
error_msg[7] = 0xFF;
for(int i = 0 ; i < UART_BUFF_SIZE ; i++){
error_msg[8+i] = UART_rxBuf[i];
}
UART_write(uart_handle, error_msg, 35);
break;
}
}
}
static void mem_connect_device(uint8_t addrType, uint8_t *peerAddr) {
uint8_t Addr[B_ADDR_LEN];
@@ -414,8 +274,4 @@ static void mem_read_data_and_return(){
memset(CIS_data, 0, CIS_DATA_LEN);
}
static void mem_connection_timeout(){
}
#endif
@@ -18,7 +18,6 @@
#define MSM_REG_WRITE 0x01
#define MEM_INS_WRITE 0x02
#define MEM_INS_READ 0x03
#define MEM_REG_READ 0x05
#define MEM_META_LENGTH 12
@@ -32,19 +32,6 @@ static SPI_Transaction central_spi_transaction;
#define SPI_close() SPI_close(central_spi_handle)
static void SPI_reopen(){
SPI_init();
SPI_Params spi_parameter;
SPI_Params_init(&spi_parameter);
spi_parameter.transferMode = SPI_MODE_BLOCKING;
spi_parameter.mode = SPI_MASTER;
spi_parameter.bitRate = 8000000;
spi_parameter.transferTimeout = 1000;
spi_parameter.dataSize = 8;
spi_parameter.frameFormat = SPI_POL0_PHA0;
central_spi_handle = SPI_open(Board_SPI0, &spi_parameter);
}
#define central_spi_send(data, len) \
do { \
central_spi_transaction.txBuf = data; \
@@ -40,12 +40,8 @@
/** event */
#define EVT_ALL 0xFFFF
#define EVT_MEM_LED 0x0001 /**< set led event */
#define EVT_MEM_LED_OFF 0x0002
#define EVT_MEM_DECODE_INS 0x0004
//#define EVT_PIN_REQST 0x0008
#define EVT_MEM_RETURN_DATA 0x0010
#define EVT_MEM_CONN_TIMEOUT 0x0020
#define EVT_MEM_NOTIFY_HANDLE 0x0040
#define EVT_MEM_UART_ROUTINE 0x0080
@@ -38,12 +38,8 @@ typedef enum{
/** event */
#define EVT_ALL 0xFFFF
#define EVT_MEM_LED 0x0001 /**< set led event */
#define EVT_MEM_LED_OFF 0x0002
#define EVT_MEM_DECODE_INS 0x0004
//#define EVT_PIN_REQST 0x0008
#define EVT_MEM_RETURN_DATA 0x0010
#define EVT_MEM_CONN_TIMEOUT 0x0020
#define EVT_MEM_NOTIFY_HANDLE 0x0040
#define EVT_MEM_UART_ROUTINE 0x0080
#define EVT_MEM_INS_SCAN 0x0100
@@ -61,9 +57,6 @@ typedef enum{
(_b)[0] == INS_DISCONNECT || \
(_b)[0] == INS_CHECK_SURVIVE)
#define IS_FINAL_RX_BYTE(_i, _l) (((_i) == (_l) + 1) && (store_rxBuf[(_l) + 1] == 0xF1))
static void mem_recv_uart();
// Callback function
static void readCallback(UART_Handle handle, void *rxBuf, size_t size)
@@ -142,8 +135,6 @@ static void readCallback(UART_Handle handle, void *rxBuf, size_t size)
static void mem_UART_init(){
// uint32_t timeoutUs = 5000; // 5ms timeout, default timeout is no timeout (BIOS_WAIT_FOREVER)
// Init UART and specify non-default parameters
UART_Params_init(&params);
params.baudRate = 115200;
@@ -151,53 +142,10 @@ static void mem_UART_init(){
params.readMode = UART_MODE_CALLBACK;
params.readDataMode = UART_DATA_BINARY;
params.readCallback = readCallback;
// params.readTimeout = timeoutUs / Clock_tickPeriod; // Default tick period is 10us
// params.readTimeout = ti_sysbios_BIOS_WAIT_FOREVER;
// Open the UART and do the read
uart_handle = UART_open(Board_UART, &params);
// int rxBytes = UART_read(uart_handle, rxBuf, 100);
return;
}
static void mem_UART_display(char *str){
// calculate string size
uint8_t str_size;
for(str_size=0 ; *(str+str_size)!='\0' && str_size < 10; str_size++){
// do nothing
}
str_size ++;
char *out_str = malloc((str_size) * sizeof(char));
// char *out_str = str;
for(int i=0 ; i<str_size ; i++){
*(out_str+i) = *(str+i);
}
UART_write(uart_handle, out_str, str_size);
free(out_str);
out_str = NULL;
}
static void mem_UART_clear_screen(){
uint8_t cls[] = "\033[2J";
UART_write(uart_handle, cls, sizeof(cls));
}
static void mem_UART_newline(){
char out_str[2] = {'\n', '\r'};
UART_write(uart_handle, out_str, 2);
}
static void mem_recv_uart(){
UART_read(uart_handle, UART_rxBuf, 10);
}
static void mem_send_recv_uart(){
UART_write(uart_handle, UART_rxBuf, 10);
}
#endif
@@ -7,7 +7,6 @@
static void mem_uart_routine(){
if (uartProcedureInProgress == FALSE) {
// uartProcedureInProgress = TRUE;
int rxBytes = UART_read(uart_handle, UART_rxBuf, 1);
} else {
flag_notify(EVT_MEM_UART_ROUTINE);
@@ -907,69 +907,6 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent)
*/
static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys)
{
// switch (state) {
// case BLE_STATE_IDLE:
// if(keys & KEY_REQ){
// flag_notify(EVT_PIN_REQST);
// }
//
// if(keys & KEY_UART_EN)
// {
// flag_notify(EVT_MEM_DECODE_INS);
// }
//
// break;
//
// case BLE_STATE_DISCOVERED:
// if(keys & KEY_REQ){
// flag_notify(EVT_PIN_REQST);
// }
//
// if(keys & KEY_UART_EN)
// {
// flag_notify(EVT_MEM_DECODE_INS);
// }
//
// break;
//
// case BLE_STATE_BROWSING:
// if(keys & KEY_REQ){
// flag_notify(EVT_PIN_REQST);
// }
//
// if(keys & KEY_UART_EN){
// flag_notify(EVT_MEM_DECODE_INS);
// }
//
// break;
//
// case BLE_STATE_CONNECTING:
// //Nothing happens if buttons are pressed while the device is connecting.
// break;
//
// case BLE_STATE_CONNECTED:
// if(keys & KEY_REQ){
// flag_notify(EVT_PIN_REQST);
// }
//
// if(keys & KEY_UART_EN)
// {
// flag_notify(EVT_MEM_DECODE_INS);
// }
//
// break;
//
// default:
// if (keys & KEY_REQ) {
// flag_notify(EVT_PIN_REQST);
// }
//
// if (keys & KEY_UART_EN) {
// flag_notify(EVT_MEM_DECODE_INS);
// }
// break;
// }
return;
}