2024-03-06 13:58:49 +00:00
|
|
|
/*
|
|
|
|
|
* File: i2c.h
|
|
|
|
|
* Author: sebgab
|
|
|
|
|
*
|
|
|
|
|
* Created on March 6, 2024, 1:53 PM
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef I2C_H
|
|
|
|
|
#define I2C_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Include the IO for I2C
|
2024-04-16 13:30:38 +00:00
|
|
|
#include "command-handler.h"
|
2024-03-20 12:00:40 +00:00
|
|
|
#include "uart.h"
|
2024-04-16 13:30:38 +00:00
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
|
#include <stdbool.h>
|
2024-03-20 12:00:40 +00:00
|
|
|
#include <util/twi.h>
|
2024-03-06 13:58:49 +00:00
|
|
|
|
2024-04-28 18:14:27 +00:00
|
|
|
// Received data buffer size
|
2024-04-28 18:19:57 +00:00
|
|
|
// The size is larger than any expected command length
|
2024-04-28 18:14:27 +00:00
|
|
|
#define I2C_RECV_BUF_SIZE 16
|
2024-03-20 12:24:55 +00:00
|
|
|
|
|
|
|
|
// Reset recv to initial state
|
|
|
|
|
void i2c_reset_recv();
|
|
|
|
|
|
2024-03-06 13:58:49 +00:00
|
|
|
// Initialize the I2C bus
|
|
|
|
|
void init_i2c(void);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* I2C_H */
|