This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SIMPLELINK-CC2640R2-SDK: v2.30: Integrating Sensor Controller Code to Simple Peripheral?

Part Number: SIMPLELINK-CC2640R2-SDK


Hi,

   I am going to use Sensor Controller to read 2 Analog Sensors and 1 I2C Accelerometer Sensor every 1 minute. After reading the sensors, the application will send the sensor data to a bluetooth service. I have only the Device Information Service, and Custom Bluetooth Service for sending sending sensor data.

   I am reading this "Integrating Sensor Controller Studio Examples to Project Zero" doc, as guide. The doc shows creating another task and using semaphores. Is it possible to integrate the Sensor Controller Code to Simple Peripheral without creating another task and using semaphores? Can I just use the Simple Peripheral task for this? How do I process the semScTaskAlert with using Event_post() or Queing Messages to wake up the main application.

-kel

  • Hi Kel,

    This should be possible and I could not find any available example therefore I'll create a quick example on how to do this.

    Best regards,

    David
  • Hi Kel,

      You can do the following:

    
    #define BV(n)               (1 << (n))
    Static Uint16_t     localGlobalVariable; 
    void scCtrlReadyCallback(void) {
    
    } // scCtrlReadyCallback
    
    void scTaskAlertCallback(void) {
           //save sensor controller value to local variable
                    localGlobalVariable = scifTaskData.newTask…… ;
            // Clear the ALERT interrupt source
            scifClearAlertIntSource();
    
            // Acknowledge the alert event
            scifAckAlertEvents();
    // Wake up the OS task
    
    } // scTaskAlertCallback
    
    void simplePeriph_taskInit(UArg a0, UArg a1) {
    
        // Initialize the Sensor Controller
        scifOsalInit();
        scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
        scifInit(&scifDriverSetup);
    
    //    //Start the RTC running at ~385.5Hz
        scifStartRtcTicksNow(0x000000AA);
    
        // Configure and start the Sensor Controller's
        // Sensor Controller task (not to be confused with OS tasks)
        scifStartTasksNbl(BV(SCIF_NEW_TASK_TASK_ID));
    .
    ..
    .
    .
    .
    }

     Best regards,

        David

  • Thanks, I will try that with one of the Sensor Controller example.

    -kel