example code IRBlaster
Greenchips IR Blaster gives the easiest way to use various IR format and it is being tested and supported on mbed platform. It supports remote control format as followings.
- NEC
- NEC with Simple Repeat
- Toshia
- Toshiba with Simple Repeat,
- Philips-RC5
- Sony(12bits)
- Sony(15bits)
- Sony(20bits)
- Misubish
- JVC
IR_Blaster.h@0:7896055e7ec5, 2014-09-11 (annotated)
- Committer:
- DavidJoo
- Date:
- Thu Sep 11 01:29:42 2014 +0000
- Revision:
- 0:7896055e7ec5
IRBlaster Initial code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DavidJoo | 0:7896055e7ec5 | 1 | /** |
DavidJoo | 0:7896055e7ec5 | 2 | * IR Blaster driver |
DavidJoo | 0:7896055e7ec5 | 3 | * |
DavidJoo | 0:7896055e7ec5 | 4 | * please see Dream-IV User manual for more detail information. |
DavidJoo | 0:7896055e7ec5 | 5 | * |
DavidJoo | 0:7896055e7ec5 | 6 | ****/ |
DavidJoo | 0:7896055e7ec5 | 7 | |
DavidJoo | 0:7896055e7ec5 | 8 | /* |
DavidJoo | 0:7896055e7ec5 | 9 | * UART Packet Structure |
DavidJoo | 0:7896055e7ec5 | 10 | |
DavidJoo | 0:7896055e7ec5 | 11 | ------------------------------------------------ |
DavidJoo | 0:7896055e7ec5 | 12 | | SOP | Payload Size | Command | Payload | EOP | |
DavidJoo | 0:7896055e7ec5 | 13 | | (1) | (1) | (1) | (0~128) | (1) | |
DavidJoo | 0:7896055e7ec5 | 14 | ------------------------------------------------ |
DavidJoo | 0:7896055e7ec5 | 15 | */ |
DavidJoo | 0:7896055e7ec5 | 16 | |
DavidJoo | 0:7896055e7ec5 | 17 | #define SOP 0xFE //start of frame |
DavidJoo | 0:7896055e7ec5 | 18 | #define EOP 0xEF //end of frame |
DavidJoo | 0:7896055e7ec5 | 19 | |
DavidJoo | 0:7896055e7ec5 | 20 | #define COMMAND_GET_VERSION 0x00 |
DavidJoo | 0:7896055e7ec5 | 21 | #define COMMAND_START_IROUT 0x01 |
DavidJoo | 0:7896055e7ec5 | 22 | #define COMMAND_STOP_IROUT 0x02 |
DavidJoo | 0:7896055e7ec5 | 23 | |
DavidJoo | 0:7896055e7ec5 | 24 | // Response Command = 0x80 | Command |
DavidJoo | 0:7896055e7ec5 | 25 | /* ----------------------------------------------------------- |
DavidJoo | 0:7896055e7ec5 | 26 | | SOP | Payload Size | 0x80 | Command | Payload | EOP | |
DavidJoo | 0:7896055e7ec5 | 27 | | 0xFE| 1byte | (1) | (reponse) | 0xEF | |
DavidJoo | 0:7896055e7ec5 | 28 | ----------------------------------------------------------- |
DavidJoo | 0:7896055e7ec5 | 29 | */ |
DavidJoo | 0:7896055e7ec5 | 30 | |
DavidJoo | 0:7896055e7ec5 | 31 | #define RSP_ACK 0x00 |
DavidJoo | 0:7896055e7ec5 | 32 | #define RSP_INVALID_PACKET 0x10 |
DavidJoo | 0:7896055e7ec5 | 33 | #define RSP_INVALID_COMMAND 0x10 |
DavidJoo | 0:7896055e7ec5 | 34 | #define RSP_INVALID_FORMATID 0x10 |
DavidJoo | 0:7896055e7ec5 | 35 | |
DavidJoo | 0:7896055e7ec5 | 36 | // Format Types |
DavidJoo | 0:7896055e7ec5 | 37 | #define NEC 0x01 |
DavidJoo | 0:7896055e7ec5 | 38 | #define NEC_SR 0x02 //NEC simple repeate |
DavidJoo | 0:7896055e7ec5 | 39 | #define TOSHIBA 0x03 |
DavidJoo | 0:7896055e7ec5 | 40 | #define TOSHIBA_SR 0x04 // Toshiba simple repeate |
DavidJoo | 0:7896055e7ec5 | 41 | #define PHILIPS_RC5 0x05 |
DavidJoo | 0:7896055e7ec5 | 42 | #define SONY_12BITS 0x06 |
DavidJoo | 0:7896055e7ec5 | 43 | #define SONY_15BITS 0x07 |
DavidJoo | 0:7896055e7ec5 | 44 | #define SONY_20BITS 0x08 |
DavidJoo | 0:7896055e7ec5 | 45 | #define MISUBISHI 0x09 |
DavidJoo | 0:7896055e7ec5 | 46 | #define JVC 0x0A |
DavidJoo | 0:7896055e7ec5 | 47 | |
DavidJoo | 0:7896055e7ec5 | 48 | |
DavidJoo | 0:7896055e7ec5 | 49 | |
DavidJoo | 0:7896055e7ec5 | 50 | |
DavidJoo | 0:7896055e7ec5 | 51 | |
DavidJoo | 0:7896055e7ec5 | 52 |