41 lines
699 B
C++
41 lines
699 B
C++
/**** Includes ****/
|
|
#include "../utils/utils.h"
|
|
#include "mcu/mcu_hal.h"
|
|
#include "dout.h"
|
|
|
|
using namespace bsp;
|
|
|
|
/**** Private definitions ****/
|
|
/**** Private constants ****/
|
|
/**** Private variables ****/
|
|
/**** Private function declarations ****/
|
|
/**** Public function definitions ****/
|
|
bsp::DigitalOut::DigitalOut(void)
|
|
{
|
|
this->is_init_done = 0;
|
|
return;
|
|
}
|
|
|
|
bsp::DigitalOut::~DigitalOut(void)
|
|
{
|
|
return;
|
|
}
|
|
|
|
void bsp::DigitalOut::write(int8_t level)
|
|
{
|
|
if(this->is_init_done==0) return;
|
|
|
|
if(this->is_inverted)
|
|
{
|
|
if(level==0) level = 1;
|
|
else if (level > 0) level = 0;
|
|
};
|
|
|
|
mcu::gpio_write(this->gpio_ch, level);
|
|
|
|
this->last_writen = level;
|
|
}
|
|
|
|
/**** Private function definitions ****/
|
|
|