Skip to content

Commit 56044dc

Browse files
Merge pull request #1 from KentuckySolarCar/light-router-dev
Light Router Re-Implementation from old TeensyBottomShell
2 parents cf8c30e + 984b9e2 commit 56044dc

File tree

14 files changed

+634
-62
lines changed

14 files changed

+634
-62
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

.gitignore

+46-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
1-
.pio
2-
.vscode/.browse.c_cpp.db*
3-
.vscode/c_cpp_properties.json
4-
.vscode/launch.json
5-
.vscode/ipch
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Compiled Static libraries
20+
*.lai
21+
*.la
22+
*.a
23+
*.lib
24+
25+
# Executables
26+
*.exe
27+
*.out
28+
*.app
29+
.pioenvs
30+
.piolibdeps
31+
.clang_complete
32+
.gcc-flags.json
33+
34+
# Custom
35+
.pio/*
36+
*.swp
37+
.vscode/extensions.json
38+
.vscode/
39+
.pio/
40+
hash.h
41+
42+
## ccls/clangd files and compilation files
43+
.ccls
44+
.ccls-cache/
45+
compile_commands.json
46+
.cache/

.gitmodules

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[submodule "lib"]
2+
path = lib
3+
; url = git@github.com:KentuckySolarCar/teensy_libs.git
4+
url = ../teensy_libs.git
5+
branch = bottom-shell-reborn

.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/README

-46
This file was deleted.

platformio.ini

+22
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,25 @@
1212
platform = teensy
1313
board = teensy41
1414
framework = arduino
15+
lib_deps =
16+
greiman/ChRt@=1.3.0
17+
FlexCAN_T4
18+
can_msg_ids
19+
UKSC_Alert
20+
build_flags =
21+
-Wall
22+
;-Isrc/battery
23+
-Isrc/common
24+
;-Isrc/gps
25+
;-Isrc/heartbeat
26+
;-Isrc/inputs
27+
;-Isrc/logging
28+
;-Isrc/misc
29+
;-Isrc/motor
30+
;-Isrc/mppt
31+
;-Isrc/sensors
32+
;-Isrc/serial
33+
;-Isrc/settings
34+
;-Isrc/telemetry
35+
;-Isrc/light
36+
;-Isrc/light_router

src/common/can_setup.h

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @file can_setup.h
3+
* @brief Declares the CAN ports used by the board
4+
* @version 0.1
5+
*
6+
* This header file must be included in any file that sends or receives data via CAN.
7+
* Each port object must be instantiated only once, so we instantiate them in
8+
* main.cpp and declare them here.
9+
*
10+
*/
11+
12+
#ifndef CAN_SETUP_H
13+
#define CAN_SETUP_H
14+
15+
#include <FlexCAN_T4.h>
16+
17+
/**
18+
* These typedefs aren't required, but they let us rename the ports.
19+
* Note that we're calling CAN1 can0 and we're calling CAN2 can1.
20+
* This is done to match the labels on the boards.
21+
*/
22+
typedef FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can0;
23+
typedef FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> can1;
24+
25+
26+
/**
27+
* This is where we specify which bus is connected to which port
28+
* and what we want to call each bus.
29+
*/
30+
extern can0 MainCan;
31+
extern can1 MotorCan;
32+
33+
#endif

src/common/common.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef COMMON_H
2+
#define COMMON_H
3+
4+
#include <Arduino.h>
5+
#include "can_setup.h"
6+
#include "pin_definitions.h"
7+
#include <ChRt.h>
8+
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
22+
23+
#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)