sensors.h
1.21 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef SENSORS_H
#define SENSORS_H
#include <stdint.h>
#include <stdio.h>
#include "i2c.h"
#include "libwismart.h"
#include "module.h"
#include "json.h"
#define LIGHT_ADDR 0x39
#define DISTANCE_ADDR 0x01
#define PRESSURE_ADDR 0x77
typedef struct {
uint8_t ID;
char* description;
char* type;
char* unit;
char* additional_data;
} sensor;
uint8_t register_sensor(sensor sens);
//SENSOR DEFINITIONS
extern sensor light_sensor;
extern sensor ultrasound_sensor;
extern sensor pressure_sensor;
//SENSOR FUNCTIONS
//LIGHT SENSOR
uint32_t get_light_data(void);
uint16_t get_light_ch0(void);
uint16_t get_light_ch1(void);
//ULTRASONIC SENSOR
uint16_t get_distance_data(void);
void init_ultrasound(void);
uint8_t get_distance_low(void);
uint8_t get_distance_high(void);
//PRESSURE SENSOR
typedef struct {
uint16_t AC1;
uint16_t AC2;
uint16_t AC3;
uint16_t AC4;
uint16_t AC5;
uint16_t AC6;
uint16_t B1;
uint16_t B2;
uint16_t MB;
uint16_t MC;
uint16_t MD;
} bmp085_callibration;
uint16_t get_pressure_data(void);
bmp085_callibration get_callibration_data(void);
char* callibration_data_csv(bmp085_callibration parameters);
void init_pressure(void);
#endif