Implement I2C communication with RPi
This commit is contained in:
		@ -3,6 +3,8 @@
 | 
			
		||||
 | 
			
		||||
#include "stm32g4xx_hal.h"
 | 
			
		||||
 | 
			
		||||
#include <stddef.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];
 | 
			
		||||
@ -21,6 +23,10 @@ typedef enum {
 | 
			
		||||
} RPiI2CState;
 | 
			
		||||
extern RPiI2CState rpi_i2c_state;
 | 
			
		||||
 | 
			
		||||
extern size_t rpi_num_polls;
 | 
			
		||||
 | 
			
		||||
void rpi_init(I2C_HandleTypeDef *handle);
 | 
			
		||||
 | 
			
		||||
void rpi_update_tx_buffer();
 | 
			
		||||
 | 
			
		||||
#endif // __RPI_H
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								Core/Inc/state.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Core/Inc/state.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
#ifndef __STATE_H
 | 
			
		||||
#define __STATE_H
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
  VIEW_MISSION_SELECT = 0,
 | 
			
		||||
  VIEW_AMI = 1,
 | 
			
		||||
  VIEW_DRIVER = 2,
 | 
			
		||||
  VIEW_TESTING = 3
 | 
			
		||||
} STWView;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  STWView view;
 | 
			
		||||
} STWState;
 | 
			
		||||
 | 
			
		||||
extern STWState stw_state;
 | 
			
		||||
 | 
			
		||||
void state_init();
 | 
			
		||||
 | 
			
		||||
#endif // __STATE_H
 | 
			
		||||
		Reference in New Issue
	
	Block a user