diff options
| author | Takeshi ISHII <2170248+mtei@users.noreply.github.com> | 2018-11-07 05:02:30 +0900 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-11-06 12:02:30 -0800 |
| commit | a91f439aec39ec8bbcbb2f579a9434c266f09f5c (patch) | |
| tree | a2cbe921ccd0db55678059fb993d83c1881e1fc5 | |
| parent | 8f5ac39fb90e9036a9df60f286888e02daf3fd1b (diff) | |
| download | qmk_firmware-a91f439aec39ec8bbcbb2f579a9434c266f09f5c.tar.gz qmk_firmware-a91f439aec39ec8bbcbb2f579a9434c266f09f5c.zip | |
Helix-serial.c configuration improvement (#4370)
The new simple API can be selected.
Previous version, can select two way.
* use old API (compatible with let's split serial.c)
* use new API (multi-type transaction)
This version, can select three way.
* use old API (compatible with let's split serial.c)
* use new API (single-type transaction)
* use new API (multi-type transaction)
There is no change in the code generated by this change.
| -rw-r--r-- | keyboards/helix/serial.c | 6 | ||||
| -rw-r--r-- | keyboards/helix/serial.h | 35 |
2 files changed, 23 insertions, 18 deletions
diff --git a/keyboards/helix/serial.c b/keyboards/helix/serial.c index 325c29a3f..6006ebf1b 100644 --- a/keyboards/helix/serial.c +++ b/keyboards/helix/serial.c | |||
| @@ -71,8 +71,8 @@ | |||
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | //////////////// for backward compatibility //////////////////////////////// | 73 | //////////////// for backward compatibility //////////////////////////////// |
| 74 | #ifndef SERIAL_USE_MULTI_TRANSACTION | 74 | #if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION) |
| 75 | /* --- USE Simple API (OLD API, compatible with let's split serial.c) */ | 75 | /* --- USE OLD API (compatible with let's split serial.c) */ |
| 76 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 | 76 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 |
| 77 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | 77 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; |
| 78 | #endif | 78 | #endif |
| @@ -112,7 +112,7 @@ int serial_update_buffers() | |||
| 112 | return result; | 112 | return result; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #endif // end of Simple API (OLD API, compatible with let's split serial.c) | 115 | #endif // end of OLD API (compatible with let's split serial.c) |
| 116 | //////////////////////////////////////////////////////////////////////////// | 116 | //////////////////////////////////////////////////////////////////////////// |
| 117 | 117 | ||
| 118 | #define ALWAYS_INLINE __attribute__((always_inline)) | 118 | #define ALWAYS_INLINE __attribute__((always_inline)) |
diff --git a/keyboards/helix/serial.h b/keyboards/helix/serial.h index 7e0c0847a..2e53928df 100644 --- a/keyboards/helix/serial.h +++ b/keyboards/helix/serial.h | |||
| @@ -15,31 +15,36 @@ | |||
| 15 | // // 4: about 26kbps | 15 | // // 4: about 26kbps |
| 16 | // // 5: about 20kbps | 16 | // // 5: about 20kbps |
| 17 | // | 17 | // |
| 18 | // //// USE Simple API (OLD API, compatible with let's split serial.c) | 18 | // //// USE OLD API (compatible with let's split serial.c) |
| 19 | // ex. | 19 | // ex. |
| 20 | // #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | 20 | // #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 |
| 21 | // #define SERIAL_MASTER_BUFFER_LENGTH 1 | 21 | // #define SERIAL_MASTER_BUFFER_LENGTH 1 |
| 22 | // | 22 | // |
| 23 | // //// USE flexible API (using multi-type transaction function) | 23 | // //// USE NEW API |
| 24 | // #define SERIAL_USE_MULTI_TRANSACTION | 24 | // //// USE simple API (using signle-type transaction function) |
| 25 | // #define SERIAL_USE_SINGLE_TRANSACTION | ||
| 26 | // //// USE flexible API (using multi-type transaction function) | ||
| 27 | // #define SERIAL_USE_MULTI_TRANSACTION | ||
| 25 | // | 28 | // |
| 26 | // ///////////////////////////////////////////////////////////////// | 29 | // ///////////////////////////////////////////////////////////////// |
| 27 | 30 | ||
| 28 | 31 | ||
| 29 | #ifndef SERIAL_USE_MULTI_TRANSACTION | 32 | //////////////// for backward compatibility //////////////////////////////// |
| 30 | /* --- USE Simple API (OLD API, compatible with let's split serial.c) */ | 33 | #if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION) |
| 31 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 | 34 | /* --- USE OLD API (compatible with let's split serial.c) */ |
| 32 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | 35 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 |
| 33 | #endif | 36 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; |
| 34 | #if SERIAL_MASTER_BUFFER_LENGTH > 0 | 37 | #endif |
| 35 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | 38 | #if SERIAL_MASTER_BUFFER_LENGTH > 0 |
| 36 | #endif | 39 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; |
| 40 | #endif | ||
| 37 | 41 | ||
| 38 | void serial_master_init(void); | 42 | void serial_master_init(void); |
| 39 | void serial_slave_init(void); | 43 | void serial_slave_init(void); |
| 40 | int serial_update_buffers(void); | 44 | int serial_update_buffers(void); |
| 41 | 45 | ||
| 42 | #endif // USE Simple API | 46 | #endif // end of USE OLD API |
| 47 | //////////////////////////////////////////////////////////////////////////// | ||
| 43 | 48 | ||
| 44 | // Soft Serial Transaction Descriptor | 49 | // Soft Serial Transaction Descriptor |
| 45 | typedef struct _SSTD_t { | 50 | typedef struct _SSTD_t { |
