Skip to content

Commit

Permalink
Merge pull request #273 from rashedtalukder/main
Browse files Browse the repository at this point in the history
Fix no member named 'address' errors when using ATCA_ENABLE_DEPRECATED
  • Loading branch information
bryan-hunt committed Nov 4, 2021
2 parents 9a99379 + 648a124 commit 2b40585
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/atca_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ uint8_t atcab_get_device_address(ATCADevice device)
switch (device->mIface.mIfaceCFG->iface_type)
{
case ATCA_I2C_IFACE:
#ifdef ATCA_ENABLE_DEPRECATED
return device->mIface.mIfaceCFG->atcai2c.slave_address;
#else
return device->mIface.mIfaceCFG->atcai2c.address;
#endif
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/atca_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ ATCA_STATUS atsend(ATCAIface ca_iface, uint8_t address, uint8_t *txdata, int txl
#ifdef ATCA_HAL_I2C
if (ATCA_I2C_IFACE == ca_iface->mIfaceCFG->iface_type && 0xFF == address)
{
#ifdef ATCA_ENABLE_DEPRECATED
address = ca_iface->mIfaceCFG->atcai2c.slave_address;
#else
address = ca_iface->mIfaceCFG->atcai2c.address;
#endif
}
#endif

Expand Down
4 changes: 4 additions & 0 deletions lib/pkcs11/pkcs11_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,11 @@ static CK_RV pkcs11_config_parse_interface(pkcs11_slot_ctx_ptr slot_ctx, char* c
slot_ctx->interface_config.iface_type = ATCA_I2C_IFACE;
if (argc > 1)
{
#ifdef ATCA_ENABLE_DEPRECATED
slot_ctx->interface_config.atcai2c.slave_address = (uint8_t)strtol(argv[1], NULL, 16);
#else
slot_ctx->interface_config.atcai2c.address = (uint8_t)strtol(argv[1], NULL, 16);
#endif
}
if (argc > 2)
{
Expand Down
7 changes: 7 additions & 0 deletions lib/pkcs11/pkcs11_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,17 @@ CK_RV pkcs11_slot_init(CK_SLOT_ID slotID)
#ifdef ATCA_HAL_I2C
if (ATCA_SUCCESS != status)
{
#ifdef ATCA_ENABLE_DEPRECATED
if (0xC0 != ifacecfg->atcai2c.slave_address)
{
/* Try the default address */
ifacecfg->atcai2c.slave_address = 0xC0;
#else
if (0xC0 != ifacecfg->atcai2c.address)
{
/* Try the default address */
ifacecfg->atcai2c.address = 0xC0;
#endif
atcab_release();
atca_delay_ms(1);
retries = 2;
Expand Down

0 comments on commit 2b40585

Please sign in to comment.