Continued work

This commit is contained in:
2024-07-25 18:46:17 +03:00
parent 8c47b9cae8
commit 6219290880
60 changed files with 2024 additions and 2057 deletions

View File

@@ -1,41 +1,67 @@
#ifndef BSP_BOARD_H_
#define BSP_BOARD_H_
#ifndef UDCCD_BOARD_H_
#define UDCCD_BOARD_H_
/**** Includes ****/
#include <stdint.h>
#include "mcu/mcu_hal.h"
#include "ain.h"
#include "ain_lpf.h"
#include "din.h"
#include "dout.h"
#include "dio.h"
#include "halfbridge.h"
#include "pwm.h"
#include "pwm_out.h"
static bsp::AnalogIn dccd_i = bsp::AnalogIn(mcu::ADC0);
static bsp::AnalogIn dccd_u = bsp::AnalogIn(mcu::ADC1);
static bsp::AnalogIn bat_u = bsp::AnalogIn(mcu::ADC2);
static bsp::AnalogIn bat_i = bsp::AnalogIn(mcu::ADC3);
static bsp::Hafbridge hbridge = bsp::Hafbridge(mcu::PWM0, mcu::GPIO15, 95);
static bsp::AnalogIn ain1 = bsp::AnalogIn(mcu::ADC5); // mode
static bsp::AnalogIn ain2 = bsp::AnalogIn(mcu::ADC4); // pot
static bsp::DigitalIn din1 = bsp::DigitalIn(mcu::GPIO0, 0, bsp::DIN_HIGH); //mode
static bsp::DigitalIn din2 = bsp::DigitalIn(mcu::GPIO1, 0, bsp::DIN_HIGH); //pot
static bsp::DigitalIn din3 = bsp::DigitalIn(mcu::GPIO2, 0, bsp::DIN_HIGH); //down
static bsp::DigitalIn din4 = bsp::DigitalIn(mcu::GPIO3, 0, bsp::DIN_HIGH); //up
static bsp::DigitalIn hvdin1 = bsp::DigitalIn(mcu::GPIO4, 1, bsp::DIN_LOW); //dimm
static bsp::DigitalIn hvdin2 = bsp::DigitalIn(mcu::GPIO5, 1, bsp::DIN_LOW); //brakes
static bsp::DigitalIn hvdin3 = bsp::DigitalIn(mcu::GPIO6, 1, bsp::DIN_LOW); //hbrake
static bsp::DigitalIO hvdin3_pull = bsp::DigitalIO(mcu::GPIO7, bsp::DIN_HIGH); //hbrake pull
static bsp::DigitalOut odout1 = bsp::DigitalOut(mcu::GPIO9, 1);
static bsp::DigitalOut odout2 = bsp::DigitalOut(mcu::GPIO10, 1);
static bsp::DigitalOut odout3 = bsp::DigitalOut(mcu::GPIO11, 1);
static bsp::DigitalOut odout4 = bsp::DigitalOut(mcu::GPIO12, 1);
static bsp::DigitalOut odout5 = bsp::DigitalOut(mcu::GPIO13, 1);
static bsp::DigitalOut odout6 = bsp::DigitalOut(mcu::GPIO14, 1);
static bsp::PWMout od_pwm = bsp::PWMout(mcu::PWM1);
namespace bsp {
void board_init(void);
void board_read(void);
/**** Public definitions ****/
class Board
{
public:
Board(void);
~Board(void);
void init(void);
AnalogIn out_voltage;
AnalogIn out_current;
AnalogIn battery_voltage;
AnalogIn battery_current;
AnalogIn ain1;
AnalogIn ain2;
DigitalIn din1;
DigitalIn din2;
DigitalIn din3;
DigitalIn din4;
DigitalIn hvdin1;
DigitalIn hvdin2;
DigitalIn hvdin3;
DigitalOut hvdin3_pull;
DigitalOut freq_pull;
DigitalOut od1;
DigitalOut od2;
DigitalOut od3;
DigitalOut od4;
DigitalOut od5;
DigitalOut od6;
PwmOut od_pwm;
PwmOut out_pwm;
DigitalOut out_low;
void read(void);
#endif /* BSP_BOARD_H_ */
#ifndef TESTING
protected:
#endif
};
/**** Public function declarations ****/
#ifdef TESTING
#endif
} //namespace
#endif /* UDCCD_BOARD_H_ */