Relay#
Functions
-
struct relay *relay_create(struct lm_pwm_channel *pwm_handle)#
Creates a relay instance.
This function initializes and allocates memory for a relay structure with the specified PWM channel handle.
- Parameters:
pwm_handle – [in] Pointer to the PWM channel structure.
- Returns:
struct relay* Pointer to the created relay structure.
-
void relay_destroy(struct relay *self)#
Destroys a relay instance.
This function deallocates the memory and cleans up resources associated with the specified relay structure.
- Parameters:
self – [inout] Pointer to the relay structure to be destroyed.
-
int relay_enable(struct relay *self)#
Enables the relay.
This function enables the relay, allowing it to start its operations. It typically involves starting the PWM signal or setting the appropriate control signals to activate the relay.
- Parameters:
self – [in] Pointer to the relay structure.
- Returns:
int Status code (0 for success, non-zero for error).
-
int relay_disable(struct relay *self)#
Disables the relay.
This function disables the relay, stopping its operations. It typically involves stopping the PWM signal or resetting the control signals to deactivate the relay.
- Parameters:
self – [in] Pointer to the relay structure.
- Returns:
int Status code (0 for success, non-zero for error).
-
void relay_turn_on(struct relay *self)#
Turns on the relay.
This function activates the relay by setting the appropriate PWM signal.
- Parameters:
self – [inout] Pointer to the relay structure.
-
void relay_turn_off(struct relay *self)#
Turns off the relay.
This function deactivates the relay by stopping the PWM signal.
- Parameters:
self – [inout] Pointer to the relay structure.
-
void relay_turn_on_ext(struct relay *self, uint8_t pickup_pct, uint16_t pickup_delay_ms, uint8_t hold_pct)#
Turns on the relay with extended parameters.
This function activates the relay with specified pickup and hold percentages and a delay for the pickup phase.
- Parameters:
self – [inout] Pointer to the relay structure.
pickup_pct – [in] Percentage of PWM duty cycle for the pickup phase.
pickup_delay_ms – [in] Delay in milliseconds for the pickup phase.
hold_pct – [in] Percentage of PWM duty cycle for the hold phase.