Skip to content
Draft
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
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Checks: 'bugprone-*, cppcoreguidelines-*, readability-identifier-naming, -cppcoreguidelines-avoid-non-const-global-variables, -bugprone-branch-clone, -cppcoreguidelines-pro-type-vararg, -bugprone-easily-swappable-parameters, -cppcoreguidelines-avoid-c-arrays'
WarningsAsErrors: 'cppcoreguidelines-*, bugprone-*, readability-identifier-naming'
FormatStyle: 'file'
SystemHeaders: false
CheckOptions:
- { key: readability-identifier-naming.ClassMemberCase, value: 'lower_case' }
- { key: readability-identifier-naming.ClassMemberPrefix, value: '_' }
Expand Down
4 changes: 0 additions & 4 deletions getcompilecommands.sh

This file was deleted.

364 changes: 183 additions & 181 deletions include/VCF_Constants.h

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions include/VCF_InterfaceTasks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef VCF_INTERFACETASKS
#define VCF_INTERFACETASKS

#include "VCF_Constants.h"

/* External Includes */
#include <ht_task.hpp>
#include "CANInterface.h"

/* Local Interface Includes */
#include "ACUInterface.h"
#include "ADCInterface.h"
#include "BrakeRotorTempInterface.h"
#include "DashboardInterface.h"
#include "OrbisInterface.h"
#include "SystemTimeInterface.h"
#include "VCFCANInterfaceImpl.h"
#include "VCFEthernetInterface.h"
#include "VCRInterface.h"
#include "WatchdogInterface.h"

/* Local System Includes */
#include "NeopixelController.h"


/**
* Init Functions - to be called in setup@
*/
void initialize_all_interfaces();

/**
* The read_adc0 task will command the ADCInterface to sample, convert, and store
* data from all eight channels of adc0.
*/
::HT_TASK::TaskResponse run_read_adc0_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

/**
* The read_adc0 task will command the ADCInterface to sample, convert, and store
* data from all eight channels of adc1.
*/
::HT_TASK::TaskResponse run_read_adc1_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);


::HT_TASK::TaskResponse run_kick_watchdog(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

/**
* The buzzer_control task will control the buzzer control pin. This function
* relies on the buzzer_control pin definition in VCF_Constants.h;
*/
::HT_TASK::TaskResponse init_buzzer_control_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);
::HT_TASK::TaskResponse run_buzzer_control_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

/**
* The handle_send_VCF_ethernet_data task will send a protobuf message from VCF
* to a destination port defined in EthernetAddressDefs. This function relies on
* the VCF (sending) socket and vcf_data defined in VCFGlobals.h, and Ethernet
* constants defined in EthernetAddressDefs.h.
*
*/
HT_TASK::TaskResponse init_handle_send_vcf_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);
HT_TASK::TaskResponse run_handle_send_vcf_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

// this task attempts to send any data that is enqueued at 250hz. this will be the max rate that you can send over the CAN bus.
// you dont have to enqeue at this rate, but this allows us to have 2 layers of rate limiting on CAN sending
HT_TASK::TaskResponse handle_CAN_send(const unsigned long &sysMicros, const HT_TASK::TaskInfo &taskInfo); // NOLINT (capitalization of CAN)

HT_TASK::TaskResponse run_dash_GPIOs_task(const unsigned long& sys_micros, const HT_TASK::TaskInfo& task_info); // NOLINT (capitalization of GPIOs)
HT_TASK::TaskResponse send_dash_data(const unsigned long &sysMicros, const HT_TASK::TaskInfo &taskInfo);

HT_TASK::TaskResponse enqueue_front_suspension_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

HT_TASK::TaskResponse debug_print(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

namespace async_tasks
{
// the others in the VCF Tasks can just stay there, they dont need forward declarations.
HT_TASK::TaskResponse handle_async_main(const unsigned long& sys_micros, const HT_TASK::TaskInfo& task_info);
}

#endif
33 changes: 33 additions & 0 deletions include/VCF_SystemTasks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef VCF_SYSTEMTASKS
#define VCF_SYSTEMTASKS

#include "VCF_Constants.h"

/* External Includes */
#include <ht_task.hpp>

/* Local System Includes */
#include "BuzzerController.h"
#include "EEPROMUtilities.h"
#include "IOExpanderUtilities.h"
#include "NeopixelController.h"
#include "PedalsSystem.h"
#include "SteeringSystem.h"

/**
* @brief Creates an instance of all systems.
*/
void initialize_all_systems();

::HT_TASK::TaskResponse enqueue_pedals_data(const unsigned long &sys_micros, const HT_TASK::TaskInfo& task_info);

::HT_TASK::TaskResponse update_pedals_calibration_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

::HT_TASK::TaskResponse enqueue_steering_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

::HT_TASK::TaskResponse update_steering_calibration_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

::HT_TASK::TaskResponse update_neopixels_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);


#endif
106 changes: 0 additions & 106 deletions include/VCF_Tasks.h

This file was deleted.

30 changes: 16 additions & 14 deletions lib/interfaces/include/ACUInterface.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
#ifndef ACU_INTERFACE_H
#define ACU_INTERFACE_H

/* ETL Library */
#include <etl/singleton.h>

/* External Includes */
#include "SharedFirmwareTypes.h"
#include "Arduino.h"
#include "etl/singleton.h"
#include "hytech.h"
#include "FlexCAN_T4.h"
#include "CANInterface.h"
#include <FlexCAN_T4.h>


class ACUInterface
class ACUInterface
{
public:
public:

ACUCoreData_s get_last_recvd_data() {return _last_recvd_data;}
ACUCoreData_s get_last_recvd_data() { return _last_recvd_data; }

float get_cell_voltage() {return _min_cell_voltage;}
float get_cell_voltage() { return _min_cell_voltage; }

void receive_ACU_voltages(const CAN_message_t &can_msg);

private:
void receive_ACU_voltages(const CAN_message_t &can_msg);

ACUCoreData_s _last_recvd_data;
float _min_cell_voltage = 0;

};
private:

ACUCoreData_s _last_recvd_data;
float _min_cell_voltage = 0;

};

using ACUInterfaceInstance = etl::singleton<ACUInterface>;

Expand Down
Loading
Loading