i2c_slave.h 591 B

1234567891011121314151617181920212223
  1. /* Library made by: g4lvanix
  2. * Github repository: https://github.com/g4lvanix/I2C-slave-lib
  3. Info: Inititate the library by giving the required address.
  4. Read or write to the necessary buffer according to the opperation.
  5. */
  6. #ifndef I2C_SLAVE_H
  7. #define I2C_SLAVE_H
  8. #define TX_BUFFER_SIZE 30
  9. #define RX_BUFFER_SIZE 30
  10. volatile uint8_t buffer_address;
  11. static volatile bool slave_has_register_set = false;
  12. volatile uint8_t txbuffer[TX_BUFFER_SIZE];
  13. volatile uint8_t rxbuffer[RX_BUFFER_SIZE];
  14. void i2c_init(uint8_t address);
  15. void i2c_stop(void);
  16. ISR(TWI_vect);
  17. #endif // I2C_SLAVE_H