Adds sitara_depot/free_rtos Original one is on server_gorbunov/SmartForce4.0/sitara_depot
46 lines
701 B
C++
46 lines
701 B
C++
/*
|
|
* 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_ */
|