Microchip® Advanced Software Framework

i2c_sam0/i2c_slave.c File Reference

SAM I2C Slave Driver.

Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.

#include "i2c_slave.h"
#include "i2c_slave_interrupt.h"

Functions

static enum status_code _i2c_slave_set_config (struct i2c_slave_module *const module, const struct i2c_slave_config *const config)
 
static enum status_code _i2c_slave_wait_for_bus (struct i2c_slave_module *const module)
 
void i2c_slave_clear_status (struct i2c_slave_module *const module, uint32_t status_flags)
 Clears a module status flag. More...
 
enum i2c_slave_direction i2c_slave_get_direction_wait (struct i2c_slave_module *const module)
 Waits for a start condition on the bus. More...
 
uint32_t i2c_slave_get_status (struct i2c_slave_module *const module)
 Retrieves the current module status. More...
 
enum status_code i2c_slave_init (struct i2c_slave_module *const module, Sercom *const hw, const struct i2c_slave_config *const config)
 Initializes the requested I2C hardware module. More...
 
enum status_code i2c_slave_read_packet_wait (struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
 Reads a packet from the master. More...
 
void i2c_slave_reset (struct i2c_slave_module *const module)
 Resets the hardware module. More...
 
enum status_code i2c_slave_write_packet_wait (struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
 Writes a packet to the master. More...
 

static enum status_code _i2c_slave_wait_for_bus ( struct i2c_slave_module *const  module)
static

Waits for answer on bus

Parameters
[in]modulePointer to software module structure
Returns
Status of bus.
Return values
STATUS_OKIf given response from slave device
STATUS_ERR_TIMEOUTIf no response was given within specified timeout period

References Assert, STATUS_ERR_TIMEOUT, and STATUS_OK.

Referenced by i2c_slave_get_direction_wait(), i2c_slave_read_packet_wait(), and i2c_slave_write_packet_wait().