ATCA Hardware abstraction layer for SAM flexcom & twi I2C over ASF drivers. More...
#include <asf.h>
#include <string.h>
#include <stdio.h>
#include "cryptoauthlib.h"
#include "hal_sam_i2c_asf.h"
Functions | |
ATCA_STATUS | hal_i2c_discover_buses (int i2c_buses[], int max_buses) |
discover i2c buses available for this hardware this maintains a list of logical to physical bus mappings freeing the application of the a-prior knowledge | |
ATCA_STATUS | hal_i2c_discover_devices (int bus_num, ATCAIfaceCfg cfg[], int *found) |
discover any CryptoAuth devices on a given logical bus number | |
ATCA_STATUS | hal_i2c_init (void *hal, ATCAIfaceCfg *cfg) |
hal_i2c_init manages requests to initialize a physical interface. it manages use counts so when an interface has released the physical layer, it will disable the interface for some other use. You can have multiple ATCAIFace instances using the same bus, and you can have multiple ATCAIFace instances on multiple i2c buses, so hal_i2c_init manages these things and ATCAIFace is abstracted from the physical details. | |
ATCA_STATUS | hal_i2c_post_init (ATCAIface iface) |
HAL implementation of I2C post init. | |
ATCA_STATUS | hal_i2c_send (ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength) |
HAL implementation of I2C send over START. | |
ATCA_STATUS | hal_i2c_receive (ATCAIface iface, uint8_t address, uint8_t *rxdata, uint16_t *rxlength) |
HAL implementation of I2C receive function for START I2C. | |
ATCA_STATUS | hal_i2c_wake (ATCAIface iface) |
wake up CryptoAuth device using I2C bus | |
ATCA_STATUS | hal_i2c_idle (ATCAIface iface) |
idle CryptoAuth device using I2C bus | |
ATCA_STATUS | hal_i2c_sleep (ATCAIface iface) |
sleep CryptoAuth device using I2C bus | |
ATCA_STATUS | hal_i2c_release (void *hal_data) |
manages reference count on given bus and releases resource if no more refences exist | |
ATCA Hardware abstraction layer for SAM flexcom & twi I2C over ASF drivers.
This code is structured in two parts. Part 1 is the connection of the ATCA HAL API to the physical I2C implementation. Part 2 is the ASF I2C primitives to set up the interface.
Prerequisite: add "TWI - Two-Wire Interface (Common API) (service)" module to application in Atmel Studio