tutrcos
読み取り中…
検索中…
一致する文字列を見つけられません
tutrcos::peripheral::GPIO クラス

#include <gpio.hpp>

公開メンバ関数

 GPIO (GPIO_TypeDef *port, uint16_t pin)
 
 ~GPIO ()
 
void write (bool state)
 
bool read ()
 
void toggle ()
 
void set_callback (std::function< void()> &&callback)
 
GPIO_TypeDef * get_hal_port ()
 
uint16_t get_hal_pin ()
 

詳解

GPIO::set_callback を使う場合は System Core -> GPIO -> NVIC -> EXTI line x interrupts を有効化してください。

#include <tutrcos.hpp>
extern "C" void main_thread(void *) {
using namespace tutrcos::core;
using namespace tutrcos::peripheral;
GPIO led(LD2_GPIO_Port, LD2_Pin);
GPIO button(B1_GPIO_Port, B1_Pin);
button.set_callback([&] {
// GPIO EXTI 割り込み
});
while (true) {
led.write(!button.read()); // ボタンを押している間LED点灯
Thread::delay(10);
}
}
Definition gpio.hpp:39
Definition kernel.hpp:8
Definition can.hpp:15

構築子と解体子

◆ GPIO()

tutrcos::peripheral::GPIO::GPIO ( GPIO_TypeDef * port,
uint16_t pin )
inline

◆ ~GPIO()

tutrcos::peripheral::GPIO::~GPIO ( )
inline

関数詳解

◆ get_hal_pin()

uint16_t tutrcos::peripheral::GPIO::get_hal_pin ( )
inline

◆ get_hal_port()

GPIO_TypeDef * tutrcos::peripheral::GPIO::get_hal_port ( )
inline

◆ read()

bool tutrcos::peripheral::GPIO::read ( )
inline

◆ set_callback()

void tutrcos::peripheral::GPIO::set_callback ( std::function< void()> && callback)
inline

◆ toggle()

void tutrcos::peripheral::GPIO::toggle ( )
inline

◆ write()

void tutrcos::peripheral::GPIO::write ( bool state)
inline

このクラス詳解は次のファイルから抽出されました: