board abstraction

This commit is contained in:
2024-04-08 19:40:48 +03:00
parent dd4ff43515
commit c50b3d90bf
23 changed files with 1705 additions and 686 deletions

View File

@@ -1,18 +1,85 @@
/*
* uDCCD.cpp
*
* Created: 12.03.2024 20:39:27
* Author : User
*/
/**** Includes ****/
#include "utils/utils.h"
#include "board/mcu/mcu_hal.h"
#include "board/ain.h"
#include "board/dio.h"
#include "board/hvdin.h"
#include "board/halfbridge.h"
#include "board/od_com.h"
#include "board/odout.h"
#include <avr/io.h>
/**** Private definitions ****/
/**** Private constants ****/
/**** Private variables ****/
static board::AnalogIn dccd_i(mcu::ADC0);
static board::AnalogIn dccd_u(mcu::ADC1);
static board::AnalogIn bat_u(mcu::ADC2);
static board::AnalogIn bat_i(mcu::ADC3);
static board::AnalogIn ain1(mcu::ADC5);
static board::AnalogIn ain2(mcu::ADC4);
static board::DigitalIO din1(mcu::GPIO0, board::DIO_HIGH);
static board::DigitalIO din2(mcu::GPIO1, board::DIO_HIGH);
static board::DigitalIO din3(mcu::GPIO2, board::DIO_HIGH);
static board::DigitalIO din4(mcu::GPIO3, board::DIO_HIGH);
static board::HVDigitalIn hvdin1(mcu::GPIO4, board::HVDIN_LOW);
static board::HVDigitalIn hvdin2(mcu::GPIO5, board::HVDIN_LOW);
static board::HVDigitalIn hvdin3(mcu::GPIO6, board::HVDIN_LOW);
/**** Private function declarations ****/
/**** Public function definitions ****/
int main(void)
{
/* Replace with your application code */
while (1)
{
}
mcu::startupCfg_t mcu_cfg;
mcu_cfg.adc_clk = mcu::ADC_DIV2;
mcu_cfg.pwm_clk = mcu::TIM_DIV1;
mcu_cfg.pwm_top = 200;
mcu_cfg.pwm_ch1_en = 1;
mcu::startup(&mcu_cfg);
dccd_i.mul = 1;
dccd_i.div = 1;
dccd_i.offset = 0;
dccd_u.mul = 1;
dccd_u.div = 1;
dccd_u.offset = 0;
bat_u.mul = 1;
bat_u.div = 1;
bat_u.offset = 0;
bat_i.mul = 1;
bat_i.div = 1;
bat_i.offset = 0;
// Super loop
while(1)
{
dccd_i.read();
dccd_u.read();
bat_u.read();
bat_i.read();
ain1.read();
ain2.read();
din1.read();
din2.read();
din3.read();
din4.read();
hvdin1.read();
hvdin2.read();
hvdin3.read();
continue; // End of super loop
}
// Escape the matrix
return 0;
}
/**** Private function definitions ***/