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
10FLASHMEM
11
12FLASHMEM
13void 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
19bool io::get_button() { return !digitalReadFast(PIN_BUTTON); }
20
21FLASHMEM
22void 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}