Alex

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Modification of Lab13 (Iot and Creator) #64577

    Alex
    Participant

    Hi Michael,
    There is already another temperature sensor object in the WiFire code, so you’ll just add another instance.
    1. In temperature_object.c, add another instance by changing the #define of TEMPERATURE_INSTANCES to 2
    2. In ui_control.c, add code to the function UIControl_pollInputSensors to read the shield thermometer and update the new temperature object instance (#1).

          
    TemperatureObject_Input(0, AdcDriver_GetTemperatureDegrees(true));  // Read temperature in Celsius
    TemperatureObject_Input(1, YourShieldTemperatureReaderFunction());  // Read shield temperature in Celsius
    

    BTW, the call graph viewer in MPLAB X is quite helpful for navigating through the code at the function level, especially to find a function’s callers.
    3. Create your function YourShieldTemperatureReaderFunction.
    4. Since the temperature sensor uses an I2C interface, you’ll need to add I2C support for the app. This involves modifying the project with Harmony (Tools->Embedded->MPLAB Harmony Configurator) and selecting Harmony Framework Configuration->Drivers->I2C->Use I2C Driver. Then you’ll need to plug in calls to the code to initialize (in APP_Initialize) and use the I2C peripheral. I haven’t done this, so I don’t have further details at this point in time.

    I hope this helps! Please let me know if you have further questions or get stuck.

Viewing 1 post (of 1 total)