родитель
6ab0106af3
коммит
6eeebfeb5c
1 изменённых файлов: 9 добавлений и 0 удалений
|
@ -107,6 +107,15 @@ func (p Pin) Configure(config PinConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get returns the current value of a GPIO pin when the pin is configured as an
|
||||||
|
// input.
|
||||||
|
func (p Pin) Get() bool {
|
||||||
|
// See this document for details
|
||||||
|
// https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf
|
||||||
|
|
||||||
|
return esp.GPIO.GPIO_IN.Get()&(1<<p) != 0
|
||||||
|
}
|
||||||
|
|
||||||
// Set sets the output value of this pin to high (true) or low (false).
|
// Set sets the output value of this pin to high (true) or low (false).
|
||||||
func (p Pin) Set(value bool) {
|
func (p Pin) Set(value bool) {
|
||||||
if value {
|
if value {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче