feat-hal-2 (#4)
Finished working initial version Co-authored-by: Andis Zīle <andis.jarganns@gmail.com> Reviewed-on: #4 Co-authored-by: Andis Zīle <andis.jargans@gmail.com> Co-committed-by: Andis Zīle <andis.jargans@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
69
firmware/src/dccd/dccd_hw.h
Normal file
69
firmware/src/dccd/dccd_hw.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#ifndef DCCD_HW_H_
|
||||
#define DCCD_HW_H_
|
||||
|
||||
/**** Includes ****/
|
||||
#include <stdint.h>
|
||||
#include "../bsp/board.h"
|
||||
#include "../utils/vcounter.h"
|
||||
#include "../hw/button.h"
|
||||
#include "../hw/led_display.h"
|
||||
#include "../hw/potentiometer.h"
|
||||
#include "../hw/out_driver.h"
|
||||
#include "../hw/safe_ain.h"
|
||||
#include "../hw/out_reg.h"
|
||||
|
||||
namespace dccd {
|
||||
|
||||
/**** Public definitions ****/
|
||||
class DccdHw
|
||||
{
|
||||
public:
|
||||
typedef struct {
|
||||
uint8_t pwm_f_khz;
|
||||
uint8_t handbrake_pull_up;
|
||||
uint8_t speed_hall;
|
||||
uint16_t counter_step_us;
|
||||
} dccdHwCfg_t;
|
||||
|
||||
DccdHw(void);
|
||||
~DccdHw(void);
|
||||
|
||||
void init(dccdHwCfg_t* cfg);
|
||||
|
||||
// Inputs
|
||||
hw::SafeAin out_voltage;
|
||||
hw::SafeAin out_current;
|
||||
hw::SafeAin battery_voltage;
|
||||
hw::SafeAin battery_current;
|
||||
|
||||
hw::Button btn_up;
|
||||
hw::Button btn_down;
|
||||
hw::Button btn_mode;
|
||||
hw::Button handbrake;
|
||||
hw::Button brakes;
|
||||
hw::Button dimm;
|
||||
|
||||
hw::Potentiometer pot;
|
||||
|
||||
// Outputs
|
||||
hw::LedDisplay display;
|
||||
hw::OutReg outreg;
|
||||
|
||||
void read(void);
|
||||
void write(void);
|
||||
|
||||
#ifdef TESTING
|
||||
protected:
|
||||
#endif
|
||||
bsp::Board board_hw;
|
||||
util::VCounter counter;
|
||||
};
|
||||
|
||||
/**** Public function declarations ****/
|
||||
|
||||
#ifdef TESTING
|
||||
#endif
|
||||
|
||||
} //namespace
|
||||
|
||||
#endif /* DCCD_HW_H_ */
|
||||
Reference in New Issue
Block a user