]>
Commit | Line | Data |
---|---|---|
ea29682a | 1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
2 | * irmp-main-stellaris-arm.c - demo main module to test IRMP decoder on LM4F120 Launchpad (ARM Cortex M4)\r | |
3 | *\r | |
4 | * Copyright (c) 2009-2016 Frank Meyer - frank(at)fli4l.de\r | |
5 | *\r | |
6 | * $Id: irmp-main-stellaris-arm.c,v 1.1 2016/01/12 11:55:05 fm Exp $\r | |
7 | *\r | |
8 | * This demo module is runnable on LM4F120 Launchpad (ARM Cortex M4)\r | |
9 | *\r | |
10 | * This program is free software; you can redistribute it and/or modify\r | |
11 | * it under the terms of the GNU General Public License as published by\r | |
12 | * the Free Software Foundation; either version 2 of the License, or\r | |
13 | * (at your option) any later version.\r | |
14 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
15 | */\r | |
16 | \r | |
17 | #include "irmp.h"\r | |
18 | \r | |
19 | #ifndef F_CPU\r | |
20 | #error F_CPU unknown\r | |
21 | #endif\r | |
22 | \r | |
23 | void\r | |
24 | timer1_init (void)\r | |
25 | {\r | |
26 | SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);\r | |
27 | TimerConfigure(TIMER1_BASE, TIMER_CFG_32_BIT_PER);\r | |
28 | \r | |
29 | TimerLoadSet(TIMER1_BASE, TIMER_A, (F_CPU / F_INTERRUPTS) -1);\r | |
30 | IntEnable(INT_TIMER1A);\r | |
31 | TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);\r | |
32 | TimerEnable(TIMER1_BASE, TIMER_A);\r | |
33 | // Important: Timer1IntHandler has to be configured in startup_ccs.c !\r | |
34 | }\r | |
35 | \r | |
36 | void\r | |
37 | Timer1IntHandler(void) // Timer1 Interrupt Handler\r | |
38 | {\r | |
39 | (void) irmp_ISR(); // call irmp ISR\r | |
40 | // call other timer interrupt routines...\r | |
41 | }\r | |
42 | \r | |
43 | int\r | |
44 | main (void)\r | |
45 | {\r | |
46 | IRMP_DATA irmp_data;\r | |
47 | \r | |
48 | ROM_FPUEnable();\r | |
49 | ROM_FPUStackingEnable();\r | |
50 | ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);\r | |
51 | \r | |
52 | irmp_init(); // initialize irmp\r | |
53 | timer1_init(); // initialize timer1\r | |
54 | sei (); // enable interrupts\r | |
55 | \r | |
56 | for (;;)\r | |
57 | {\r | |
58 | if (irmp_get_data (&irmp_data))\r | |
59 | {\r | |
60 | // ir signal decoded, do something here...\r | |
61 | // irmp_data.protocol is the protocol, see irmp.h\r | |
62 | // irmp_data.address is the address/manufacturer code of ir sender\r | |
63 | // irmp_data.command is the command code\r | |
64 | // irmp_protocol_names[irmp_data.protocol] is the protocol name (if enabled, see irmpconfig.h)\r | |
65 | }\r | |
66 | }\r | |
67 | }\r |