1 | // espy Copyright (c) 2023 Josh Stockin <josh@joshstock.in> |
2 | // [https://joshstock.in] [https://github.com/joshuas3] |
3 | // |
4 | // This software is licensed and distributed under the terms of the MIT License. |
5 | // See the MIT License in the LICENSE file of this project's root folder. |
6 | // |
7 | // This comment block and its contents, including this disclaimer, MUST be |
8 | // preserved in all copies or distributions of this software's source. |
9 |
|
10 |
|
11 | // Filename: input.h |
12 | // Description: Input config/ISR/task functions and utilities |
13 |
|
14 |
|
15 | #pragma once |
16 |
|
17 |
|
18 | #include "esp_attr.h" |
19 | #include "esp_err.h" |
20 |
|
21 | // input utilities |
22 | #define NUM_RADIO_CHANNELS 10 |
23 | #define RADIO_PULSE_STOPGAP_US 5000 // length of transmission block separation in microseconds |
24 | |
25 | // input functions |
26 | esp_err_t setup_radio_and_rotenc_input( void ); // config, ISR creation, task creation |
27 | void radio_pulse( void* arg ); // ISR |
28 | void rotenc_switch( void* arg ); // ISR |
29 | void rotenc_rotate( void* arg ); // ISR |
30 | void input_handler_task( void* arg ); |
31 |
|
32 | // queue input event structure |
33 | typedef struct xInputEvent { |
34 | uint8_t type; |
35 | uint32_t data; |
36 | } xInputEvent; |
37 |
|
38 | // input event types |
39 | #define INPUT_EVENT_RADIOPULSE 0 |
40 | #define INPUT_EVENT_ROTENCSW 1 |
41 | #define INPUT_EVENT_ROTENCTURN 2 |
42 |
|
43 | // move to separate headers |
44 | esp_err_t setup_epd( void ); |
45 | esp_err_t setup_control_hardware( void ); |
46 | esp_err_t setup_control_loop( void ); |
47 |
|