forked from Mehanik/prom-shield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prom_proto.h
87 lines (69 loc) · 2.2 KB
/
prom_proto.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef PROM_PROTO_H
#define PROM_PROTO_H
#include <Arduino.h>
#include <SD.h>
#include <RTClib.h>
#include <Wire.h>
struct Status_struct{
uint8_t sd_present : 1;
uint8_t sd_logging : 1;
uint8_t serial_logging : 1;
};
struct Byte{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
};
union ByteUnion{
Byte b;
uint8_t i;
};
class Prom_proto{
public:
static HardwareSerial &rs232;
static HardwareSerial &log_serial;
RTC_DS1307 rtc;
void init();
void logging(String message);
void enableSDlogging() {status.sd_logging = 1;}
void disableSDlogging() {status.sd_logging = 0;}
void enableSerialLogging() {status.serial_logging = 1;}
void disableSerialLogging() {status.serial_logging = 0;}
uint8_t sd_init();
void digitalOutWrite(const uint8_t, const uint8_t);
uint8_t digitalOutRead(const uint8_t);
void analogOutWrite(const uint8_t, const uint8_t);
uint8_t digitalInRead(const uint8_t);
void rellayWrite(const uint8_t, const uint8_t);
uint8_t relayRead(const uint8_t);
float analogReadVolts(const uint8_t);
float analogReadAmps(const uint8_t);
uint16_t analogReadRAW(const uint8_t num);
uint8_t analogReadLogic(const uint8_t);
uint8_t keyboardRead(const uint8_t);
private:
static const uint8_t relay_out[2];
static const uint8_t relay_num;
static const uint8_t digital_out[4];
static const uint8_t digital_out_num;
static const uint8_t digital_in[4];
static const uint8_t digital_in_num;
static const uint8_t analog_in[4];
static const uint8_t analog_in_num;
static const uint8_t keyboard[1];
static const uint8_t keyboard_num;
static const uint8_t sd_cs;
static const uint8_t sd_di;
static const uint8_t sd_do;
static const uint8_t sd_clk;
static const uint8_t i2c_sda;
static const uint8_t i2c_scl;
static const ByteUnion supports_pwm;
static Status_struct status;
};
#endif