blob: 1878e16de3c2ec8cddc8174ede77e7b7cae68589 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  | 
#ifndef I2CSENSOR_H
#define I2CSENSOR_H
#include <stdint.h>
#include <ch.h>
#include <hal.h>
class I2CSensor {
	private:
		static I2CSlaveConfig i2c_slave_conf;
	
	public:
		static void enable_bus();
	
	protected:
		uint8_t i2c_address;
		
		void write(uint8_t reg, uint8_t value);
		void read(uint8_t reg, size_t len);
		
		static uint8_t rxdata[8];
		static uint8_t txdata[2];
};
#endif
  |