- IRMP_DATA irmp_data;\r
-\r
- #pragma optsize-\r
- // crystal oscillator division factor: 1\r
- CLKPR=0x80;\r
- CLKPR=0x00;\r
- #ifdef _OPTIMIZE_SIZE_\r
- #pragma optsize+\r
- #endif\r
- static uint8_t *Proto[]={"SIRCS","NEC","SAMSUNG","MATSUSH","KASEIKYO","RECS80","RC5(x)","DENON","RC6","SAMSG32","APPLE"};\r
- #define IRMP_APPLE_ADDRESS 0x77E1 \r
-\r
-\r
- #if IRMP_LOGGING == 0\r
- // USART initialization has to be done here if Logging is off\r
- // Communication Parameters: 8 Data, 1 Stop, No Parity\r
- // USART Receiver: Off\r
- // USART Transmitter: On\r
- // USART0 Mode: Asynchronous\r
- // USART Baud Rate: 9600\r
- #define BAUDRATE 9600L\r
- UCSR0A=0x00;\r
- UCSR0B=0x08;\r
- UCSR0C=0x06;\r
- UBRR0H = ((F_CPU+BAUDRATE*8)/(BAUDRATE*16)-1) >> 8; // store baudrate (upper byte)\r
- UBRR0L = ((F_CPU+BAUDRATE*8)/(BAUDRATE*16)-1) & 0xFF; \r
- #endif\r
-\r
- irmp_init(); // initialize rc5\r
-\r
- printf("IRMP V1.0\n");\r
- #if IRMP_LOGGING == 1\r
- printf("Logging Mode\n");\r
- #endif\r
-\r
- timer_init(); // initialize timer\r
- #asm("sei"); // enable interrupts\r
-\r
- for (;;)\r
- {\r
- if (irmp_get_data (&irmp_data))\r
- {\r
- // ir signal decoded, do something here...\r
- // irmp_data.protocol is the protocol, see irmp.h\r
- // irmp_data.address is the address/manufacturer code of ir sender\r
- // irmp_data.command is the command code\r
- #if IRMP_LOGGING != 1\r
- if((irmp_data.protocol == IRMP_NEC_PROTOCOL) && (irmp_data.address == IRMP_APPLE_ADDRESS))\r
- printf("Code: Apple\n");\r
- else printf("Code: %s\n",Proto[irmp_data.protocol-1]);\r
- printf("Address: 0x%.2X\n",irmp_data.address);\r
- printf("Command: 0x%.2X\n\n",irmp_data.command);\r
- #endif\r
- }\r
- }\r
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);\r
+ TimerConfigure(TIMER1_BASE, TIMER_CFG_32_BIT_PER);\r
+\r
+ TimerLoadSet(TIMER1_BASE, TIMER_A, (F_CPU / F_INTERRUPTS) -1);\r
+ IntEnable(INT_TIMER1A);\r
+ TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);\r
+ TimerEnable(TIMER1_BASE, TIMER_A);\r
+ // Important: Timer1IntHandler has to be configured in startup_ccs.c !\r