diff --git a/lib/ir_nec.h b/lib/ir_nec.h new file mode 100644 index 0000000..a5f242d --- /dev/null +++ b/lib/ir_nec.h @@ -0,0 +1,37 @@ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +/** library to decode InfraRed NEC code + * @file + * @author King Kévin + * @date 2018 + * @note peripherals used: timer channel @ref ir_nec_timer + */ +#pragma once + +/** set when an IR NEC code has been received */ +extern volatile bool ir_nec_code_received_flag; + +/** IR NEC code */ +struct ir_nec_code_t { + bool repeat; /**< if this is only a code repeat (received 42.42 ms after the code, 98.75 ms after a repeat) */ + uint8_t address; /**< code address (extended 16-bit address is not supported) */ + uint8_t command; /**< code command */ +}; + +/** last IR NEC code received */ +extern struct ir_nec_code_t ir_nec_code_received; + +/** setup peripherals to receive IR NEC codes */ +void ir_nec_setup(void);