Microchip® Advanced Software Framework

qs_i2c_slave_basic_use.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
 [address] More...
 
#define SLAVE_ADDRESS   0x12
 [address] More...
 

Functions

void configure_i2c_slave (void)
 [module] More...
 
int main (void)
 [initialize_i2c] More...
 

Variables

struct i2c_slave_module i2c_slave_instance
 [packet_data] More...
 
uint8_t read_buffer [DATA_LENGTH]
 
uint8_t write_buffer [DATA_LENGTH]
 

#define DATA_LENGTH   10

[address]

[packet_data]

Referenced by main().

#define SLAVE_ADDRESS   0x12

[address]

void configure_i2c_slave ( void  )

[module]

[initialize_i2c]

[init_conf]

[init_conf]

[conf_changes]

[conf_changes]

[init_module]

[init_module]

[enable_module]

[enable_module]

int main ( void  )

[initialize_i2c]

[run_initialize_i2c] [config]

[config]

[dir]

[dir] [pack]

[pack] [run_initialize_i2c]

[while]

[get_dir]

[get_dir]

[transfer]

[transfer]

[while]

References configure_i2c_slave(), i2c_slave_packet::data, DATA_LENGTH, i2c_slave_packet::data_length, I2C_SLAVE_DIRECTION_READ, I2C_SLAVE_DIRECTION_WRITE, i2c_slave_get_direction_wait(), i2c_slave_instance, i2c_slave_read_packet_wait(), i2c_slave_write_packet_wait(), read_buffer, system_init(), and write_buffer.

struct i2c_slave_module i2c_slave_instance

[packet_data]

[module]

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

Referenced by main().