SSDA009 August   2025 HDC2010 , MSPM0C1104 , OPT3001

 

  1.   1
  2. 1Description
  3. 2Required Peripherals
  4. 3Sensor Evaluation Modules
  5. 4Design Considerations
  6. 5Software Flowchart
  7. 6Application Code
  8. 7Results
  9. 8Additional Resources
  10. 9Trademarks

Application Code

int main(void)
{ 
  SYSCFG_DL_init(); 
  /* Set LED to indicate start of transfer */
  DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);

  setMeasurementConfigurationsForSensors();

  while (1)  
  {
    takeMeasurements(); 

    /* Interpret values */
    gHumidityRH = HDC2010_humToIntRelative(gHumidity);
    gTemperatureCelsius = HDC2010_tempToFloatCelsius(gTemperature);
    gLightLux = 0.01 * pow(2, gExponent) * gResult;
    delay_cycles(24000);

    sendToUARTReceiver(); 

    /* If write and read were successful, toggle LED every second till next measurement */
    for (uint8_t i = 0; i < gSecDelay; i++) {
      DL_GPIO_togglePins(GPIO_LEDS_PORT,
      GPIO_LEDS_USER_LED_1_PIN);
      delay_cycles(24000000);
    }
  }
}