#include "mcu_cs.h" // static cs_handle_t const _cs_handle = {.cs_on = mcu_cs_on, .cs_off = mcu_cs_off}; void mcu_cs_init(MCU_cs_t *hcs, GPIO_TypeDef *cs_port, uint16_t cs_pin, uint8_t cs_idle) { hcs->super.cs_on = mcu_cs_on; hcs->super.cs_off = mcu_cs_off; hcs->cs_port = cs_port; hcs->cs_pin = cs_pin; hcs->cs_idle = cs_idle; } void mcu_cs_on(cs_handle_t *hcs) { MCU_cs_t *_hcs = (MCU_cs_t *)hcs; HAL_GPIO_WritePin(_hcs->cs_port, _hcs->cs_pin, !_hcs->cs_idle); } void mcu_cs_off(cs_handle_t *hcs) { MCU_cs_t *_hcs = (MCU_cs_t *)hcs; HAL_GPIO_WritePin(_hcs->cs_port, _hcs->cs_pin, _hcs->cs_idle); }