Files
microchip-application-bmd38…/sw_drv.c
T
chain40 d9a2a7b4e2 feat: 實作 sw_drv, sw_drv_if, adgs1412 driver
1. sw_t 是一個 64位元的資料結構, 最大可支援 64 pin sw (adgs1412 最多支援 16 顆)
2024-03-29 00:28:42 +08:00

55 lines
823 B
C

#include "sw_drv.h"
#include "adgs1412.h"
#if (DEF_ELITE_MODEL == DEF_ELITE_EDC_20)
const sw_drv_if_t *p_inst = &adgs1412;
#else
static mux_drv_if_t *p_inst = NULL;
#endif
int sw_init(void)
{
if (p_inst == NULL)
{
return SW_DRV_ERROR;
}
return p_inst->init();
}
int sw_reset(void)
{
if (p_inst == NULL)
{
return SW_DRV_ERROR;
}
return p_inst->reset();
}
int sw_write(sw_t sw_mask)
{
if (p_inst == NULL)
{
return SW_DRV_ERROR;
}
return p_inst->write(sw_mask);
}
int sw_read(sw_t *p_sw_mask)
{
if (p_inst == NULL)
{
return SW_DRV_ERROR;
}
return p_inst->read(p_sw_mask);
}
int sw_count(uint32_t *p_sw_count)
{
if (p_inst == NULL)
{
return SW_DRV_ERROR;
}
return p_inst->get_sw_count(p_sw_count);
}