CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
hal_i2c_start.c File Reference

ATCA Hardware abstraction layer for SAMD21 I2C over START drivers. More...

#include <string.h>
#include <stdio.h>
#include <atmel_start.h>
#include <hal_gpio.h>
#include <hal_delay.h>
#include "hal_i2c_start.h"
#include "atca_start_config.h"
#include "atca_start_iface.h"
#include "cryptoauthlib.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
 

Detailed Description

ATCA Hardware abstraction layer for SAMD21 I2C over START 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 START I2C primitives to set up the interface.

Prerequisite: add SERCOM I2C Master Polled support to application in Atmel Studio