Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no member named 'address' errors when using ATCA_ENABLE_DEPRECATED #273

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
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
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