components/esp-cryptoauthlib/cryptoauthlib/lib/hal/hal_uc3_i2c_asf.c
ATCA_STATUS hal_i2c_sleep(ATCAIface iface)
{
    ATCAIfaceCfg *cfg = atgetifacecfg(iface);
    uint8_t data[4];

    data[0] = 0x01; // sleep word address value
    twi_package_t packet = {
        .chip           = cfg->atcai2c.slave_address >> 1,
        .addr           = { 0 },
        .addr_length    = 0,
        .buffer         = (void*)data,
        .length         = 1
    };

    if (twi_master_write(i2c_hal_data[cfg->atcai2c.bus].twi_master_instance, &packet) != TWI_SUCCESS)
    {
        return ATCA_COMM_FAIL;
    }

    return ATCA_SUCCESS;
}
/** \brief sleep CryptoAuth device using I2C bus
 * \param[in] iface  interface to logical device to sleep
 * \return ATCA_SUCCESS on success, otherwise an error code.
 */
\brief sleep CryptoAuth device using I2C bus
\param[in] iface  interface to logical device to sleep
\return ATCA_SUCCESS on success, otherwise an error code.
\ brief sleep CryptoAuth device using I2C bus \ param [ in ] iface interface to logical device to sleep \ return ATCA_SUCCESS on success otherwise an error code .
ATCA_STATUS hal_i2c_sleep(ATCAIface iface)
{
    ATCAIfaceCfg *cfg = atgetifacecfg(iface);
    uint8_t data[4];
    data[0] = 0x01; 
    twi_package_t packet = {
        .chip           = cfg->atcai2c.slave_address >> 1,
        .addr           = { 0 },
        .addr_length    = 0,
        .buffer         = (void*)data,
        .length         = 1
    };
    if (twi_master_write(i2c_hal_data[cfg->atcai2c.bus].twi_master_instance, &packet) != TWI_SUCCESS)
    {
        return ATCA_COMM_FAIL;
    }
    return ATCA_SUCCESS;
}
ATCA_STATUS hal_i2c_sleep ( ATCAIface iface ) { ATCAIfaceCfg * cfg = atgetifacecfg ( iface ) ; uint8_t data [ 4 ] ; data [ 0 ] = 0x01 ; twi_package_t packet = { . chip = cfg -> atcai2c . slave_address >> 1 , . addr = { 0 } , . addr_length = 0 , . buffer = ( void * ) data , . length = 1 } ; if ( twi_master_write ( i2c_hal_data [ cfg -> atcai2c . bus ] . twi_master_instance , & packet ) != TWI_SUCCESS ) { return ATCA_COMM_FAIL ; } return ATCA_SUCCESS ; }
\brief sleep CryptoAuth device using I2C bus
 \param[in] iface  interface to logical device to sleep
 \return ATCA_SUCCESS on success, otherwise an error code.
\ brief sleep CryptoAuth device using I2C bus \ param [ in ] iface interface to logical device to sleep \ return ATCA_SUCCESS on success otherwise an error code .
// sleep word address value