/* plx_hal.h  (custom minimal HAL: GPIO + 3x PWM for PLECS model) */
#ifndef PLX_HAL_H
#define PLX_HAL_H

#include <stdint.h>
#include <stdbool.h>

/* ---- DIO (used by PLECS Digital Out blocks) ---- */
void PLXHAL_DIO_set(uint16_t handle, bool val);
bool PLXHAL_DIO_get(uint16_t handle); /* optional */

/* ---- Read/Write Global hooks (names must match generated model) ---- */
void PLXHAL_CUSTOM_f8(uint16_t *out);              /* reads g_led_input */
void PLXHAL_CUSTOM_f12(uint16_t *out);             /* reads g_fb_input  */
void PLXHAL_CUSTOM_f13(uint16_t const *in);        /* writes g_controller_fb */

/* ---- PWM (used by PLECS PWM block) ---- */
void PLXHAL_PWM_setDuty(uint16_t channel, float duty);  /* duty 0..1 */
void PLXHAL_PWM_enableAllOutputs(void);                 /* can be no-op */

/* Called by led_feedback_c2000_block_initialize() */
void led_feedback_c2000_block_initHal(void);

#endif
