Part Number: CC1350
I am working on a BLE application with the CC1350 and when I am reading from the sensor it works fine but when I set to notify it no longer updates the value
bStatus_t ADXL_setParameter(uint8_t param, uint8_t len, void *value)
{
bStatus_t ret = SUCCESS;
switch (param)
{
case SENSOR_DATA:
if (len == SENSOR_DATA_LEN)
{
memcpy(sensorData, value, SENSOR_DATA_LEN);
// See if Notification has been enabled
ret = GATTServApp_ProcessCharCfg(sensorDataConfig, sensorData, FALSE,
sensorAttrTable,
GATT_NUM_ATTRS(sensorAttrTable),
INVALID_TASK_ID, sensor_ReadAttrCB);
}
else
{
ret = bleInvalidRange;
}
break;
case SENSOR_CONF:
if (len == sizeof(uint8_t))
{
sensorCfg = *((uint8_t*)value);
}
else
{
ret = bleInvalidRange;
}
break;
case SENSOR_PERI:
if (len == sizeof(uint8_t))
{
sensorPeriod = *((uint8_t*)value);
}
else
{
ret = bleInvalidRange;
}
break;
default:
ret = INVALIDPARAMETER;
break;
}
return (ret);
}
This is the code to set the parameter and here is my task loop for reading the sensor
static void sensorTaskFxn(UArg a0, UArg a1)
{
uint8_t data[SENSOR_DATA_LEN];
if(!adxlRegistered){
DELAY_MS(100);
}
// Register task with BLE stack
ICall_registerApp(&sensorSelfEntity, &sensorSem);
// Deactivate task (active only when measurement is enabled)
Task_setPri(Task_handle(&sensorTask), -1);
// Task loop
while (true)
{
data[0] = 0;
if (sensorConfig == ST_CFG_SENSOR_ENABLE)
{
// Read data
ADXL_read(data);
// Update GATT
ADXL_setParameter(SENSOR_DATA, SENSOR_DATA_LEN, data);
// Next cycle
DELAY_MS(100000);
}
else
{
DELAY_MS(SENSOR_DEFAULT_PERIOD);
}
}
}
I used the SensorTag example code for reference but I cannot see what I am doing wrong.