Microchip® Advanced Software Framework

qs_i2c_master_callback.c File Reference

SAM SERCOM I2C Master Quick Start Guide with Callbacks.

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

#include <asf.h>
#include <system_interrupt.h>

Macros

#define DATA_LENGTH   8
 [packet_data] More...
 
#define SLAVE_ADDRESS   0x12
 [packet_data] More...
 

Functions

void configure_i2c (void)
 [callback_func] More...
 
void configure_i2c_callbacks (void)
 [initialize_i2c] More...
 
void i2c_write_complete_callback (struct i2c_master_module *const module)
 [dev_inst] More...
 
int main (void)
 [setup_callback] More...
 

Variables

struct i2c_master_module i2c_master_instance
 [packet_glob] More...
 
static uint8_t rd_buffer [DATA_LENGTH]
 
struct i2c_master_packet rd_packet
 
static uint8_t wr_buffer [DATA_LENGTH]
 
static uint8_t wr_buffer_reversed [DATA_LENGTH]
 
struct i2c_master_packet wr_packet
 [address] More...
 

#define DATA_LENGTH   8

[packet_data]

Referenced by main().

#define SLAVE_ADDRESS   0x12

[packet_data]

[address]

Referenced by main().

void configure_i2c ( void  )

[callback_func]

[initialize_i2c]

[init_conf]

[init_conf]

[conf_change]

[conf_change]

[init_module]

[init_module]

[enable_module]

[enable_module]

References i2c_master_config::buffer_timeout, i2c_master_enable(), i2c_master_get_config_defaults(), i2c_master_init(), i2c_master_instance, i2c_master_config::pinmux_pad0, i2c_master_config::pinmux_pad1, and STATUS_OK.

Referenced by main().

void configure_i2c_callbacks ( void  )

[initialize_i2c]

[setup_callback]

[callback_reg]

[callback_reg] [callback_en]

[callback_en]

References I2C_MASTER_CALLBACK_WRITE_COMPLETE, i2c_master_enable_callback(), i2c_master_instance, i2c_master_register_callback(), and i2c_write_complete_callback().

Referenced by main().

void i2c_write_complete_callback ( struct i2c_master_module *const  module)

[dev_inst]

[callback_func]

[read_next]

[read_next]

References i2c_master_instance, i2c_master_read_packet_job(), and rd_packet.

Referenced by configure_i2c_callbacks().

int main ( void  )

[setup_callback]

[run_initialize_i2c]

[config]

[config]

[config_callback]

[config_callback] [run_initialize_i2c]

[write_packet]

[write_packet] [read_packet]

[read_packet]

[while]

[revert_order]

[revert_order] [write_packet]

[write_packet]

[while]

References i2c_master_packet::address, configure_i2c(), configure_i2c_callbacks(), i2c_master_packet::data, DATA_LENGTH, i2c_master_packet::data_length, i2c_master_instance, i2c_master_write_packet_job(), port_pin_get_input_level(), rd_buffer, rd_packet, SLAVE_ADDRESS, system_init(), wr_buffer, wr_buffer_reversed, and wr_packet.

uint8_t rd_buffer[DATA_LENGTH]
static

Referenced by main().

struct i2c_master_packet rd_packet
uint8_t wr_buffer[DATA_LENGTH]
static
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
}

Referenced by main().

uint8_t wr_buffer_reversed[DATA_LENGTH]
static
Initial value:
= {
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
}

Referenced by main().

struct i2c_master_packet wr_packet

[address]

[packet_glob]

Referenced by main().