News
Shop
Learn
Community
Ein Bild oder sowas
LUCIDAC Documentation
User Docs
Pybrid
Julia
C++
Firmware
REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
io.cpp
Go to the documentation of this file.
1
// Copyright (c) 2024 anabrid GmbH
2
// Contact: https://www.anabrid.com/licensing/
3
//
4
// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
5
6
#include <Arduino.h>
7
8
#include <io/io.h>
9
10
FLASHMEM
11
12
FLASHMEM
13
void
io::init() {
14
for
(
auto
pin : {PIN_BUTTON, PIN_DIO_6, PIN_DIO_11, PIN_DIO_12, PIN_DIO_23, PIN_DIO_28, PIN_RESERVED_7})
15
pinMode(pin, INPUT_PULLUP);
16
pinMode(PIN_DIO_13, INPUT_PULLDOWN);
17
}
18
19
bool
io::get_button() {
return
!digitalReadFast(PIN_BUTTON); }
20
21
FLASHMEM
22
void
io::block_until_button_press_and_release() {
23
// Wait until pressed
24
while
(!get_button()) {
25
delay(10);
26
}
27
// Wait until released
28
while
(get_button()) {
29
delay(10);
30
}
31
}
lib
hardware
src
io
io.cpp
Generated by
1.12.0