Compare commits
9 Commits
c50b3d90bf
...
f320bfefb7
| Author | SHA1 | Date | |
|---|---|---|---|
| f320bfefb7 | |||
| 8f7e5036e7 | |||
| 78de20e05b | |||
| 417ecf4128 | |||
| dda6c7a2ad | |||
| 6199f3c43f | |||
| 6d5c8d226f | |||
| 0b9d6fa780 | |||
| 989d5a1f13 |
@@ -1,7 +1,7 @@
|
|||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
#include "mcu/mcu_hal.h"
|
#include "mcu/mcu_hal.h"
|
||||||
#include "hvdin.h"
|
#include "din.h"
|
||||||
|
|
||||||
using namespace board;
|
using namespace board;
|
||||||
|
|
||||||
@@ -11,25 +11,28 @@ using namespace board;
|
|||||||
/**** Private function declarations ****/
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
/**** Public function definitions ****/
|
/**** Public function definitions ****/
|
||||||
board::HVDigitalIn::HVDigitalIn(uint8_t gpio_ch, uint8_t init_read)
|
board::DigitalIn::DigitalIn(uint8_t gpio_ch, uint8_t inverted, uint8_t init_value)
|
||||||
{
|
{
|
||||||
this->gpio_ch = gpio_ch;
|
this->gpio_ch = gpio_ch;
|
||||||
|
this->invert = inverted;
|
||||||
|
|
||||||
if(init_read) this->last_read = HVDIN_HIGH;
|
if(init_value) this->last_read = DIN_HIGH;
|
||||||
else this->last_read = HVDIN_LOW;
|
else this->last_read = DIN_LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
board::HVDigitalIn::~HVDigitalIn(void)
|
board::DigitalIn::~DigitalIn(void)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t board::HVDigitalIn::read(void)
|
uint8_t board::DigitalIn::read(void)
|
||||||
{
|
{
|
||||||
// Auto inverts level to match board external connectors
|
|
||||||
uint8_t lvl = mcu::gpio_read(this->gpio_ch);
|
uint8_t lvl = mcu::gpio_read(this->gpio_ch);
|
||||||
if(lvl>0) this->last_read = HVDIN_LOW;
|
|
||||||
else this->last_read = HVDIN_HIGH;
|
if(this->invert) lvl = util::invert(lvl);
|
||||||
|
|
||||||
|
if(lvl>0) this->last_read = DIN_HIGH;
|
||||||
|
else this->last_read = DIN_LOW;
|
||||||
|
|
||||||
return this->last_read;
|
return this->last_read;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef HV_DIN_H_
|
#ifndef DIGITAL_INPUT_H_
|
||||||
#define HV_DIN_H_
|
#define DIGITAL_INPUT_H_
|
||||||
|
|
||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -7,17 +7,18 @@
|
|||||||
namespace board {
|
namespace board {
|
||||||
|
|
||||||
/**** Public definitions ****/
|
/**** Public definitions ****/
|
||||||
const uint8_t HVDIN_LOW = 0;
|
const uint8_t DIN_LOW = 0;
|
||||||
const uint8_t HVDIN_HIGH = 1;
|
const uint8_t DIN_HIGH = 1;
|
||||||
|
|
||||||
class HVDigitalIn
|
class DigitalIn
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint8_t gpio_ch;
|
uint8_t gpio_ch;
|
||||||
|
uint8_t invert;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HVDigitalIn(uint8_t gpio_ch, uint8_t init_read);
|
DigitalIn(uint8_t gpio_ch, uint8_t inverted, uint8_t init_value);
|
||||||
~HVDigitalIn(void);
|
~DigitalIn(void);
|
||||||
|
|
||||||
uint8_t last_read;
|
uint8_t last_read;
|
||||||
|
|
||||||
@@ -31,4 +32,4 @@ class HVDigitalIn
|
|||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|
||||||
#endif /* HV_DIN_H_ */
|
#endif /* DIGITAL_INPUT_H_ */
|
||||||
@@ -11,52 +11,19 @@ using namespace board;
|
|||||||
/**** Private function declarations ****/
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
/**** Public function definitions ****/
|
/**** Public function definitions ****/
|
||||||
board::DigitalIO::DigitalIO(uint8_t gpio_ch, uint8_t init_read)
|
board::DigitalIO::DigitalIO(uint8_t gpio_ch, uint8_t init_value) : DigitalIn(gpio_ch, 0, init_value), DigitalOut(gpio_ch, 0)
|
||||||
{
|
{
|
||||||
this->gpio_ch = gpio_ch;
|
return;
|
||||||
|
|
||||||
if(init_read) this->last_read = (uint8_t)DIO_HIGH;
|
|
||||||
else this->last_read = (uint8_t)DIO_LOW;
|
|
||||||
|
|
||||||
this->write(DIO_HIZ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
board::DigitalIO::~DigitalIO(void)
|
board::DigitalIO::~DigitalIO(void)
|
||||||
{
|
{
|
||||||
this->write(DIO_HIZ);
|
this->write(DOUT_HIZ);
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t board::DigitalIO::read(void)
|
|
||||||
{
|
|
||||||
uint8_t lvl = mcu::gpio_read(this->gpio_ch);
|
|
||||||
if(lvl>0) this->last_read = (uint8_t)DIO_HIGH;
|
|
||||||
else this->last_read = (uint8_t)DIO_LOW;
|
|
||||||
|
|
||||||
return this->last_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
void board::DigitalIO::write(int8_t level)
|
|
||||||
{
|
|
||||||
if(level > 0)
|
|
||||||
{
|
|
||||||
this->last_set = DIO_HIGH;
|
|
||||||
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIGH);
|
|
||||||
}
|
|
||||||
else if(level < 0)
|
|
||||||
{
|
|
||||||
this->last_set = DIO_HIZ;
|
|
||||||
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIZ);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->last_set = DIO_LOW;
|
|
||||||
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_LOW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t board::DigitalIO::is_io_match(void)
|
uint8_t board::DigitalIO::is_io_match(void)
|
||||||
{
|
{
|
||||||
if(this->last_set == DIO_HIZ) return 1;
|
if(this->last_set == DOUT_HIZ) return 1;
|
||||||
|
|
||||||
uint8_t read_lvl = this->read();
|
uint8_t read_lvl = this->read();
|
||||||
|
|
||||||
@@ -64,9 +31,4 @@ uint8_t board::DigitalIO::is_io_match(void)
|
|||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t board::DigitalIO::get_set_level(void)
|
|
||||||
{
|
|
||||||
return this->last_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**** Private function definitions ****/
|
/**** Private function definitions ****/
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#ifndef DIGITAL_OUT_H_
|
#ifndef DIGITAL_IO_H_
|
||||||
#define DIGITAL_OUT_H_
|
#define DIGITAL_IO_H_
|
||||||
|
|
||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "din.h"
|
||||||
|
#include "dout.h"
|
||||||
|
|
||||||
namespace board {
|
namespace board {
|
||||||
|
|
||||||
@@ -11,22 +13,13 @@ const int8_t DIO_LOW = 0;
|
|||||||
const int8_t DIO_HIGH = 1;
|
const int8_t DIO_HIGH = 1;
|
||||||
const int8_t DIO_HIZ = -1;
|
const int8_t DIO_HIZ = -1;
|
||||||
|
|
||||||
class DigitalIO
|
class DigitalIO : public DigitalIn, public DigitalOut
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
uint8_t gpio_ch;
|
|
||||||
int8_t last_set;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DigitalIO(uint8_t gpio_ch, uint8_t init_read);
|
DigitalIO(uint8_t gpio_ch, uint8_t init_value);
|
||||||
~DigitalIO(void);
|
~DigitalIO(void);
|
||||||
|
|
||||||
uint8_t last_read;
|
|
||||||
|
|
||||||
uint8_t read(void);
|
|
||||||
void write(int8_t level);
|
|
||||||
uint8_t is_io_match(void);
|
uint8_t is_io_match(void);
|
||||||
int8_t get_set_level(void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**** Public function declarations ****/
|
/**** Public function declarations ****/
|
||||||
@@ -36,4 +29,4 @@ class DigitalIO
|
|||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|
||||||
#endif /* DIGITAL_OUT_H_ */
|
#endif /* DIGITAL_IO_H_ */
|
||||||
52
firmware/src/board/dout.cpp
Normal file
52
firmware/src/board/dout.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/**** Includes ****/
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
#include "mcu/mcu_hal.h"
|
||||||
|
#include "dout.h"
|
||||||
|
|
||||||
|
using namespace board;
|
||||||
|
|
||||||
|
/**** Private definitions ****/
|
||||||
|
/**** Private constants ****/
|
||||||
|
/**** Private variables ****/
|
||||||
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
|
/**** Public function definitions ****/
|
||||||
|
board::DigitalOut::DigitalOut(uint8_t gpio_ch, uint8_t inverted)
|
||||||
|
{
|
||||||
|
this->gpio_ch = gpio_ch;
|
||||||
|
this->invert = inverted;
|
||||||
|
this->write(DOUT_HIZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
board::DigitalOut::~DigitalOut(void)
|
||||||
|
{
|
||||||
|
this->write(DOUT_HIZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void board::DigitalOut::write(int8_t level)
|
||||||
|
{
|
||||||
|
if(level > 0)
|
||||||
|
{
|
||||||
|
this->last_set = DOUT_HIGH;
|
||||||
|
if(this->invert) mcu::gpio_write(this->gpio_ch, mcu::LEVEL_LOW);
|
||||||
|
else mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIGH);
|
||||||
|
}
|
||||||
|
else if(level == 0)
|
||||||
|
{
|
||||||
|
this->last_set = DOUT_LOW;
|
||||||
|
if(this->invert) mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIGH);
|
||||||
|
else mcu::gpio_write(this->gpio_ch, mcu::LEVEL_LOW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->last_set = DOUT_HIZ;
|
||||||
|
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t board::DigitalOut::get_set_level(void)
|
||||||
|
{
|
||||||
|
return this->last_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** Private function definitions ****/
|
||||||
36
firmware/src/board/dout.h
Normal file
36
firmware/src/board/dout.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef DIGITAL_OUTPUT_H_
|
||||||
|
#define DIGITAL_OUTPUT_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace board {
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
const int8_t DOUT_LOW = 0;
|
||||||
|
const int8_t DOUT_HIGH = 1;
|
||||||
|
const int8_t DOUT_HIZ = -1;
|
||||||
|
|
||||||
|
class DigitalOut
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
uint8_t gpio_ch;
|
||||||
|
uint8_t invert;
|
||||||
|
int8_t last_set;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DigitalOut(uint8_t gpio_ch, uint8_t inverted);
|
||||||
|
~DigitalOut(void);
|
||||||
|
|
||||||
|
void write(int8_t level);
|
||||||
|
int8_t get_set_level(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
|
||||||
|
#endif /* DIGITAL_OUTPUT_H_ */
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/**** Includes ****/
|
|
||||||
#include "../utils/utils.h"
|
|
||||||
#include "mcu/mcu_hal.h"
|
|
||||||
#include "odout.h"
|
|
||||||
|
|
||||||
using namespace board;
|
|
||||||
|
|
||||||
/**** Private definitions ****/
|
|
||||||
/**** Private constants ****/
|
|
||||||
/**** Private variables ****/
|
|
||||||
/**** Private function declarations ****/
|
|
||||||
|
|
||||||
/**** Public function definitions ****/
|
|
||||||
board::OpenDrainOut::OpenDrainOut(uint8_t gpio_ch)
|
|
||||||
{
|
|
||||||
this->gpio_ch = gpio_ch;
|
|
||||||
this->write(OD_OFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
board::OpenDrainOut::~OpenDrainOut(void)
|
|
||||||
{
|
|
||||||
this->write(OD_OFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void board::OpenDrainOut::write(uint8_t state)
|
|
||||||
{
|
|
||||||
if(state)
|
|
||||||
{
|
|
||||||
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_HIGH);
|
|
||||||
this->last_set = OD_ON;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mcu::gpio_write(this->gpio_ch, mcu::LEVEL_LOW);
|
|
||||||
this->last_set = OD_OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t board::OpenDrainOut::get_set_state(void)
|
|
||||||
{
|
|
||||||
return this->last_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**** Private function definitions ****/
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#ifndef OD_OUT_H_
|
|
||||||
#define OD_OUT_H_
|
|
||||||
|
|
||||||
/**** Includes ****/
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
namespace board {
|
|
||||||
|
|
||||||
/**** Public definitions ****/
|
|
||||||
const uint8_t OD_OFF = 0;
|
|
||||||
const uint8_t OD_ON = 1;
|
|
||||||
|
|
||||||
class OpenDrainOut
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
uint8_t gpio_ch;
|
|
||||||
uint8_t last_set;
|
|
||||||
|
|
||||||
public:
|
|
||||||
OpenDrainOut(uint8_t gpio_ch);
|
|
||||||
~OpenDrainOut(void);
|
|
||||||
|
|
||||||
void write(uint8_t state);
|
|
||||||
uint8_t get_set_state(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**** Public function declarations ****/
|
|
||||||
|
|
||||||
#ifdef TESTING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} //namespace
|
|
||||||
|
|
||||||
#endif /* OD_OUT_H_ */
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
#include "mcu/mcu_hal.h"
|
#include "mcu/mcu_hal.h"
|
||||||
#include "od_com.h"
|
#include "pwm.h"
|
||||||
|
|
||||||
using namespace board;
|
using namespace board;
|
||||||
|
|
||||||
@@ -11,18 +11,18 @@ using namespace board;
|
|||||||
/**** Private function declarations ****/
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
/**** Public function definitions ****/
|
/**** Public function definitions ****/
|
||||||
board::ODCommon::ODCommon(uint8_t pwm_ch)
|
board::PWMout::PWMout(uint8_t pwm_ch)
|
||||||
{
|
{
|
||||||
this->pwm_ch = pwm_ch;
|
this->pwm_ch = pwm_ch;
|
||||||
this->write(0);
|
this->write(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
board::ODCommon::~ODCommon(void)
|
board::PWMout::~PWMout(void)
|
||||||
{
|
{
|
||||||
this->write(0);
|
this->write(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void board::ODCommon::write(uint8_t duty)
|
void board::PWMout::write(uint8_t duty)
|
||||||
{
|
{
|
||||||
// Convert percent to 16b duty cycle
|
// Convert percent to 16b duty cycle
|
||||||
uint16_t dc = util::percent_to_16b(duty);
|
uint16_t dc = util::percent_to_16b(duty);
|
||||||
@@ -32,7 +32,7 @@ void board::ODCommon::write(uint8_t duty)
|
|||||||
this->last_duty = duty;
|
this->last_duty = duty;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t board::ODCommon::get_set_duty(void)
|
uint8_t board::PWMout::get_set_duty(void)
|
||||||
{
|
{
|
||||||
return this->last_duty;
|
return this->last_duty;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef OD_COMMON_H_
|
#ifndef PWM_H_
|
||||||
#define OD_COMMON_H_
|
#define PWM_H_
|
||||||
|
|
||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -7,15 +7,15 @@
|
|||||||
namespace board {
|
namespace board {
|
||||||
|
|
||||||
/**** Public definitions ****/
|
/**** Public definitions ****/
|
||||||
class ODCommon
|
class PWMout
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint8_t pwm_ch;
|
uint8_t pwm_ch;
|
||||||
uint8_t last_duty;
|
uint8_t last_duty;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ODCommon(uint8_t pwm_ch);
|
PWMout(uint8_t pwm_ch);
|
||||||
~ODCommon(void);
|
~PWMout(void);
|
||||||
|
|
||||||
void write(uint8_t duty);
|
void write(uint8_t duty);
|
||||||
uint8_t get_set_duty(void);
|
uint8_t get_set_duty(void);
|
||||||
@@ -28,4 +28,4 @@ class ODCommon
|
|||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|
||||||
#endif /* OD_COMMON_H_ */
|
#endif /* PWM_H_ */
|
||||||
44
firmware/src/board/udccd_board.h
Normal file
44
firmware/src/board/udccd_board.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef UDCCD_BOARD_H_
|
||||||
|
#define UDCCD_BOARD_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
using namespace board;
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
static AnalogIn dccd_i(mcu::ADC0);
|
||||||
|
static AnalogIn dccd_u(mcu::ADC1);
|
||||||
|
static AnalogIn bat_u(mcu::ADC2);
|
||||||
|
static AnalogIn bat_i(mcu::ADC3);
|
||||||
|
|
||||||
|
static Hafbridge hbridge(mcu::PWM0, mcu::GPIO15, 95);
|
||||||
|
|
||||||
|
static AnalogIn ain1(mcu::ADC5);
|
||||||
|
static AnalogIn ain2(mcu::ADC4);
|
||||||
|
|
||||||
|
static DigitalIn din1(mcu::GPIO0, 0, board::DIN_HIGH);
|
||||||
|
static DigitalIn din2(mcu::GPIO1, 0, board::DIN_HIGH);
|
||||||
|
static DigitalIn din3(mcu::GPIO2, 0, board::DIN_HIGH);
|
||||||
|
static DigitalIn din4(mcu::GPIO3, 0, board::DIN_HIGH);
|
||||||
|
|
||||||
|
static DigitalIn hvdin1(mcu::GPIO4, 1, board::DIN_LOW);
|
||||||
|
static DigitalIn hvdin2(mcu::GPIO5, 1, board::DIN_LOW);
|
||||||
|
static DigitalIn hvdin3(mcu::GPIO6, 1, board::DIN_LOW);
|
||||||
|
static DigitalIO hvdin3_pull(mcu::GPIO3, board::DIN_HIGH);
|
||||||
|
|
||||||
|
static DigitalOut odout1(mcu::GPIO9, 1);
|
||||||
|
static DigitalOut odout2(mcu::GPIO10, 1);
|
||||||
|
static DigitalOut odout3(mcu::GPIO11, 1);
|
||||||
|
static DigitalOut odout4(mcu::GPIO12, 1);
|
||||||
|
static DigitalOut odout5(mcu::GPIO13, 1);
|
||||||
|
static DigitalOut odout6(mcu::GPIO14, 1);
|
||||||
|
|
||||||
|
static PWMout od_pwm(mcu::PWM1);
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* UDCCD_BOARD_H_ */
|
||||||
85
firmware/src/hw/button.cpp
Normal file
85
firmware/src/hw/button.cpp
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/**** Includes ****/
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
#include "button.h"
|
||||||
|
|
||||||
|
using namespace hw;
|
||||||
|
|
||||||
|
/**** Private definitions ****/
|
||||||
|
/**** Private constants ****/
|
||||||
|
/**** Private variables ****/
|
||||||
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
|
/**** Public function definitions ****/
|
||||||
|
hw::Button::Button(board::DigitalIn* din_ch, uint8_t act_lvl, uint8_t dbnc_lim, uint8_t init_state)
|
||||||
|
{
|
||||||
|
this->din_ch = din_ch;
|
||||||
|
|
||||||
|
if(act_lvl) this->act_lvl = board::DIN_HIGH;
|
||||||
|
else this->act_lvl = board::DIN_LOW;
|
||||||
|
|
||||||
|
this->dbnc_cnter = 0;
|
||||||
|
this->dbnc_lim = dbnc_lim;
|
||||||
|
|
||||||
|
if(init_state) this->state = BUTTON_ON;
|
||||||
|
else this->state = BUTTON_OFF;
|
||||||
|
|
||||||
|
this->time = 0;
|
||||||
|
this->is_new = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hw::Button::~Button(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t hw::Button::read(void)
|
||||||
|
{
|
||||||
|
// Read din level
|
||||||
|
uint8_t lvl = this->din_ch->read();
|
||||||
|
|
||||||
|
// Increase state counter
|
||||||
|
this->time = util::sat_add(this->time, 1);
|
||||||
|
|
||||||
|
// Determine next state
|
||||||
|
uint8_t next_state = BUTTON_OFF;
|
||||||
|
if(lvl==this->act_lvl) next_state = BUTTON_ON;
|
||||||
|
|
||||||
|
// Advance debounce sample counter
|
||||||
|
if(next_state != this->state) this->dbnc_cnter++;
|
||||||
|
else this->dbnc_cnter = 0;
|
||||||
|
|
||||||
|
// Check for debounce end
|
||||||
|
if(this->dbnc_cnter < this->dbnc_lim) return this->state;
|
||||||
|
|
||||||
|
// Debounce end. Apply new state.
|
||||||
|
this->state = next_state;
|
||||||
|
this->time = 0;
|
||||||
|
this->is_new = 1;
|
||||||
|
this->dbnc_cnter = 0;
|
||||||
|
|
||||||
|
return this->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t hw::Button::force_read(void)
|
||||||
|
{
|
||||||
|
// Read din level
|
||||||
|
uint8_t lvl = this->din_ch->read();
|
||||||
|
|
||||||
|
// Cancels active debounce
|
||||||
|
this->dbnc_cnter = 0;
|
||||||
|
|
||||||
|
// Determine next state
|
||||||
|
uint8_t next_state = BUTTON_OFF;
|
||||||
|
if(lvl==this->act_lvl) next_state = BUTTON_ON;
|
||||||
|
|
||||||
|
if(next_state != this->state)
|
||||||
|
{
|
||||||
|
this->state = next_state;
|
||||||
|
this->time = 0;
|
||||||
|
this->is_new = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
return this->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** Private function definitions ****/
|
||||||
41
firmware/src/hw/button.h
Normal file
41
firmware/src/hw/button.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef BUTTON_H_
|
||||||
|
#define BUTTON_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "../board/din.h"
|
||||||
|
|
||||||
|
namespace hw {
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
const uint8_t BUTTON_OFF = 0;
|
||||||
|
const uint8_t BUTTON_ON = 1;
|
||||||
|
|
||||||
|
class Button
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
board::DigitalIn* din_ch;
|
||||||
|
uint8_t act_lvl;
|
||||||
|
uint8_t dbnc_cnter;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Button(board::DigitalIn* din_ch, uint8_t act_lvl, uint8_t dbnc_lim, uint8_t init_state);
|
||||||
|
~Button(void);
|
||||||
|
|
||||||
|
uint8_t state;
|
||||||
|
uint16_t time;
|
||||||
|
uint8_t dbnc_lim;
|
||||||
|
uint8_t is_new;
|
||||||
|
|
||||||
|
uint8_t read(void);
|
||||||
|
uint8_t force_read(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
|
||||||
|
#endif /* BUTTON_H_ */
|
||||||
38
firmware/src/hw/cc_driver.cpp
Normal file
38
firmware/src/hw/cc_driver.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**** Includes ****/
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
#include "../utils/interpolate.h"
|
||||||
|
#include "potentiometer.h"
|
||||||
|
|
||||||
|
using namespace hw;
|
||||||
|
|
||||||
|
/**** Private definitions ****/
|
||||||
|
/**** Private constants ****/
|
||||||
|
/**** Private variables ****/
|
||||||
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
|
/**** Public function definitions ****/
|
||||||
|
hw::Potentiometer::Potentiometer(board::AnalogIn* ain_ch, uint16_t low_deadzone, uint16_t high_deadzone)
|
||||||
|
{
|
||||||
|
this->ain_ch = ain_ch;
|
||||||
|
this->low_deadzone = low_deadzone;
|
||||||
|
this->high_deadzone = high_deadzone;
|
||||||
|
this->percent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hw::Potentiometer::~Potentiometer(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t hw::Potentiometer::read(void)
|
||||||
|
{
|
||||||
|
// Update input
|
||||||
|
this->ain_ch->read();
|
||||||
|
|
||||||
|
// Calculate percent
|
||||||
|
this->percent = util::interpolate(this->ain_ch->last_read, this->low_deadzone, this->high_deadzone, 0, 100);
|
||||||
|
|
||||||
|
return this->percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** Private function definitions ****/
|
||||||
33
firmware/src/hw/cc_driver.h
Normal file
33
firmware/src/hw/cc_driver.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef CONST_CURRENT_DRIVER_H_
|
||||||
|
#define CONST_CURRENT_DRIVER_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "../board/ain.h"
|
||||||
|
#include "../board/halfbridge.h"
|
||||||
|
|
||||||
|
namespace hw {
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
|
||||||
|
class CCdriver
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
board::AnalogIn* sup_voltage;
|
||||||
|
board::AnalogIn* sup_current;
|
||||||
|
board::AnalogIn* ain_ch;
|
||||||
|
board::AnalogIn* ain_ch;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CCdriver(board::AnalogIn* ain_ch);
|
||||||
|
~CCdriver(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
|
||||||
|
#endif /* CONST_CURRENT_DRIVER_H_ */
|
||||||
180
firmware/src/hw/display_led.cpp
Normal file
180
firmware/src/hw/display_led.cpp
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
/**** Includes ****/
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
#include "display_led.h"
|
||||||
|
|
||||||
|
using namespace hw;
|
||||||
|
|
||||||
|
/**** Private definitions ****/
|
||||||
|
/**** Private constants ****/
|
||||||
|
/**** Private variables ****/
|
||||||
|
/**** Private function declarations ****/
|
||||||
|
static uint8_t img_gen_dot10(uint8_t percent);
|
||||||
|
static uint8_t img_gen_dot20(uint8_t percent);
|
||||||
|
static uint8_t img_gen_bar(uint8_t percent);
|
||||||
|
|
||||||
|
/**** Public function definitions ****/
|
||||||
|
hw::DisplayLed::DisplayLed(board::DigitalOut* led0, board::DigitalOut* led1, board::DigitalOut* led2, board::DigitalOut* led3, board::DigitalOut* led4, board::DigitalOut* led5, board::PWMout* common)
|
||||||
|
{
|
||||||
|
this->led0 = led0;
|
||||||
|
this->led1 = led1;
|
||||||
|
this->led2 = led2;
|
||||||
|
this->led3 = led3;
|
||||||
|
this->led4 = led4;
|
||||||
|
this->led5 = led5;
|
||||||
|
this->common = common;
|
||||||
|
|
||||||
|
this->led0->write(0);
|
||||||
|
this->led1->write(0);
|
||||||
|
this->led2->write(0);
|
||||||
|
this->led3->write(0);
|
||||||
|
this->led4->write(0);
|
||||||
|
this->led5->write(0);
|
||||||
|
this->common->write(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
hw::DisplayLed::~DisplayLed(void)
|
||||||
|
{
|
||||||
|
this->led0->write(0);
|
||||||
|
this->led1->write(0);
|
||||||
|
this->led2->write(0);
|
||||||
|
this->led3->write(0);
|
||||||
|
this->led4->write(0);
|
||||||
|
this->led5->write(0);
|
||||||
|
this->common->write(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hw::DisplayLed::show_percent(uint8_t percent, style_t style)
|
||||||
|
{
|
||||||
|
uint8_t image = 0x00;
|
||||||
|
|
||||||
|
switch(style)
|
||||||
|
{
|
||||||
|
case LED_DSP_BAR:
|
||||||
|
image = img_gen_bar(percent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LED_DSP_DOT10:
|
||||||
|
image = img_gen_dot10(percent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
image = img_gen_dot20(percent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->write(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hw::DisplayLed::write(uint8_t image)
|
||||||
|
{
|
||||||
|
if(image&0x01) this->led0->write(1);
|
||||||
|
else this->led0->write(0);
|
||||||
|
|
||||||
|
if(image&0x02) this->led1->write(1);
|
||||||
|
else this->led1->write(0);
|
||||||
|
|
||||||
|
if(image&0x04) this->led2->write(1);
|
||||||
|
else this->led2->write(0);
|
||||||
|
|
||||||
|
if(image&0x08) this->led3->write(1);
|
||||||
|
else this->led3->write(0);
|
||||||
|
|
||||||
|
if(image&0x10) this->led4->write(1);
|
||||||
|
else this->led4->write(0);
|
||||||
|
|
||||||
|
if(image&0x20) this->led5->write(1);
|
||||||
|
else this->led5->write(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hw::DisplayLed::set_brigthness(uint8_t percent)
|
||||||
|
{
|
||||||
|
this->common->write(percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** Private function definitions ****/
|
||||||
|
static uint8_t img_gen_dot10(uint8_t percent)
|
||||||
|
{
|
||||||
|
switch(percent)
|
||||||
|
{
|
||||||
|
case 0 ... 5:
|
||||||
|
return 0x01;
|
||||||
|
|
||||||
|
case 6 ... 15:
|
||||||
|
return 0x03;
|
||||||
|
|
||||||
|
case 16 ... 25:
|
||||||
|
return 0x02;
|
||||||
|
|
||||||
|
case 26 ... 35:
|
||||||
|
return 0x06;
|
||||||
|
|
||||||
|
case 36 ... 45:
|
||||||
|
return 0x04;
|
||||||
|
|
||||||
|
case 46 ... 55:
|
||||||
|
return 0x0C;
|
||||||
|
|
||||||
|
case 56 ... 65:
|
||||||
|
return 0x08;
|
||||||
|
|
||||||
|
case 66 ... 75:
|
||||||
|
return 0x18;
|
||||||
|
|
||||||
|
case 76 ... 85:
|
||||||
|
return 0x10;
|
||||||
|
|
||||||
|
case 86 ... 95:
|
||||||
|
return 0x30;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0x20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t img_gen_dot20(uint8_t percent)
|
||||||
|
{
|
||||||
|
switch(percent)
|
||||||
|
{
|
||||||
|
case 0 ... 10:
|
||||||
|
return 0x01;
|
||||||
|
|
||||||
|
case 11 ... 30:
|
||||||
|
return 0x02;
|
||||||
|
|
||||||
|
case 31 ... 50:
|
||||||
|
return 0x04;
|
||||||
|
|
||||||
|
case 51 ... 70:
|
||||||
|
return 0x08;
|
||||||
|
|
||||||
|
case 71 ... 90:
|
||||||
|
return 0x10;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0x20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t img_gen_bar(uint8_t percent)
|
||||||
|
{
|
||||||
|
switch(percent)
|
||||||
|
{
|
||||||
|
case 0 ... 10:
|
||||||
|
return 0x01;
|
||||||
|
|
||||||
|
case 11 ... 30:
|
||||||
|
return 0x03;
|
||||||
|
|
||||||
|
case 31 ... 50:
|
||||||
|
return 0x07;
|
||||||
|
|
||||||
|
case 51 ... 70:
|
||||||
|
return 0x0F;
|
||||||
|
|
||||||
|
case 71 ... 90:
|
||||||
|
return 0x1F;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0x3F;
|
||||||
|
}
|
||||||
|
}
|
||||||
47
firmware/src/hw/display_led.h
Normal file
47
firmware/src/hw/display_led.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#ifndef DISPLAY_LED_H_
|
||||||
|
#define DISPLAY_LED_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "../board/dout.h"
|
||||||
|
#include "../board/pwm.h"
|
||||||
|
|
||||||
|
namespace hw {
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
|
||||||
|
class DisplayLed
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
board::DigitalOut* led0;
|
||||||
|
board::DigitalOut* led1;
|
||||||
|
board::DigitalOut* led2;
|
||||||
|
board::DigitalOut* led3;
|
||||||
|
board::DigitalOut* led4;
|
||||||
|
board::DigitalOut* led5;
|
||||||
|
board::PWMout* common;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef enum {
|
||||||
|
LED_DSP_DOT20,
|
||||||
|
LED_DSP_DOT10,
|
||||||
|
LED_DSP_BAR
|
||||||
|
} style_t;
|
||||||
|
|
||||||
|
DisplayLed(board::DigitalOut* led0, board::DigitalOut* led1, board::DigitalOut* led2, board::DigitalOut* led3, board::DigitalOut* led4, board::DigitalOut* led5, board::PWMout* common);
|
||||||
|
~DisplayLed(void);
|
||||||
|
|
||||||
|
void show_percent(uint8_t percent, style_t style);
|
||||||
|
void write(uint8_t image);
|
||||||
|
|
||||||
|
void set_brigthness(uint8_t percent);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
|
||||||
|
#endif /* DISPLAY_LED_H_ */
|
||||||
38
firmware/src/hw/potentiometer.cpp
Normal file
38
firmware/src/hw/potentiometer.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**** Includes ****/
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
#include "../utils/interpolate.h"
|
||||||
|
#include "potentiometer.h"
|
||||||
|
|
||||||
|
using namespace hw;
|
||||||
|
|
||||||
|
/**** Private definitions ****/
|
||||||
|
/**** Private constants ****/
|
||||||
|
/**** Private variables ****/
|
||||||
|
/**** Private function declarations ****/
|
||||||
|
|
||||||
|
/**** Public function definitions ****/
|
||||||
|
hw::Potentiometer::Potentiometer(board::AnalogIn* ain_ch, uint16_t low_deadzone, uint16_t high_deadzone)
|
||||||
|
{
|
||||||
|
this->ain_ch = ain_ch;
|
||||||
|
this->low_deadzone = low_deadzone;
|
||||||
|
this->high_deadzone = high_deadzone;
|
||||||
|
this->percent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hw::Potentiometer::~Potentiometer(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t hw::Potentiometer::read(void)
|
||||||
|
{
|
||||||
|
// Update input
|
||||||
|
this->ain_ch->read();
|
||||||
|
|
||||||
|
// Calculate percent
|
||||||
|
this->percent = util::interpolate(this->ain_ch->last_read, this->low_deadzone, this->high_deadzone, 0, 100);
|
||||||
|
|
||||||
|
return this->percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** Private function definitions ****/
|
||||||
35
firmware/src/hw/potentiometer.h
Normal file
35
firmware/src/hw/potentiometer.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef POTENTIOMETER_H_
|
||||||
|
#define POTENTIOMETER_H_
|
||||||
|
|
||||||
|
/**** Includes ****/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "../board/ain.h"
|
||||||
|
|
||||||
|
namespace hw {
|
||||||
|
|
||||||
|
/**** Public definitions ****/
|
||||||
|
|
||||||
|
class Potentiometer
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
board::AnalogIn* ain_ch;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Potentiometer(board::AnalogIn* ain_ch, uint16_t low_deadzone, uint16_t high_deadzone);
|
||||||
|
~Potentiometer(void);
|
||||||
|
|
||||||
|
uint16_t low_deadzone;
|
||||||
|
uint16_t high_deadzone;
|
||||||
|
uint8_t percent;
|
||||||
|
|
||||||
|
uint8_t read(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**** Public function declarations ****/
|
||||||
|
|
||||||
|
#ifdef TESTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
|
||||||
|
#endif /* POTENTIOMETER_H_ */
|
||||||
@@ -1,33 +1,23 @@
|
|||||||
/**** Includes ****/
|
/**** Includes ****/
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
|
|
||||||
#include "board/mcu/mcu_hal.h"
|
#include "board/mcu/mcu_hal.h"
|
||||||
#include "board/ain.h"
|
#include "board/ain.h"
|
||||||
|
#include "board/din.h"
|
||||||
|
#include "board/dout.h"
|
||||||
#include "board/dio.h"
|
#include "board/dio.h"
|
||||||
#include "board/hvdin.h"
|
|
||||||
#include "board/halfbridge.h"
|
#include "board/halfbridge.h"
|
||||||
#include "board/od_com.h"
|
#include "board/pwm.h"
|
||||||
#include "board/odout.h"
|
|
||||||
|
#include "hw/button.h"
|
||||||
|
#include "hw/potentiometer.h"
|
||||||
|
#include "hw/display_led.h"
|
||||||
|
|
||||||
|
#include "board/udccd_board.h"
|
||||||
|
|
||||||
/**** Private definitions ****/
|
/**** Private definitions ****/
|
||||||
/**** Private constants ****/
|
/**** Private constants ****/
|
||||||
/**** Private variables ****/
|
/**** 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 ****/
|
/**** Private function declarations ****/
|
||||||
/**** Public function definitions ****/
|
/**** Public function definitions ****/
|
||||||
int main(void)
|
int main(void)
|
||||||
@@ -39,42 +29,10 @@ int main(void)
|
|||||||
mcu_cfg.pwm_ch1_en = 1;
|
mcu_cfg.pwm_ch1_en = 1;
|
||||||
|
|
||||||
mcu::startup(&mcu_cfg);
|
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
|
// Super loop
|
||||||
while(1)
|
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
|
continue; // End of super loop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,12 @@
|
|||||||
<Compile Include="board\ain.h">
|
<Compile Include="board\ain.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="board\din.cpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="board\din.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="board\dio.cpp">
|
<Compile Include="board\dio.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -171,28 +177,49 @@
|
|||||||
<Compile Include="board\halfbridge.h">
|
<Compile Include="board\halfbridge.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\hvdin.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="board\hvdin.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="board\mcu\mcu_hal.h">
|
<Compile Include="board\mcu\mcu_hal.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\mcu\mcu_hal_r8.cpp">
|
<Compile Include="board\mcu\mcu_hal_r8.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\odout.cpp">
|
<Compile Include="board\dout.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\odout.h">
|
<Compile Include="board\dout.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\od_com.cpp">
|
<Compile Include="board\pwm.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="board\od_com.h">
|
<Compile Include="board\pwm.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="board\udccd_board.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\button.cpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\button.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\cc_driver.cpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\cc_driver.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\display_led.cpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\display_led.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\potentiometer.cpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="hw\potentiometer.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="main.cpp">
|
<Compile Include="main.cpp">
|
||||||
@@ -214,6 +241,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="board" />
|
<Folder Include="board" />
|
||||||
<Folder Include="board\mcu" />
|
<Folder Include="board\mcu" />
|
||||||
|
<Folder Include="hw" />
|
||||||
<Folder Include="utils" />
|
<Folder Include="utils" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
|
|||||||
Reference in New Issue
Block a user