#ifndef __RPI_H
#define __RPI_H

#include "stm32g4xx_hal.h"

// We only need to receive one byte (command ID)
#define I2C_RX_BUF_SIZE 1
extern uint8_t i2c_rx_buf[I2C_RX_BUF_SIZE];
// We always send the maximum 32 byes supported by an SMBus block read
#define I2C_TX_BUF_MAX_SIZE 32
extern uint8_t i2c_tx_buf[I2C_TX_BUF_MAX_SIZE];
extern uint8_t i2c_tx_len;

#define COMM_SEND_DATA 0x00
typedef enum {
  RPI_I2C_IDLE,
  RPI_I2C_WAITING_FOR_COMMAND,
  RPI_I2C_WAITING_FOR_MASTER_RECEIVE,
  RPI_I2C_SENDING_DATA_SIZE,
  RPI_I2C_SENDING_DATA
} RPiI2CState;
extern RPiI2CState rpi_i2c_state;

void rpi_init(I2C_HandleTypeDef *handle);

#endif // __RPI_H
