2020/* Globally accessible types */
2121using CANRXBufferType = Circular_Buffer<uint8_t , (uint32_t )16 , sizeof (CAN_message_t)>;
2222using CANTXBufferType = Circular_Buffer<uint8_t , (uint32_t )128 , sizeof (CAN_message_t)>;
23- template <CAN_DEV_TABLE CAN_DEV > using FlexCAN_Type = FlexCAN_T4<CAN_DEV , RX_SIZE_256 , TX_SIZE_16 >;
23+
24+ // Definitions of VCF CAN bus types
25+ using TelemCAN_t = FlexCAN_T4<CAN1 , RX_SIZE_256 , TX_SIZE_16 >;
26+ using FrontAuxCAN_t = FlexCAN_T4<CAN2 , RX_SIZE_256 , TX_SIZE_16 >;
2427
2528/* Interfaces accessible to this one */
2629struct CANInterfaces {
@@ -33,30 +36,33 @@ struct CANInterfaces {
3336 ACUInterface &acu_interface;
3437 VCRInterface &vcr_interface;
3538};
39+ using CANInterfacesInstance = etl::singleton<CANInterfaces>;
3640
37- struct VCFCANInterfaceObjects {
41+ struct VCFCANInterface {
42+ VCFCANInterface (etl::delegate<void (CANInterfaces &, const CAN_message_t &, unsigned long , CANInterfaceType_e)> recv_switch_func)
43+ : can_recv_switch(recv_switch_func)
44+ {}
3845
39- VCFCANInterfaceObjects (etl::delegate<void (CANInterfaces &, const CAN_message_t &, unsigned long , CANInterfaceType_e)> recv_switch, FlexCAN_T4_Base * main_can): MAIN_CAN (main_can),can_recv_switch(recv_switch)
40- {}
46+ TelemCAN_t TELEM_CAN ;
4147
42-
43- FlexCAN_T4_Base* MAIN_CAN ;
44- // TODO fix this. needs to be a pointer to an in-main global created instance of CAN3. this also cannot be a base type.
45- CANRXBufferType main_can_rx_buffer;
46- CANTXBufferType main_can_tx_buffer;
47- etl::delegate<void (CANInterfaces &, const CAN_message_t &, unsigned long , CANInterfaceType_e)> can_recv_switch;
48-
48+ CANRXBufferType telem_can_rx_buffer;
49+ CANTXBufferType telem_can_tx_buffer;
50+
51+ FrontAuxCAN_t FRONT_AUX_CAN ;
52+
53+ CANRXBufferType front_aux_can_rx_buffer;
54+ CANTXBufferType front_aux_can_tx_buffer;
55+
56+ etl::delegate<void (CANInterfaces &, const CAN_message_t &, unsigned long , CANInterfaceType_e)> can_recv_switch;
4957};
58+ using VCFCANInterfaceInstance = etl::singleton<VCFCANInterface>;
5059
5160namespace VCFCANInterfaceImpl {
5261 void on_main_can_recv (const CAN_message_t &msg);
53- void vcf_recv_switch (CANInterfaces &interfaces, const CAN_message_t &msg, unsigned long millis, CANInterfaceType_e interface_type);
62+ void on_faux_can_recv (const CAN_message_t &msg);
63+
64+ void vcf_recv_switch (CANInterfaces &interfaces, const CAN_message_t &msg, unsigned long millis, CANInterfaceType_e interface_type); // vcf can receive
5465 void send_all_CAN_msgs (CANTXBufferType &buffer, FlexCAN_T4_Base *can_interface);
55-
56- extern FlexCAN_T4<CAN1 , RX_SIZE_256 , TX_SIZE_16 > main_can;
57-
58- using VCFCANInterfaceObjectsInstance = etl::singleton<VCFCANInterfaceObjects>;
59- using CANInterfacesInstance = etl::singleton<CANInterfaces>;
6066}
6167
6268#endif // VCFCANINTERFACEIMPL_H
0 commit comments