Microchip® Advanced Software Framework

qs_i2c_slave_callback.c File Reference

SAM SERCOM I2C Slave Quick Start Guide with Callbacks.

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

#include <asf.h>

Macros

#define DATA_LENGTH   10
 [packet] More...
 
#define SLAVE_ADDRESS   0x12
 [packet_data] More...
 

Functions

void configure_i2c_slave (void)
 [write_request] More...
 
void configure_i2c_slave_callbacks (void)
 [initialize_i2c] More...
 
void i2c_read_request_callback (struct i2c_slave_module *const module)
 [module] More...
 
void i2c_write_request_callback (struct i2c_slave_module *const module)
 [read_request] More...
 
int main (void)
 [setup_i2c_callback] More...
 

Variables

struct i2c_slave_module i2c_slave_instance
 [address] More...
 
static struct i2c_slave_packet packet
 [packet] More...
 
static uint8_t read_buffer [DATA_LENGTH]
 
static uint8_t write_buffer [DATA_LENGTH]
 

#define DATA_LENGTH   10

[packet]

[packet_data]

Referenced by i2c_read_request_callback(), and i2c_write_request_callback().

#define SLAVE_ADDRESS   0x12

[packet_data]

[address]

Referenced by configure_i2c_slave().

void configure_i2c_slave ( void  )

[write_request]

[module]

[initialize_i2c]

[init_conf]

[init_conf]

[conf_changes]

[conf_changes]

[init_module]

[init_module]

[enable_module]

[enable_module]

References i2c_slave_config::address, i2c_slave_config::address_mode, I2C_SLAVE_ADDRESS_MODE_MASK, i2c_slave_enable(), i2c_slave_get_config_defaults(), i2c_slave_init(), i2c_slave_instance, i2c_slave_config::pinmux_pad0, i2c_slave_config::pinmux_pad1, and SLAVE_ADDRESS.

Referenced by main().

void configure_i2c_slave_callbacks ( void  )
void i2c_read_request_callback ( struct i2c_slave_module *const  module)

[module]

[read_request]

[packet_write]

[packet_write]

[write_packet]

[write_packet]

References i2c_slave_packet::data, DATA_LENGTH, i2c_slave_packet::data_length, i2c_slave_write_packet_job(), packet, and write_buffer.

Referenced by configure_i2c_slave_callbacks().

void i2c_write_request_callback ( struct i2c_slave_module *const  module)

[read_request]

[write_request]

[packet_read]

[packet_read]

[read_packet]

[read_packet]

References i2c_slave_packet::data, DATA_LENGTH, i2c_slave_packet::data_length, i2c_slave_read_packet_job(), packet, read_buffer, and STATUS_OK.

Referenced by configure_i2c_slave_callbacks().

int main ( void  )

[setup_i2c_callback]

[run_initialize_i2c]

[config]

[config] [config_callback]

[config_callback] [run_initialize_i2c]

[while]

[while]

References configure_i2c_slave(), configure_i2c_slave_callbacks(), and system_init().

struct i2c_slave_packet packet
static
uint8_t read_buffer[DATA_LENGTH]
static
uint8_t write_buffer[DATA_LENGTH]
static
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
}

Referenced by i2c_read_request_callback(), and main().