Could be working version
This commit is contained in:
62
firmware/src/bsp/board.cpp
Normal file
62
firmware/src/bsp/board.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/**** Includes ****/
|
||||
#include "../utils/utils.h"
|
||||
#include "board.h"
|
||||
|
||||
/**** Private definitions ****/
|
||||
/**** Private constants ****/
|
||||
/**** Private variables ****/
|
||||
/**** Private function declarations ****/
|
||||
|
||||
/**** Public function definitions ****/
|
||||
void board_init(void)
|
||||
{
|
||||
// MCU setup
|
||||
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);
|
||||
|
||||
// Board setup
|
||||
dccd_i.mul = 215;
|
||||
dccd_i.div = 22;
|
||||
dccd_i.offset = 0;
|
||||
dccd_i.last_read = 0;
|
||||
|
||||
dccd_u.mul = 20;
|
||||
dccd_u.div = 1;
|
||||
dccd_u.offset = 0;
|
||||
dccd_u.last_read = 0;
|
||||
|
||||
bat_u.mul = 20;
|
||||
bat_u.div = 1;
|
||||
bat_u.offset = 0;
|
||||
bat_u.last_read = 12000;
|
||||
|
||||
bat_i.mul = 235;
|
||||
bat_i.div = 6;
|
||||
bat_i.offset = 0;
|
||||
bat_i.last_read = 0;
|
||||
}
|
||||
|
||||
void board_read(void)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
/**** Private function definitions ****/
|
||||
Reference in New Issue
Block a user