You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
681 B

#include "zgpio.hpp"
using namespace iflytop;
void ZGPIO::initAsInput(Pin_t pin, zaf_gpio_mode_t mode, zaf_gpio_irq_t irqtype, bool mirror) {
inited = true;
zaf_gpio_init_as_input(&m_gpio, pin, mode, irqtype, mirror);
}
void ZGPIO::initAsOutput(Pin_t pin, zaf_gpio_mode_t mode, bool mirror, bool initLevel) {
zaf_gpio_init_as_output(&m_gpio, pin, mode, mirror, initLevel);
inited = true;
}
bool ZGPIO::read() {
if (!inited) {
return false;
}
return zaf_gpio_read(&m_gpio);
}
void ZGPIO::write(bool level) {
if (!inited) {
return;
}
zaf_gpio_write(&m_gpio, level);
}
void ZGPIO::toggle() {
if (!inited) {
return;
}
zaf_gpio_toggle(&m_gpio);
}