I2C Design - PalouseRobosub/SUBLIBinal GitHub Wiki

I2C Design

This page contains information about the high level design philosophy used within the ADC including information about callback functions and background processes. Please refer to the list below to be redirected to the appropriate documentation.

Design


Background Process

The I2C background process is used for receiving I2C data. The callback function is a crucial part of I2C functionality, as data can not be received without it. The background process will remove nodes that have completed I2C transactions from the result buffer and then call a callback function within the respective node. Please refer to the [[I2C_Node callback]I2C-Design#i2c_node-callback] documentation for the format of these callbacks. The I2C background process must always be used for proper I2C functionality.

top


I2C_Node Callback

The I2C_Node callback function is used for processing data from completed I2C transactions. Nodes are given an arbitrary ID so that the end user can differentiate between different pieces of information without worrying about losing track of them when they are placed in the I2C processing buffer. These nodes also utilizes a background process and thus must accept input parameters. I2C node background processes should accept a single parameter of an I2C_Node data type so that they may handle information presented to them. Please examine the example below for the structure of a proper I2C callback function.

void callback_i2c(I2C_Node node) {

    //...process the node here

}

top