[update] clear code

This commit is contained in:
Roy
2023-07-12 14:26:36 +08:00
parent 1cd1ccabb8
commit 607ccb6e27
2 changed files with 41 additions and 36 deletions
@@ -2,20 +2,24 @@
#include <ti/drivers/SPI.h>
#include "HAL/cc2650_driver/spi_ctrl.h"
/*
SPI bit rate in Hz.
Maximum bit rates supported by hardware:
+---------------+-----------------+------------------+
| Device Family | Slave Max (MHz) | Master Max (MHz) |
+---------------+-----------------+------------------+
| MSP432P4 | 16 MHz | 24 MHz |
| MSP432E4 | 10 MHz | 60 MHz |
| CC13XX/CC26XX | 4 MHz | 12 MHz |
| CC32XX | 20 MHz | 20 MHz |
+---------------+-----------------+------------------+
Please note that depending on the specific use case, the driver may not support the hardware's maximum bit rate.
*/
* Read SPI example in
* http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_14_02_22/
* exports/tirtos_full_2_14_02_22/docs/doxygen/html/_s_p_i_c_c26_x_x_d_m_a_8h.html
*
* SPI bit rate in Hz.
*
* Maximum bit rates supported by hardware:
*
* +---------------+-----------------+------------------+
* | Device Family | Slave Max (MHz) | Master Max (MHz) |
* +---------------+-----------------+------------------+
* | MSP432P4 | 16 MHz | 24 MHz |
* | MSP432E4 | 10 MHz | 60 MHz |
* | CC13XX/CC26XX | 4 MHz | 12 MHz |
* | CC32XX | 20 MHz | 20 MHz |
* +---------------+-----------------+------------------+
* Please note that depending on the specific use case, the driver may not support the hardware's maximum bit rate.
*/
/* system use SPI parameters */
static SPI_Handle spiHandle0 = NULL;
@@ -92,9 +92,6 @@
#include "simple_peripheral.h"
// #include "EliteGPTimer.h"
#include <Board.h>
#include <ti/drivers/timer/GPTimerCC26XX.h>
#include <ti/sysbios/BIOS.h>
@@ -110,26 +107,31 @@ 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 4769 // clock freq = 0.1 ms(4800), Measured(4769)
#define elite_gptimer_open() \
do { \
GPTimerCC26XX_Params params; \
GPTimerCC26XX_Params_init(&params); \
params.width = GPT_CONFIG_16BIT; \
params.mode = GPT_MODE_PERIODIC_UP; \
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF; \
gptimer_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &params); \
Types_FreqHz freq; \
BIOS_getCpuFreq(&freq); \
GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; /*47999*/ \
GPTimerCC26XX_setLoadValue(gptimer_handle, loadVal); \
GPTimerCC26XX_setLoadValue(gptimer_handle, CLOCK_FREQ); /* 0.1 ms*/ \
GPTimerCC26XX_registerInterrupt(gptimer_handle, elite_gptimer_callback, GPT_INT_TIMEOUT); \
} while (0)
void elite_gptimer_open()
{
GPTimerCC26XX_Params params;
GPTimerCC26XX_Params_init(&params);
params.width = GPT_CONFIG_16BIT;
params.mode = GPT_MODE_PERIODIC_UP;
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
gptimer_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &params);
if (gptimer_handle == NULL) {
Task_exit();
}
Types_FreqHz freq;
BIOS_getCpuFreq(&freq);
GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; //47999 = 1ms
loadVal = CLOCK_FREQ; //0.1ms
GPTimerCC26XX_setLoadValue(gptimer_handle, loadVal);
GPTimerCC26XX_registerInterrupt(gptimer_handle, elite_gptimer_callback, GPT_INT_TIMEOUT);
GPTimerCC26XX_start(gptimer_handle);
return;
}
#include <driverlib/timer.h>
#include <ti/drivers/SPI.h>
@@ -1157,7 +1159,6 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
i2c0_open(I2C_400K);
elite_gptimer_open();
elite_gptimer_start();
InitEliteInstruction();