diff options
Diffstat (limited to 'quantum/api.h')
| -rw-r--r-- | quantum/api.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/quantum/api.h b/quantum/api.h new file mode 100644 index 000000000..efc0ddca1 --- /dev/null +++ b/quantum/api.h | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /* Copyright 2016 Jack Humbert | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef _API_H_ | ||
| 18 | #define _API_H_ | ||
| 19 | |||
| 20 | #include "lufa.h" | ||
| 21 | |||
| 22 | enum MESSAGE_TYPE { | ||
| 23 | MT_GET_DATA = 0x10, // Get data from keyboard | ||
| 24 | MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) | ||
| 25 | MT_SET_DATA = 0x20, // Set data on keyboard | ||
| 26 | MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) | ||
| 27 | MT_SEND_DATA = 0x30, // Sending data/action from keyboard | ||
| 28 | MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) | ||
| 29 | MT_EXE_ACTION = 0x40, // executing actions on keyboard | ||
| 30 | MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK) | ||
| 31 | MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK) | ||
| 32 | }; | ||
| 33 | |||
| 34 | enum DATA_TYPE { | ||
| 35 | DT_NONE = 0x00, | ||
| 36 | DT_HANDSHAKE, | ||
| 37 | DT_DEFAULT_LAYER, | ||
| 38 | DT_CURRENT_LAYER, | ||
| 39 | DT_KEYMAP_OPTIONS, | ||
| 40 | DT_BACKLIGHT, | ||
| 41 | DT_RGBLIGHT, | ||
| 42 | DT_UNICODE, | ||
| 43 | DT_DEBUG, | ||
| 44 | DT_AUDIO, | ||
| 45 | DT_QUANTUM_ACTION, | ||
| 46 | DT_KEYBOARD_ACTION, | ||
| 47 | DT_USER_ACTION, | ||
| 48 | DT_KEYMAP_SIZE, | ||
| 49 | DT_KEYMAP | ||
| 50 | }; | ||
| 51 | |||
| 52 | void dword_to_bytes(uint32_t dword, uint8_t * bytes); | ||
| 53 | uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index); | ||
| 54 | |||
| 55 | #define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length) | ||
| 56 | #define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length) | ||
| 57 | #define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length) | ||
| 58 | #define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length) | ||
| 59 | #define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length) | ||
| 60 | #define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length) | ||
| 61 | #define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length) | ||
| 62 | #define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length) | ||
| 63 | |||
| 64 | void process_api(uint16_t length, uint8_t * data); | ||
| 65 | |||
| 66 | __attribute__ ((weak)) | ||
| 67 | bool process_api_quantum(uint8_t length, uint8_t * data); | ||
| 68 | |||
| 69 | __attribute__ ((weak)) | ||
| 70 | bool process_api_keyboard(uint8_t length, uint8_t * data); | ||
| 71 | |||
| 72 | __attribute__ ((weak)) | ||
| 73 | bool process_api_user(uint8_t length, uint8_t * data); | ||
| 74 | |||
| 75 | #endif | ||
