67 lines
991 B
C
67 lines
991 B
C
#include "sw_drv.h"
|
|
|
|
#if (DEF_ADGS1412_ENABLED)
|
|
|
|
#include "adgs1412.h"
|
|
const sw_drv_if_t *p_inst = &adgs1412;
|
|
|
|
#elif (DEF_MAX14802_ENABLED)
|
|
|
|
#include "max14802.h"
|
|
const sw_drv_if_t *p_inst = &max14802;
|
|
|
|
#else
|
|
|
|
const sw_drv_if_t *p_inst = NULL;
|
|
|
|
#endif /* ! DEF_ADGS1412_ENABLED */
|
|
|
|
#if (DEF_SW_DRV_ENABLED)
|
|
|
|
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);
|
|
}
|
|
|
|
#endif /* ! DEF_SW_DRV_ENABLED */ |