Skip to content

Commit 0408586

Browse files
committed
Lights: Implemented light router and blinker system. This commit reimplements the lighting system in the bottom shell. It adds all the pin definitions in the teensy 4.1 spec, so that we can compile without errors for now. Because we don't have the CAN id's properly implemented yet, this commit uses a few proxies (the first five defines in light.cpp, specifically) to allow for the code to compile for now. The system is untested, but it only needs the aforementioned CAN values to be ready to test. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch light-router-dev # Changes to be committed: # new file: .ccls # new file: .vscode/settings.json # new file: lib/function/function.cpp # new file: lib/function/functions.h # modified: src/common/common.h # new file: src/common/pin_definitions.h # new file: src/light/light.cpp # new file: src/light/light.h #
1 parent bc36d74 commit 0408586

File tree

8 files changed

+458
-0
lines changed

8 files changed

+458
-0
lines changed

.ccls

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
clang
2+
3+
%c -Wall -ffunction-sections -fdata-sections -mthumb -mcpu=cortex-m7 -nostdlib -mfloat-abi=hard -mfpu=fpv5-d16 -O2
4+
%cpp -fno-exceptions -felide-constructors -fno-rtti -std=gnu++17 -Wno-error=narrowing -fpermissive -fno-threadsafe-statics -Wall -ffunction-sections -fdata-sections -mthumb -mcpu=cortex-m7 -nostdlib -mfloat-abi=hard -mfpu=fpv5-d16 -O2
5+
6+
-I/home/ben/solar-car/TeensyBottomShellReborn/include
7+
-I/home/ben/solar-car/TeensyBottomShellReborn/src
8+
-I/home/ben/solar-car/TeensyBottomShellReborn/.pio/libdeps/teensy41/ChRt/src
9+
-I/home/ben/solar-car/TeensyBottomShellReborn/lib/function
10+
-I/home/ben/.platformio/packages/framework-arduinoteensy/cores/teensy4
11+
-I/home/ben/solar-car/TeensyBottomShellReborn/.pio/libdeps/teensy41/Unity/src
12+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ADC
13+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/AccelStepper/src
14+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_NeoPixel
15+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_STMPE610
16+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_VS1053
17+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001
18+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001/utility
19+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/AltSoftSerial
20+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Artnet
21+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Audio
22+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Audio/utility
23+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Bounce
24+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Bounce2/src
25+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/CapacitiveSensor
26+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/CryptoAccel/src
27+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/DS1307RTC
28+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/DmxSimple
29+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/DogLcd
30+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/EEPROM
31+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/EasyTransfer/src
32+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/EasyTransferI2C/src
33+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Encoder
34+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Encoder/utility
35+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Entropy
36+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Ethernet/src
37+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FNET/src
38+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FastCRC
39+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FastLED/src
40+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN
41+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN_T4
42+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FlexIO_t4/src
43+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FlexiTimer2
44+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FreqCount
45+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasure
46+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasureMulti
47+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/FrequencyTimer2
48+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ILI9341_t3
49+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ILI9488_t3/src
50+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/IRremote/src
51+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Keypad/src
52+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LedControl/src
53+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LedDisplay
54+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystal/src
55+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystalFast
56+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LittleFS/src
57+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/LowPower
58+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/MFRC522/src
59+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/MIDI/src
60+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Metro
61+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/MsTimer2
62+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense
63+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense/utility
64+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/NativeEthernet/src
65+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/OSC
66+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/OctoWS2811
67+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/OneWire
68+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard
69+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard/utility
70+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/PWMServo
71+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Ping
72+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/PulsePosition
73+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/QuadEncoder
74+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/RA8875/src
75+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/RadioHead
76+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ResponsiveAnalogRead/src
77+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SD/src
78+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SPI
79+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SPIFlash
80+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ST7735_t3/src
81+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src
82+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash
83+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Servo
84+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ShiftPWM
85+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Snooze/src
86+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SoftPWM
87+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/SoftwareSerial
88+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TFT_ILI9163C
89+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Talkie
90+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TeensyThreads
91+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Time
92+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TimeAlarms
93+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TimerOne
94+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TimerThree
95+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TinyGPS
96+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Tlc5940
97+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/TouchScreen
98+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36
99+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36/utility
100+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/UTFT
101+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/VirtualWire
102+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/WS2812Serial
103+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Wire
104+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/Wire/utility
105+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/XBee
106+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/XPT2046_Touchscreen
107+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/i2c_t3
108+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ks0108
109+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/ssd1351
110+
-I/home/ben/.platformio/packages/framework-arduinoteensy/libraries/x10
111+
-I/home/ben/.platformio/packages/toolchain-gccarmnoneeabi-teensy/arm-none-eabi/include/c++/11.3.1
112+
-I/home/ben/.platformio/packages/toolchain-gccarmnoneeabi-teensy/arm-none-eabi/include/c++/11.3.1/arm-none-eabi
113+
-I/home/ben/.platformio/packages/toolchain-gccarmnoneeabi-teensy/lib/gcc/arm-none-eabi/11.3.1/include-fixed
114+
-I/home/ben/.platformio/packages/toolchain-gccarmnoneeabi-teensy/lib/gcc/arm-none-eabi/11.3.1/include
115+
-I/home/ben/.platformio/packages/toolchain-gccarmnoneeabi-teensy/arm-none-eabi/include
116+
117+
-DPLATFORMIO=60116
118+
-D__IMXRT1062__
119+
-DARDUINO_TEENSY41
120+
-DUSB_SERIAL
121+
-DARDUINO=10805
122+
-DTEENSYDUINO=159
123+
-DCORE_TEENSY
124+
-DF_CPU=600000000
125+
-DLAYOUT_US_ENGLISH

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"files.associations": {
3+
"cstdlib": "cpp",
4+
"iostream": "cpp",
5+
"iosfwd": "cpp",
6+
"ostream": "cpp",
7+
"*.tpp": "cpp",
8+
"*.tcc": "cpp"
9+
}
10+
}

lib/function/function.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <functions.h>
2+
3+
4+
int addition::add(int a, int b) {
5+
return a + b;
6+
}

lib/function/functions.h

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef FUNCTIONS_H
2+
#define FUNCTIONS_H
3+
4+
class addition {
5+
6+
public:
7+
addition() {}
8+
int add (int a, int b);
9+
};
10+
11+
#endif

src/common/common.h

+14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@
33

44
#include <Arduino.h>
55
#include "can_setup.h"
6+
#include "pin_definitions.h"
67
#include <ChRt.h>
78

9+
#define BAUD_RATE 500000
10+
11+
#define LIGHTS_PRIO (NORMALPRIO + 2)
12+
#define LIGHTS_WA 4096
13+
#define LIGHTS_SLEEP 100
14+
15+
#define ROUTER_PRIO (NORMALPRIO + 3)
16+
#define ROUTER_WA 2048
17+
#define ROUTER_SLEEP 40
18+
19+
#define HEARTBEAT_PRIO (LOWPRIO)
20+
#define HEARTBEAT_WA 512
21+
#define HEARTBEAT_SLEEP 100
822

923
#endif

src/common/pin_definitions.h

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @file pin_definitions.h
3+
* @brief Holds macros that serve as a hardware abstraction layer. Copied from TBS
4+
* @version 0.01
5+
*
6+
*
7+
*/
8+
9+
#ifndef BOTTOM_SHELL_H
10+
#define BOTTOM_SHELL_H
11+
12+
//TODO: Find pin for TRIGGER_MODE
13+
14+
//Teensy 4.1 pin mappings, all names are referenced to the Eagle schematics
15+
16+
//Left side of the board diagram
17+
#define TWELVE_V_MEASURE A0 //14, on the Eagle schematic as "12V_MEASURE"
18+
//15 is empty
19+
#define THROT1_IN A2 //16
20+
#define THROT2_IN A3 //17
21+
#define BPT_FR_IN A4 //18
22+
#define BPT_RR_IN A5 //19
23+
#define BPT_FL_IN A6 //20
24+
#define BPT_RL_IN A7 //21
25+
#define CAN0_TX A8 //22
26+
#define CAN0_RX A9 //23
27+
#define BRAKE_SWITCH A10 //24 EX7
28+
//A11 25 is empty
29+
//A12 26 is empty
30+
//A13 27 is empty
31+
#define RT_CTRL A14 //38
32+
#define LT_CTRL A15 //39
33+
#define BRAKE_CTRL A16 //40
34+
#define RUNNING_LIGHTS A17 //41
35+
//30 is empty
36+
//31 is empty
37+
#define BPS_STROBE 3
38+
//4 is empty
39+
#define FORWARD_REVERSE_IN 5 // EX1
40+
#define V_BAT VBAT
41+
42+
//Right side of the board diagram
43+
#define V_USB VUSB
44+
//#define USB0_D- D-
45+
//#define USB0_D+ D+
46+
#define CAN1_RX 0
47+
#define CAN_TX 1
48+
49+
//pins that were added on the updated bottom shell board schematic
50+
#define GPS_RX 7
51+
#define GPS_TX 8
52+
//28 is empty
53+
//29 is empty
54+
55+
#define CAN0_STB 34
56+
#define CAN1_STB 35
57+
#define EX4 10 // CHARGE_ENABLE/CHARGE_DISABLE
58+
#define EX5 11
59+
#define EX6 12
60+
//heartbeat is on 13, DO NOT USE
61+
//32 is empty
62+
#define RECALIBRATION_MODE_PIN 9 // EX 3
63+
#define TRIGGER_MODE 6 // EX 2
64+
#define GPS_MISC 33
65+
#define GPS_TRIG 36
66+
#define GPS_PPS 37
67+
68+
69+
70+
#endif

0 commit comments

Comments
 (0)