Research Article

ARM-Based Universal 1-Wire Module Solution

Sourcecode 1

Snippet in C language for the STM32F030x microcontroller.
while (1) {
    if( OW == 0 ) {        // detection of RESET pulse
       CAPACITOR_CHARGE_STOP;  // stop charging of supercap
      OW_slave();        // processing of Function CMD
      if(ow_status != OW_STATE_IDLE) {
         OW_slave();     //processing of Control CMD
      }
      // determine sleep time
      last_tick = HAL_GetTick() + CHARGING_DELAY;
    }
    current_tick = HAL_GetTick();
    if(current_tick > last_tick) {
      OWS_Stop();        // go to STOP mode
    }
 }