/*************************************************************************** * Copyright (C) 04/2011 by Olaf Rempel * * razzor@kopf-tisch.de * * * * 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; version 2 of the License, * * * * 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, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include /* * attiny24: (no self programming, 2.7V BOD, 8MHz internal RC Osz) * LFUSE = 0xC2 * HFUSE = 0xDD * EFUSE = 0xFF * * RC5 Input on PB2 (INT0) * PROGMODE Jumper (active low) on PB1 * OUTPUT (active low) on PB0 */ /* RC5 bitlength is 1778us +/-10% convert to timer0 ticks (8us) */ #define BITWIDTH (1778 / 8) #define BITWIDTH_MIN (BITWIDTH - (BITWIDTH / 10)) #define BITWIDTH_MAX (BITWIDTH + (BITWIDTH / 10)) #define RC5_BITCNT 14 #define RC5_CMD_MASK 0x37FF #define RC5_COMPLETE 0x8000 #define PROGMODE_CHECK() (!(PINB & (1<= RC5_BITCNT) value |= RC5_COMPLETE; bitcnt = 0; } int main(int argc, char *argv[]) { DDRB = (1<