Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions firmware/lib/hardware_mapping/ec_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion firmware/lib/serial_comms/CommsSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template <typename BaseSerial> class CommsSerial_t : public BaseSerial {
}
};

extern CommsSerial_t<HardwareSerial> HW_CommsSerial;
extern CommsSerial_t<Uart> HW_CommsSerial;
extern CommsSerial_t<USBSerial> USB_CommsSerial;

#define CommsSerial HW_CommsSerial
2 changes: 1 addition & 1 deletion firmware/lib/throttle_valves/AMT242AV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions firmware/lib/throttle_valves/AMT242AV.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
// 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);
void zero();
void reset();

private:
HardwareSerial &uart;
Uart &uart;
unsigned int SEL;
uint8_t ID;

Expand Down
2 changes: 1 addition & 1 deletion firmware/lib/throttle_valves/ThrottleValves.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion firmware/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions firmware/src/ec_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

// shared interfaces
CommsSerial_t<USBSerial> USB_CommsSerial;
CommsSerial_t<HardwareSerial> HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX);
CommsSerial_t<HardwareSerial> HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX);
CommsSerial_t<Uart> HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX);
CommsSerial_t<Uart> 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);
Expand Down
9 changes: 7 additions & 2 deletions firmware/src/fc_main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include "CommsSerial.h"
// #include "CommsSerial.h"
#include <Arduino.h>

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() {}
4 changes: 2 additions & 2 deletions firmware/src/prog_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// Citations commented as [pg#]

CommsSerial_t<USBSerial> USB_CommsSerial;
CommsSerial_t<HardwareSerial> HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX);
CommsSerial_t<HardwareSerial> HW_FallbackSerial(PIN_HW_FALLBACK_SERIAL_RX, PIN_HW_FALLBACK_SERIAL_TX);
CommsSerial_t<Uart> HW_CommsSerial(PIN_HW_COMM_SERIAL_RX, PIN_HW_COMM_SERIAL_TX);
CommsSerial_t<Uart> 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);

Expand Down
Loading