Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/hal/atca_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ typedef struct
} atca_hal_list_entry_t;


#if defined(ATCA_NO_HEAP) && defined(ATCA_HAL_CUSTOM)
static ATCAHAL_t g_atcahal_custom_iface;
#endif


static atca_hal_list_entry_t atca_registered_hal_list[ATCA_MAX_HAL_CACHE] = {
#ifdef ATCA_HAL_I2C
{ (uint8_t)ATCA_I2C_IFACE, &hal_i2c, NULL },
Expand Down Expand Up @@ -305,7 +310,12 @@ ATCA_STATUS hal_iface_init(ATCAIfaceCfg *cfg, ATCAHAL_t **hal, ATCAHAL_t **phy)
#ifdef ATCA_HAL_CUSTOM
if (ATCA_CUSTOM_IFACE == cfg->iface_type)
{
#ifdef ATCA_NO_HEAP
(void)memset(&g_atcahal_custom_iface, 0, sizeof(g_atcahal_custom_iface));
*hal = &g_atcahal_custom_iface;
#else
*hal = hal_malloc(sizeof(ATCAHAL_t));
#endif
if (NULL != *hal)
{
(*hal)->halinit = ATCA_IFACECFG_VALUE(cfg, atcacustom.halinit);
Expand Down