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 |
#define SLAVE_ADDRESS 0x12 |
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 | ) |
[initialize_i2c]
[setup_i2c_callback]
[reg_en_i2c_callback]
[reg_en_i2c_callback]
References i2c_read_request_callback(), I2C_SLAVE_CALLBACK_READ_REQUEST, I2C_SLAVE_CALLBACK_WRITE_REQUEST, i2c_slave_enable_callback(), i2c_slave_instance, i2c_slave_register_callback(), and i2c_write_request_callback().
Referenced by main(), and run_i2c_init_test().
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_module i2c_slave_instance |
[address]
[module]
Referenced by configure_i2c_slave(), configure_i2c_slave_callbacks(), main(), run_i2c_init_test(), and setup_dma_descriptor().
|
static |
[packet]
Referenced by i2c_read_request_callback(), and i2c_write_request_callback().
|
static |
Referenced by get_length(), i2c_write_request_callback(), main(), and setup_dma_descriptor().
|
static |
Referenced by i2c_read_request_callback(), and main().