-
Notifications
You must be signed in to change notification settings - Fork 1
/
ECUMASTER_CAN_DISPLAY.ino
47 lines (38 loc) · 1.21 KB
/
ECUMASTER_CAN_DISPLAY.ino
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
#include <arduino.h>
#include "ECM.h"
#include <lcdgfx.h> // https://github.com/lexus2k/lcdgfx
#include <SPI.h>
#include <mcp2515.h> // https://github.com/autowp/arduino-mcp2515/tree/master
#include <RTClib.h> // https://github.com/adafruit/RTClib
//////////////////////////////////////////////////////////////
#define SLEEP_PIN A1 //Allows for the screen to turn off if pin does not recieve value
#define SLEEP_PIN_MIN_VAL 511 //Should be somewhere around 2.5v
#define RTC_ENABLED true//Does the project use RTC module
//////////////////////////////////////////////////////////////
//Instantiates required objects
MCP2515 mcp2515(10);
DisplaySSD1306_128x32_I2C display(-1);
RTC_DS1307 rtc;
bool is_rtc_enabled;
SCREENS screen = SCREENS::CLOCK;
ECM ecm = ECM();
//////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
ClockSetup();
SetupCANBUS();
SetupButtons();
SetupOLED();
}
//////////////////////////////////////////////////////////////
void loop() {
if(analogRead(SLEEP_PIN) > SLEEP_PIN_MIN_VAL){
CheckButtonPressed();
CheckSetTimeout();
ReadCANBUS();
WriteCANBUS();
UpdateOLED();
}
else{ OLED_OFF(); }
}
//////////////////////////////////////////////////////////////