RocketLogger  1.1
sensor.h
Go to the documentation of this file.
1 
31 #ifndef SENSOR_SENSOR_H_
32 #define SENSOR_SENSOR_H_
33 
34 #include <stdint.h>
35 
36 #include "../rl_file.h"
37 
38 #define MAX_MESSAGE_LENGTH 1000
39 
40 #ifndef I2C_BUS_FILENAME
41 #define I2C_BUS_FILENAME "/dev/i2c-1"
42 #endif
43 
45 #define SENSOR_REGISTRY_SIZE 5
46 
47 #define SENSOR_NAME_LENGTH (RL_FILE_CHANNEL_NAME_LENGTH)
48 
52 struct rl_sensor {
55  int channel;
57  int32_t scale;
58  int (*init)(int);
59  void (*close)(int);
60  int (*read)(int);
61  int32_t (*getValue)(int, int);
62 };
63 
65 
66 int Sensors_initSharedBus(void);
67 void Sensors_closeSharedBus(void);
68 int Sensors_getSharedBus(void);
69 int Sensors_initSharedComm(uint8_t);
70 
71 int Sensors_openBus(void);
72 int Sensors_closeBus(int);
73 
74 int Sensors_scan(int*);
75 void Sensors_close(int*);
76 
77 #endif /* SENSOR_SENSOR_H_ */
void Sensors_closeSharedBus(void)
Definition: sensor.c:133
int Sensors_initSharedBus(void)
Definition: sensor.c:109
int Sensors_scan(int *)
enum unit rl_unit
int identifier
Definition: sensor.h:54
#define SENSOR_REGISTRY_SIZE
Number of sensor registred.
Definition: sensor.h:45
char name[SENSOR_NAME_LENGTH]
Definition: sensor.h:53
int32_t(* getValue)(int, int)
Definition: sensor.h:61
int Sensors_getSharedBus(void)
Definition: sensor.c:118
int32_t scale
Definition: sensor.h:57
#define SENSOR_NAME_LENGTH
Definition: sensor.h:47
const struct rl_sensor sensor_registry[SENSOR_REGISTRY_SIZE]
Definition: sensor.c:52
void Sensors_close(int *)
void(* close)(int)
Definition: sensor.h:59
int(* read)(int)
Definition: sensor.h:60
rl_unit unit
Definition: sensor.h:56
int Sensors_openBus(void)
Definition: sensor.c:84
int(* init)(int)
Definition: sensor.h:58
int Sensors_closeBus(int)
Definition: sensor.c:97
int channel
Definition: sensor.h:55
int Sensors_initSharedComm(uint8_t)
Definition: sensor.c:125