Skip to main content
. 2024 May 16;24(10):3172. doi: 10.3390/s24103172
Algorithm A1. Control Protocol
static void Pulse_Start(void)
{ HW_TS_Stop(TimerId.Pulse);
     Pulse.State = ENABLE;
     Pulse.Count = 0;
     Pulse.Period = 0;
     // In the Pulse_Start function, set when the pulse starts and call the HW_TS_Start function to start the timer.
     // The Pulse_Task function performs different operations depending on the pulse mode status.
     HAL_GPIO_WritePin(DCDC_EN_GPIO_Port, DCDC_EN_Pin, SET);
     MAX5531_Command(0b1111, 0);
     MAX5531_Command(0b1100, 0×0400); //Enter Standby, Set RefV: 1.940 V
     switch (Pulse.Mode)
     { case NORMAL:
         { HW_TS_Start(TimerId.Pulse, 1×1000×1000/CFG_TS_TICK_VAL/Param_Table.Frequency[Normal_Param.Frequency]);
             break;
         }
         case MAGNET:
         { HW_TS_Start(TimerId.Pulse, 1×1000×1000/CFG_TS_TICK_VAL/Param_Table.Frequency[Magnet_Param.Frequency]);
             break;
         }
         default:
             break;
     }
}
static void Pulse_Task(void)
{    switch (Pulse.Mode)
     { case NORMAL:
         { switch (Pulse.Ramp)
             { case RAMP_DISABLE:
                 { MAX5531_Command(0b1111, Param_Table.Current [Normal_Param.Current]);