sitara_depot/components/free_rtos/gpio/gpio.hpp

46 lines
787 B
C++
Raw Normal View History

/*
* gpio.hpp
*
* Created on: 6 мар. 2023 г.
* Author: sychev
* Пины должны быть предварительно сконфигурированы в SysConfig в разделе GPIO
*/
#ifndef FREE_RTOS_GPIO_GPIO_HPP_
#define FREE_RTOS_GPIO_GPIO_HPP_
#include <cstdint>
namespace free_rtos {
class Gpio {
public:
enum Dir {
e_gpioDirOutput = 0,
e_gpioDirInput
};
/*
* num - номер пина
* Dir - направление вход/выход
*/
Gpio(uint32_t num, Dir dir, uint32_t base_address);
void set();
void clr();
bool get();
void toggle();
private:
const uint32_t num_;
const Dir dir_;
const uint32_t base_addr_;
};
}
#endif /* FREE_RTOS_GPIO_GPIO_HPP_ */