led-controller/firmware/ir_nec.h

32 lines
1.2 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/>.
*
*/
/* This is part of the LED light controller program.
* It handles the IR NEC protocol decoding.
* More information at http://www.sbprojects.com/knowledge/ir/nec.php
*/
static const uint16_t MARKS[2]={9000,560}; /* mark duration in us [start,bit] */
static const uint16_t SPACES[4]={4500,2250,1680,560}; /* space duration in us [start,repeat,1,0] */
struct nec {
bool valid;
bool repeat;
uint8_t address;
uint8_t command;
};
void time2nec(uint16_t* burst, uint8_t pulses);
struct nec nec2data(uint16_t* burst, uint8_t pulses);