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