Sensor Controller Studio 是一款 Windows 应用程序,用于开发和调试基于 CC26xx/CC13xx 传感器控制器的任务。此程序将帮助开发人员快速创建可独立于系统 CPU 运行的应用,并自主执行简单的后台任务。
下面以CC2640R2F为例:
第一步先产生SCScode:
二。进行上述操作后就可以在对应目录下找到相应的工程。
编译成功,没有报错,上电运行正常。
三)如何把SCS工程加入到普通的BLE工程。
scif.c
scif.h
scif_framework.c
scif_framework.h
scif_osal_tirtos.c
scif_osal_tirtos.h
把这些文件添加到工程目录下。然后修改一个为一个线程。
static void sensorTaskFxn(UArg a0, UArg a1)
{
.......
// Initialize the Sensor Controller
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
scifStartRtcTicksNow(0x00010000 / 128);
// Configure and start the ADC Data Logger task. The task does not signalize data exchange, but
// has buffering capacity for 256 samples = 2 seconds
scifStartTasksNbl(BV(SCIF_ADC_DATA_LOGGER_TASK_ID));
// Task loop
uint16_t tail = 0;
while (true)
{
if ( sensorConfig == ST_CFG_SENSOR_ENABLE )
{
Data_t data;
// Wake up every 1 seconds
Task_sleep(1000000 / Clock_tickPeriod);
// Fetch the current head index
uint16_t head = scifTaskData.adcDataLogger.output.head;
while (tail != head) {
data= scifTaskData.adcDataLogger.output.pSamples[tail];
// Increment the tail index
if (++tail >= (sizeof(scifTaskData.adcDataLogger.output.pSamples) / sizeof(uint16_t))) {
tail = 0;
}
..
}
重点函数:SCS生成的代码添加大CCS工程中之后,还需要在CCS原工程中触发SCS代码进行迭代:scifStartTasksNbl PS:大家可能发现开始是LED,后来变成了ADC,是我太懒了,拿了一部分同事的Code作为讲解。
如果有什么不懂得可以去看TI的视频比我讲的详细很多:http://software-dl.ti.com/lprf/simplelink_academy/overview.html
https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/p/607699/2236580