├── lib ├── .holder └── apple-remote │ └── apple-remote.h ├── .gitignore ├── LICENSE ├── README.md └── src └── sketch.ino /lib/.holder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | *.swp 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 José Carlos Nieto, https://menteslibres.net/xiam 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apple Remote library for Arduino 2 | 3 | This library can work with an IR Receiver and an IR LED to decode and emit 4 | [Apple Remote][1] IR codes. 5 | 6 | The IR led is expected to be wired to the Arduino's pin #3 and GND. 7 | 8 | The IR receiver is expected to be wired to the Arduino's pin #2, GND and 5V. 9 | 10 | ## Code example 11 | 12 | Emitting signals. 13 | 14 | ```c 15 | #include 16 | 17 | void setup() 18 | { 19 | Serial.begin(9600); 20 | Serial.println("Point your IR led to an AppleTV."); 21 | } 22 | 23 | void loop() 24 | { 25 | // This is like pressing the real "menu" button. 26 | Serial.println("Sending signal: menu."); 27 | apple_remote_menu(); 28 | delay(100000); 29 | } 30 | ``` 31 | 32 | Receiving signals 33 | 34 | ```c 35 | #include 36 | #define SIGNAL_MAX_LENGTH 70 37 | 38 | void setup() 39 | { 40 | Serial.begin(9600); 41 | Serial.println("Point your Apple Controller to your IR sensor."); 42 | } 43 | 44 | void loop() 45 | { 46 | unsigned int signal[SIGNAL_MAX_LENGTH]; 47 | bool captured; 48 | int code; 49 | 50 | captured = irdebug_capture_signal(signal, SIGNAL_MAX_LENGTH); 51 | 52 | if (captured) { 53 | irdebug_print_signal(signal); 54 | code = apple_remote_match(signal); 55 | 56 | switch (code) { 57 | case APPLE_REMOTE_MENU: 58 | Serial.println("[menu]"); 59 | break; 60 | case APPLE_REMOTE_RIGHT: 61 | Serial.println("[right]"); 62 | break; 63 | case APPLE_REMOTE_LEFT: 64 | Serial.println("[left]"); 65 | break; 66 | case APPLE_REMOTE_UP: 67 | Serial.println("[up]"); 68 | break; 69 | case APPLE_REMOTE_DOWN: 70 | Serial.println("[down]"); 71 | break; 72 | case APPLE_REMOTE_PLAY: 73 | Serial.println("[play]"); 74 | break; 75 | case APPLE_REMOTE_CENTER: 76 | Serial.println("[center]"); 77 | break; 78 | case APPLE_REMOTE_REPEAT: 79 | Serial.println("[repeat]"); 80 | break; 81 | default: 82 | Serial.println("[?]"); 83 | } 84 | } 85 | } 86 | ``` 87 | 88 | If the above code does does not work or you see things like: 89 | 90 | ``` 91 | [?] 92 | [?] 93 | [?] 94 | [?] 95 | ``` 96 | 97 | instead of button reads, you should try changing the expected Apple Remote ID: 98 | 99 | ## Changing the Apple Remote's model 100 | 101 | This library covers two Apple Remote models, these two models have been tested 102 | with the aluminium controller only. 103 | 104 | If you need to switch between controller models a small hack is required. Open 105 | `lib/apple-remote/apple-remote.h` with your favorite text editor and locate the 106 | `APPLE_REMOTE_MODEL` constant, the line should look like this: 107 | 108 | ``` 109 | #define APPLE_REMOTE_MODEL 0xc7 110 | ``` 111 | 112 | change the `0xc7` number for `0xcf`. Clean the project, recompile and try 113 | again. 114 | 115 | ## How to install 116 | 117 | 1. Install the [irdebug.h][2] library. 118 | 2. Copy the `lib/apple-remote/` directory to your Arduino's library path, for 119 | example: `sudo cp -r lib/apple-remote /usr/share/arduino/libraries/`. 120 | 3. Include the `apple-remote.h` file into your main Arduino code, for example 121 | `#include `. 122 | 123 | ## License 124 | 125 | > Copyright (c) 2014 José Carlos Nieto, https://menteslibres.net/xiam 126 | > 127 | > Permission is hereby granted, free of charge, to any person obtaining 128 | > a copy of this software and associated documentation files (the 129 | > "Software"), to deal in the Software without restriction, including 130 | > without limitation the rights to use, copy, modify, merge, publish, 131 | > distribute, sublicense, and/or sell copies of the Software, and to 132 | > permit persons to whom the Software is furnished to do so, subject to 133 | > the following conditions: 134 | > 135 | > The above copyright notice and this permission notice shall be 136 | > included in all copies or substantial portions of the Software. 137 | > 138 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 139 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 140 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 141 | > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 142 | > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 143 | > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 144 | > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 145 | 146 | [1]: http://en.wikipedia.org/wiki/Apple_Remote 147 | [2]: https://github.com/xiam/arduino-irdebug 148 | -------------------------------------------------------------------------------- /src/sketch.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 José Carlos Nieto, https://menteslibres.net/xiam 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | // Depends on https://github.com/xiam/arduino-irdebug 25 | #include 26 | 27 | #define SIGNAL_MAX_LENGTH 70 28 | 29 | void setup() { 30 | Serial.begin(9600); 31 | Serial.println("Apple Remote for Arduino."); 32 | } 33 | 34 | void example_receive_signals() { 35 | unsigned int signal[SIGNAL_MAX_LENGTH]; 36 | bool captured; 37 | int code; 38 | 39 | captured = irdebug_capture_signal(signal, SIGNAL_MAX_LENGTH); 40 | 41 | if (captured) { 42 | irdebug_print_signal(signal); 43 | code = apple_remote_match(signal); 44 | 45 | switch (code) { 46 | case APPLE_REMOTE_MENU: 47 | Serial.println("[menu]"); 48 | break; 49 | case APPLE_REMOTE_RIGHT: 50 | Serial.println("[right]"); 51 | break; 52 | case APPLE_REMOTE_LEFT: 53 | Serial.println("[left]"); 54 | break; 55 | case APPLE_REMOTE_UP: 56 | Serial.println("[up]"); 57 | break; 58 | case APPLE_REMOTE_DOWN: 59 | Serial.println("[down]"); 60 | break; 61 | case APPLE_REMOTE_PLAY: 62 | Serial.println("[play]"); 63 | break; 64 | case APPLE_REMOTE_CENTER: 65 | Serial.println("[center]"); 66 | break; 67 | case APPLE_REMOTE_REPEAT: 68 | Serial.println("[repeat]"); 69 | break; 70 | default: 71 | Serial.println("[?]"); 72 | } 73 | } 74 | } 75 | 76 | void example_emit_signals() { 77 | 78 | // Getting to the main menu. 79 | Serial.println("Sending signal: menu."); 80 | apple_remote_menu(); 81 | delay(100); 82 | 83 | // Sending repeat code to scalate to the main menu. 84 | Serial.println("Sending signal: repeat."); 85 | apple_remote_repeat(); 86 | delay(100); 87 | apple_remote_repeat(); 88 | delay(100); 89 | apple_remote_repeat(); 90 | 91 | delay(2000); 92 | 93 | // Entering "movies" 94 | 95 | Serial.println("Sending signal: center."); 96 | apple_remote_center(); 97 | delay(2000); 98 | 99 | // Top-paid first movie. 100 | Serial.println("Sending signal: down."); 101 | apple_remote_down(); 102 | delay(2000); 103 | 104 | // Selecting movie. 105 | Serial.println("Sending signal: center."); 106 | apple_remote_center(); 107 | delay(2000); 108 | 109 | // Lanching preview. 110 | Serial.println("Sending signal: play."); 111 | apple_remote_play(); 112 | delay(10000); 113 | 114 | // Pausing preview. 115 | Serial.println("Sending signal: play."); 116 | apple_remote_play(); 117 | delay(2000); 118 | 119 | // Resuming preview. 120 | Serial.println("Sending signal: play."); 121 | apple_remote_play(); 122 | delay(5000); 123 | 124 | // Ok, going up again. 125 | Serial.println("Sending signal: menu."); 126 | apple_remote_menu(); 127 | delay(2000); 128 | 129 | // Moving right, rent ot buy it? 130 | Serial.println("Sending signal: right."); 131 | apple_remote_right(); 132 | delay(2000); 133 | 134 | // Nope, just playing. 135 | Serial.println("Sending signal: left."); 136 | apple_remote_left(); 137 | delay(2000); 138 | 139 | Serial.println("Sending signal: down."); 140 | apple_remote_down(); 141 | delay(2000); 142 | 143 | Serial.println("Sending signal: up."); 144 | apple_remote_up(); 145 | delay(2000); 146 | 147 | Serial.println("Sending signal: play."); 148 | apple_remote_play(); 149 | delay(10000); 150 | 151 | Serial.println("Waiting a minute."); 152 | 153 | delay(10000); 154 | } 155 | 156 | void loop() { 157 | // This example receives and decodes Apple Remote signals. 158 | example_receive_signals(); 159 | 160 | // This example emits Apple Remote codes to an AppleTV receiver. 161 | //example_emit_signals(); 162 | } 163 | -------------------------------------------------------------------------------- /lib/apple-remote/apple-remote.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 José Carlos Nieto, https://menteslibres.net/xiam 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | /* 25 | * See: 26 | * https://github.com/xiam/arduino-irdebug 27 | * http://techdocs.altium.com/display/ADRR/NEC+Infrared+Transmission+Protocol 28 | * http://en.wikipedia.org/wiki/Apple_Remote 29 | * */ 30 | 31 | #include 32 | 33 | #define APPLE_REMOTE_LEADER 9000, 4500 // 9ms mark + 4.5ms space 34 | #define APPLE_REMOTE_B0 560, 560 // 560us mark + 560us space 35 | #define APPLE_REMOTE_B1 560, 1690 // 560us mark + 1.69ms space 36 | #define APPLE_REMOTE_STOP 560, 0 // 560us mark + stop 37 | #define APPLE_REMOTE_RELEADER 9000, 2250 // 9ms mark + 2.25ms space 38 | 39 | #define APPLE_REMOTE_H0 APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B0 // 0x00 40 | #define APPLE_REMOTE_H1 APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B0 // 0x01 41 | #define APPLE_REMOTE_H2 APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B0 // 0x02 42 | #define APPLE_REMOTE_H3 APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B0 // 0x03 43 | #define APPLE_REMOTE_H4 APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B0 // 0x04 44 | #define APPLE_REMOTE_H5 APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B0 // 0x05 45 | #define APPLE_REMOTE_H6 APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B0 // 0x06 46 | #define APPLE_REMOTE_H7 APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B0 // 0x07 47 | #define APPLE_REMOTE_H8 APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B1 // 0x08 48 | #define APPLE_REMOTE_H9 APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B1 // 0x09 49 | #define APPLE_REMOTE_HA APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B1 // 0x0A 50 | #define APPLE_REMOTE_HB APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B1 // 0x0B 51 | #define APPLE_REMOTE_HC APPLE_REMOTE_B0, APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B1 // 0x0C 52 | #define APPLE_REMOTE_HD APPLE_REMOTE_B1, APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B1 // 0x0D 53 | #define APPLE_REMOTE_HE APPLE_REMOTE_B0, APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B1 // 0x0E 54 | #define APPLE_REMOTE_HF APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B1, APPLE_REMOTE_B1 // 0x0F 55 | 56 | #define APPLE_CUSTOM_CODE APPLE_REMOTE_HE, APPLE_REMOTE_HE, APPLE_REMOTE_H7, APPLE_REMOTE_H8 // 0xEE, 0X87 57 | 58 | // You can use 0xc7 or 0xcf as APPLE_REMOTE_MODEL values to switch between 59 | // control models. 60 | #define APPLE_REMOTE_MODEL 0xc7 61 | 62 | #if APPLE_REMOTE_MODEL == 0xcf 63 | #define APPLE_REMOTE_ID APPLE_REMOTE_HF, APPLE_REMOTE_HC // 0xCF 64 | #define APPLE_REMOTE_BUTTON_MENU APPLE_REMOTE_H2, APPLE_REMOTE_H0 // 0x02 65 | #define APPLE_REMOTE_BUTTON_RIGHT APPLE_REMOTE_H7, APPLE_REMOTE_H0 // 0x07 66 | #define APPLE_REMOTE_BUTTON_LEFT APPLE_REMOTE_H8, APPLE_REMOTE_H0 // 0x08 67 | #define APPLE_REMOTE_BUTTON_UP APPLE_REMOTE_HB, APPLE_REMOTE_H0 // 0x0B 68 | #define APPLE_REMOTE_BUTTON_DOWN APPLE_REMOTE_HD, APPLE_REMOTE_H0 // 0x0D 69 | #define APPLE_REMOTE_BUTTON_PLAY APPLE_REMOTE_HE, APPLE_REMOTE_H5 // 0x5E 70 | #define APPLE_REMOTE_BUTTON_CENTER APPLE_REMOTE_HD, APPLE_REMOTE_H5 // 0x5D 71 | #elif APPLE_REMOTE_MODEL == 0xc7 72 | #define APPLE_REMOTE_ID APPLE_REMOTE_H7, APPLE_REMOTE_HC // 0xC7 73 | #define APPLE_REMOTE_BUTTON_MENU APPLE_REMOTE_H3, APPLE_REMOTE_H0 // 0x03 74 | #define APPLE_REMOTE_BUTTON_RIGHT APPLE_REMOTE_H6, APPLE_REMOTE_H0 // 0x06 75 | #define APPLE_REMOTE_BUTTON_LEFT APPLE_REMOTE_H9, APPLE_REMOTE_H0 // 0x09 76 | #define APPLE_REMOTE_BUTTON_UP APPLE_REMOTE_HA, APPLE_REMOTE_H0 // 0x0A 77 | #define APPLE_REMOTE_BUTTON_DOWN APPLE_REMOTE_HC, APPLE_REMOTE_H0 // 0x0C 78 | #define APPLE_REMOTE_BUTTON_PLAY APPLE_REMOTE_HF, APPLE_REMOTE_H5 // 0x5F 79 | #define APPLE_REMOTE_BUTTON_CENTER APPLE_REMOTE_HC, APPLE_REMOTE_H5 // 0x5C 80 | #elif APPLE_REMOTE_MODEL == 0xd7 81 | #define APPLE_REMOTE_ID APPLE_REMOTE_H7, APPLE_REMOTE_HD // 0xD7 82 | #define APPLE_REMOTE_BUTTON_MENU APPLE_REMOTE_H2, APPLE_REMOTE_H0 // 0x02 83 | #define APPLE_REMOTE_BUTTON_RIGHT APPLE_REMOTE_H7, APPLE_REMOTE_H0 // 0x07 84 | #define APPLE_REMOTE_BUTTON_LEFT APPLE_REMOTE_H8, APPLE_REMOTE_H0 // 0x08 85 | #define APPLE_REMOTE_BUTTON_UP APPLE_REMOTE_HB, APPLE_REMOTE_H0 // 0x0B 86 | #define APPLE_REMOTE_BUTTON_DOWN APPLE_REMOTE_HD, APPLE_REMOTE_H0 // 0x0D 87 | #define APPLE_REMOTE_BUTTON_PLAY APPLE_REMOTE_H4, APPLE_REMOTE_H0 // 0x04 88 | #define APPLE_REMOTE_BUTTON_CENTER APPLE_REMOTE_HC, APPLE_REMOTE_H5 // Not used 89 | #endif 90 | 91 | #define APPLE_REMOTE_SIGNAL(code) {APPLE_REMOTE_LEADER, APPLE_CUSTOM_CODE, code, APPLE_REMOTE_ID, APPLE_REMOTE_STOP } 92 | 93 | #define APPLE_REMOTE_MENU 0 94 | #define APPLE_REMOTE_RIGHT 1 95 | #define APPLE_REMOTE_LEFT 2 96 | #define APPLE_REMOTE_UP 3 97 | #define APPLE_REMOTE_DOWN 4 98 | #define APPLE_REMOTE_PLAY 5 99 | #define APPLE_REMOTE_CENTER 6 100 | #define APPLE_REMOTE_REPEAT 7 101 | 102 | #define APPLE_REMOTE_SIGNALS (APPLE_REMOTE_REPEAT + 1) 103 | 104 | #define APPLE_REMOTE_KHZ 38 105 | 106 | static unsigned int apple_remote_signal[APPLE_REMOTE_SIGNALS][68] = { 107 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_MENU), 108 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_RIGHT), 109 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_LEFT), 110 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_UP), 111 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_DOWN), 112 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_PLAY), 113 | APPLE_REMOTE_SIGNAL(APPLE_REMOTE_BUTTON_CENTER), 114 | {APPLE_REMOTE_RELEADER, APPLE_REMOTE_STOP}, 115 | }; 116 | 117 | void apple_remote_send(int code) { 118 | irdebug_send(apple_remote_signal[code], APPLE_REMOTE_KHZ); 119 | } 120 | 121 | void apple_remote_menu() { 122 | apple_remote_send(APPLE_REMOTE_MENU); 123 | } 124 | 125 | void apple_remote_right() { 126 | apple_remote_send(APPLE_REMOTE_RIGHT); 127 | } 128 | 129 | void apple_remote_left() { 130 | apple_remote_send(APPLE_REMOTE_LEFT); 131 | } 132 | 133 | void apple_remote_up() { 134 | apple_remote_send(APPLE_REMOTE_UP); 135 | } 136 | 137 | void apple_remote_down() { 138 | apple_remote_send(APPLE_REMOTE_DOWN); 139 | } 140 | 141 | void apple_remote_play() { 142 | apple_remote_send(APPLE_REMOTE_PLAY); 143 | } 144 | 145 | void apple_remote_center() { 146 | apple_remote_send(APPLE_REMOTE_CENTER); 147 | } 148 | 149 | void apple_remote_repeat() { 150 | apple_remote_send(APPLE_REMOTE_REPEAT); 151 | } 152 | 153 | int apple_remote_match(unsigned int *signal) { 154 | int i; 155 | for (i = 0; i < APPLE_REMOTE_SIGNALS; i++) { 156 | if (irdebug_match_signal(apple_remote_signal[i], signal, 280) == true) { 157 | return i; 158 | } 159 | }; 160 | return -1; 161 | } 162 | --------------------------------------------------------------------------------