Author | Sebastien Lelong, Joep Suijs, Copyright © 2008-2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides an message interface to i2c hardware slave. It relies on the jalv2 implementation of Microchip Application Note AN734. The user needs to supply a procedure to process the received message. Basically, this i2c slave waits for a full message to arrive. Then it calls the user procedure to process the message and (optional) prepare a response. Subsequently, this lib will pass the response data over to the master, if it wants to have them. See corresponding sample for more details.
- AN734: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011798
var byte i2c_index
var bit i2c_datapresent
const bit i2c_enable_start_stop_interrupts = true
var byte i2c_buffer[I2C_BUFFER_SIZE]
i2c_hw_slave_on_stop()
i2c_hw_slave_on_state_4()
i2c_hw_slave_on_state_3()
i2c_hw_slave_on_error()
i2c_hw_slave_on_state_1(byte in _trash)
i2c_hw_slave_on_start()
i2c_call_process_message()
i2c_hw_slave_on_state_2(byte in rcv)
i2c_hw_slave_on_state_5()
var byte i2c_index
vars
var bit i2c_datapresent
datapresent flag
const bit i2c_enable_start_stop_interrupts = true
No documentation found
var byte i2c_buffer[I2C_BUFFER_SIZE]
No documentation found
i2c_hw_slave_on_stop()
No documentation found
i2c_hw_slave_on_state_4()
this callback is used when master, after having read something, still wants to read and get data from us.
i2c_hw_slave_on_state_3()
this callback is used when master wants to read something from us. It should use i2c_hw_slave_write() to send something
i2c_hw_slave_on_error()
this callback is used when something wrong happened during communication between master and us
i2c_hw_slave_on_state_1(byte in _trash)
this callback is used when master wants to talk to us and our i2c address has been recognized
i2c_hw_slave_on_start()
No documentation found
i2c_call_process_message()
No documentation found
i2c_hw_slave_on_state_2(byte in rcv)
This callback is used when master sends a data byte
i2c_hw_slave_on_state_5()
this callback is used when master does not want to talk with us anymore... This is an appropriate place to reset data for instance