40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
/* 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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
/** library to decode InfraRed NEC code
|
|
* @file
|
|
* @author King Kévin <kingkevin@cuvoodoo.info>
|
|
* @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) */
|
|
uint16_t address; /**< code address (8-bit for non-extended, 16-bit for extended) */
|
|
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
|
|
* @param[in] extended if the command address is extended (using 16 bits instead of 8, at the cost of error checking)
|
|
*/
|
|
void ir_nec_setup(bool extended);
|