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.
 
 

35 lines
761 B

#pragma once
#include "zbasic.h"
namespace iflytop {
class ZGPIO {
private:
zaf_gpio_t m_gpio;
bool inited = false;
public:
ZGPIO() {};
void initAsInput(Pin_t pin, zaf_gpio_mode_t mode, zaf_gpio_irq_t irqtype, bool mirror);
void initAsOutput(Pin_t pin, zaf_gpio_mode_t mode, bool mirror, bool initLevel);
bool read();
int32_t readint32() { return read() ? 1 : 0; }
void write(bool level);
void toggle();
bool getState() { return read(); }
bool setState(bool state) {
write(state);
return true;
}
bool isInited() { return inited; }
Pin_t pin() { return m_gpio.pin; }
GPIO_TypeDef* port() { return m_gpio.gpio; }
uint32_t pinoff() { return m_gpio.pinoff; }
};
} // namespace iflytop