Microchip® Advanced Software Framework

i2c_samd20/i2c_master_interrupt.c File Reference

SAM D20 I2C Master Interrupt Driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

Functions

static void _i2c_master_async_address_response (struct i2c_master_module *const module)
 
void _i2c_master_interrupt_handler (uint8_t instance)
 
static void _i2c_master_read (struct i2c_master_module *const module)
 
static enum status_code _i2c_master_read_packet (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 
static void _i2c_master_write (struct i2c_master_module *const module)
 
static enum status_code _i2c_master_write_packet (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 
enum status_code i2c_master_read_bytes (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 
enum status_code i2c_master_read_packet_job (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 Initiates a read packet operation. More...
 
enum status_code i2c_master_read_packet_job_no_nack (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 Initiates a read packet operation without sending a NACK signal and a STOP condition when done. More...
 
enum status_code i2c_master_read_packet_job_no_stop (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 Initiates a read packet operation without sending a STOP condition when done. More...
 
void i2c_master_register_callback (struct i2c_master_module *const module, const i2c_master_callback_t callback, enum i2c_master_callback callback_type)
 Registers callback for the specified callback type. More...
 
void i2c_master_unregister_callback (struct i2c_master_module *const module, enum i2c_master_callback callback_type)
 Unregisters callback for the specified callback type. More...
 
enum status_code i2c_master_write_bytes (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 
enum status_code i2c_master_write_packet_job (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 Initiates a write packet operation. More...
 
enum status_code i2c_master_write_packet_job_no_stop (struct i2c_master_module *const module, struct i2c_master_packet *const packet)
 Initiates a write packet operation without sending a STOP condition when done. More...
 

static void _i2c_master_async_address_response ( struct i2c_master_module *const  module)
static

Acts on slave address response. Checks for errors concerning master->slave handshake.

Parameters
[in,out]modulePointer to software module structure

References _i2c_master_read(), _i2c_master_write(), Assert, I2C_TRANSFER_WRITE, STATUS_BUSY, STATUS_ERR_BAD_ADDRESS, and STATUS_ERR_PACKET_COLLISION.

Referenced by _i2c_master_interrupt_handler().

void _i2c_master_interrupt_handler ( uint8_t  instance)
static void _i2c_master_read ( struct i2c_master_module *const  module)
static

Read next data. Used by interrupt handler to get next data byte from slave.

Parameters
[in,out]modulePointer to software module structure

References Assert.

Referenced by _i2c_master_async_address_response(), and _i2c_master_interrupt_handler().

static enum status_code _i2c_master_read_packet ( struct i2c_master_module *const  module,
struct i2c_master_packet *const  packet 
)
static

Starts a read packet operation.

Parameters
[in,out]modulePointer to software module struct
[in,out]packetPointer to I2C packet to transfer
Returns
Status of starting reading I2C packet.
Return values
STATUS_OKIf reading was started successfully
STATUS_BUSYIf module is currently busy with another transfer

References i2c_master_packet::address, Assert, i2c_master_packet::data, i2c_master_packet::data_length, I2C_TRANSFER_READ, STATUS_BUSY, and STATUS_OK.

Referenced by i2c_master_read_packet_job(), i2c_master_read_packet_job_no_nack(), and i2c_master_read_packet_job_no_stop().

static void _i2c_master_write ( struct i2c_master_module *const  module)
static

Write next data. Used by interrupt handler to send next data byte to slave.

Parameters
[in,out]modulePointer to software module structure

References Assert, and STATUS_ERR_OVERFLOW.

Referenced by _i2c_master_async_address_response(), and _i2c_master_interrupt_handler().

static enum status_code _i2c_master_write_packet ( struct i2c_master_module *const  module,
struct i2c_master_packet *const  packet 
)
static

Initiates a write packet operation

Parameters
[in,out]modulePointer to software module struct
[in,out]packetPointer to I2C packet to transfer
Returns
Status of starting writing I2C packet job.
Return values
STATUS_OKIf writing was started successfully
STATUS_BUSYIf module is currently busy with another transfer

References i2c_master_packet::address, Assert, i2c_master_packet::data, i2c_master_packet::data_length, I2C_TRANSFER_WRITE, STATUS_BUSY, and STATUS_OK.

Referenced by i2c_master_write_packet_job(), and i2c_master_write_packet_job_no_stop().