# i2c_hw_slave_msg

i2c hardware slave Message Interface

Author | Sebastien Lelong, Joep Suijs, Copyright © 2008-2009, all rights reserved.
Adapted-by |
Compiler | >=2.4i

Description

    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.

Sources

      - AN734: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011798

Dependencies

- i2c_hw_slave
- i2c_hw_slave_isr

## Summary

### Global variables/contants

- `var byte i2c_index`
- `var bit i2c_datapresent`
- `const bit i2c_enable_start_stop_interrupts = true`
- `var byte i2c_buffer[I2C_BUFFER_SIZE]`

### Procedures

- `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()`

### Functions

## API details

### Global variables/contants

- `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

### Procedures

- `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

### Functions

## Related samples

Here are the list of samples which use this library:

16f723 | 16f723_i2c_hw_slave_msg.jal
16f723 | 16f723_i2c_hw_slave_eeprom_simulator.jal
16f73 | 16f73_i2c_hw_slave_msg.jal
16f73 | 16f73_i2c_hw_slave_eeprom_simulator.jal
16f877 | 16f877_i2c_hw_slave_msg.jal
16f877 | 16f877_i2c_hw_slave_eeprom_simulator.jal
16f877a | 16f877a_i2c_hw_slave_msg.jal
16f877a | 16f877a_i2c_hw_slave_eeprom_simulator.jal
16f88 | 16f88_i2c_hw_slave_msg.jal
16f88 | 16f88_i2c_hw_slave_eeprom_simulator.jal
18f14k50 | 18f14k50_i2c_hw_slave_eeprom_simulator.jal
18f14k50 | 18f14k50_i2c_hw_slave_msg.jal
18f2520 | 18f2520_i2c_hw_slave_msg.jal
18f2520 | 18f2520_i2c_hw_slave_eeprom_simulator.jal
18f2550 | 18f2550_i2c_hw_slave_eeprom_simulator.jal
18f2550 | 18f2550_i2c_hw_slave_msg.jal
18f2620 | 18f2620_i2c_hw_slave_eeprom_simulator.jal
18f2620 | 18f2620_i2c_hw_slave_msg.jal
18f452 | 18f452_i2c_hw_slave_msg.jal
18f452 | 18f452_i2c_hw_slave_eeprom_simulator.jal
18f4550 | 18f4550_i2c_hw_slave_eeprom_simulator.jal
18f4550 | 18f4550_i2c_hw_slave_msg.jal
18f4620 | 18f4620_i2c_hw_slave_msg.jal
18f4620 | 18f4620_i2c_hw_slave_eeprom_simulator.jal
18f67j50 | 18f67j50_i2c_hw_slave_msg.jal
18f67j50 | 18f67j50_i2c_hw_slave_eeprom_simulator.jal