diff --git a/firmware/lib/hardware_mapping/ec_pins.h b/firmware/lib/hardware_mapping/ec_pins.h index 7b23ae7..9eb8cc9 100644 --- a/firmware/lib/hardware_mapping/ec_pins.h +++ b/firmware/lib/hardware_mapping/ec_pins.h @@ -15,8 +15,8 @@ // RS485 Busses (UART6 and UART2) // these are declared in ec_main -extern HardwareSerial RS485_6; // RS485 on UART 6 -extern HardwareSerial RS485_2; // RS485 on UART 2 +extern Uart RS485_6; // RS485 on UART 6 +extern Uart RS485_2; // RS485 on UART 2 #define PIN_RS485_6_RX PG9 #define PIN_RS485_6_TX PG14 diff --git a/firmware/lib/serial_comms/CommsSerial.h b/firmware/lib/serial_comms/CommsSerial.h index 7f05e6e..d7d9f65 100644 --- a/firmware/lib/serial_comms/CommsSerial.h +++ b/firmware/lib/serial_comms/CommsSerial.h @@ -68,7 +68,7 @@ template class CommsSerial_t : public BaseSerial { } }; -extern CommsSerial_t HW_CommsSerial; +extern CommsSerial_t HW_CommsSerial; extern CommsSerial_t USB_CommsSerial; #define CommsSerial HW_CommsSerial \ No newline at end of file diff --git a/firmware/lib/throttle_valves/AMT242AV.cpp b/firmware/lib/throttle_valves/AMT242AV.cpp index 8acb538..79b7537 100644 --- a/firmware/lib/throttle_valves/AMT242AV.cpp +++ b/firmware/lib/throttle_valves/AMT242AV.cpp @@ -5,7 +5,7 @@ // max reading for a 12 bit encoder #define MAX_READING ((1 << 12) - 1) -AMT242AV::AMT242AV(HardwareSerial &uart, unsigned int SEL, uint8_t ID) : uart(uart), SEL(SEL), ID(ID) {} +AMT242AV::AMT242AV(Uart &uart, unsigned int SEL, uint8_t ID) : uart(uart), SEL(SEL), ID(ID) {} void AMT242AV::begin() { digitalWrite(SEL, LOW); diff --git a/firmware/lib/throttle_valves/AMT242AV.h b/firmware/lib/throttle_valves/AMT242AV.h index ba0175b..cfce3d9 100644 --- a/firmware/lib/throttle_valves/AMT242AV.h +++ b/firmware/lib/throttle_valves/AMT242AV.h @@ -6,7 +6,7 @@ // encoder) class AMT242AV { public: - AMT242AV(HardwareSerial &uart, unsigned int SEL, uint8_t ID); + AMT242AV(Uart &uart, unsigned int SEL, uint8_t ID); void begin(); bool read_pos(float *out, int max_retries = 10); @@ -14,7 +14,7 @@ class AMT242AV { void reset(); private: - HardwareSerial &uart; + Uart &uart; unsigned int SEL; uint8_t ID; diff --git a/firmware/lib/throttle_valves/ThrottleValves.h b/firmware/lib/throttle_valves/ThrottleValves.h index 27a82e6..c47b28f 100644 --- a/firmware/lib/throttle_valves/ThrottleValves.h +++ b/firmware/lib/throttle_valves/ThrottleValves.h @@ -5,7 +5,7 @@ class ThrottleValve { public: - ThrottleValve(uint16_t motor_can_id, HardwareSerial &enc_uart, unsigned int enc_SEL, unsigned int enc_ID) + ThrottleValve(uint16_t motor_can_id, Uart &enc_uart, unsigned int enc_SEL, unsigned int enc_ID) : motor(motor_can_id), encoder(enc_uart, enc_SEL, enc_ID) {}; void begin(); diff --git a/firmware/platformio.ini b/firmware/platformio.ini index 00fbaef..a481298 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [env] -platform = ststm32 @ 19.6.0 +platform = ststm32 @ 20.0.0 framework = arduino monitor_speed = 57600 diff --git a/firmware/src/ec_main.cpp b/firmware/src/ec_main.cpp index 55d3af5..ed80c3a 100644 --- a/firmware/src/ec_main.cpp +++ b/firmware/src/ec_main.cpp @@ -12,11 +12,11 @@ // shared interfaces CommsSerial_t USB_CommsSerial; -CommsSerial_t HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX); -CommsSerial_t HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX); +CommsSerial_t HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX); +CommsSerial_t HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX); // TODO - configure DE pin -HardwareSerial RS485_6(PIN_RS485_6_RX, PIN_RS485_6_TX, PIN_RS485_6_DE); -HardwareSerial RS485_2(PIN_RS485_2_RX, PIN_RS485_2_TX, PIN_RS485_2_DE); +Uart RS485_6(PIN_RS485_6_RX, PIN_RS485_6_TX, PIN_RS485_6_DE); +Uart RS485_2(PIN_RS485_2_RX, PIN_RS485_2_TX, PIN_RS485_2_DE); SPIClass PT_TC_SPI_1(PIN_PT_TC_SPI_1_MOSI, PIN_PT_TC_SPI_1_MISO, PIN_PT_TC_SPI_1_SCK); SPIClass PT_TC_SPI_3(PIN_PT_TC_SPI_3_MOSI, PIN_PT_TC_SPI_3_MISO, PIN_PT_TC_SPI_3_SCK); diff --git a/firmware/src/fc_main.cpp b/firmware/src/fc_main.cpp index 8b26fa9..c8086ba 100644 --- a/firmware/src/fc_main.cpp +++ b/firmware/src/fc_main.cpp @@ -1,6 +1,11 @@ -#include "CommsSerial.h" +// #include "CommsSerial.h" #include -void setup() {} +void setup() +{ + Serial.begin(9600); + + Serial.println("init"); // had to add this; for some reason without it we don't pull in Print.cpp which causes a linker error because _write is not defined +} void loop() {} \ No newline at end of file diff --git a/firmware/src/prog_main.cpp b/firmware/src/prog_main.cpp index 75716b7..f79b300 100644 --- a/firmware/src/prog_main.cpp +++ b/firmware/src/prog_main.cpp @@ -8,8 +8,8 @@ // Citations commented as [pg#] CommsSerial_t USB_CommsSerial; -CommsSerial_t HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX); -CommsSerial_t HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX); +CommsSerial_t HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX); +CommsSerial_t HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX); SPIClass Prog_SPI(PIN_PROG_SPI_MOSI, PIN_PROG_SPI_MISO, PIN_PROG_SPI_SCK);