sitara_depot/components/free_rtos/gpio/gpio.hpp

46 lines
787 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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_ */