diff options
Diffstat (limited to 'keyboards/lily58/serial.h')
| -rwxr-xr-x[-rw-r--r--] | keyboards/lily58/serial.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/keyboards/lily58/serial.h b/keyboards/lily58/serial.h index d2b7fd8e6..7e0c0847a 100644..100755 --- a/keyboards/lily58/serial.h +++ b/keyboards/lily58/serial.h | |||
| @@ -4,14 +4,16 @@ | |||
| 4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
| 5 | 5 | ||
| 6 | // ///////////////////////////////////////////////////////////////// | 6 | // ///////////////////////////////////////////////////////////////// |
| 7 | // Need Soft Serial defines in serial_config.h | 7 | // Need Soft Serial defines in config.h |
| 8 | // ///////////////////////////////////////////////////////////////// | 8 | // ///////////////////////////////////////////////////////////////// |
| 9 | // ex. | 9 | // ex. |
| 10 | // #define SERIAL_PIN_DDR DDRD | 10 | // #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6 |
| 11 | // #define SERIAL_PIN_PORT PORTD | 11 | // OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 |
| 12 | // #define SERIAL_PIN_INPUT PIND | 12 | // // 1: about 137kbps (default) |
| 13 | // #define SERIAL_PIN_MASK _BV(PD?) ?=0,2 | 13 | // // 2: about 75kbps |
| 14 | // #define SERIAL_PIN_INTERRUPT INT?_vect ?=0,2 | 14 | // // 3: about 39kbps |
| 15 | // // 4: about 26kbps | ||
| 16 | // // 5: about 20kbps | ||
| 15 | // | 17 | // |
| 16 | // //// USE Simple API (OLD API, compatible with let's split serial.c) | 18 | // //// USE Simple API (OLD API, compatible with let's split serial.c) |
| 17 | // ex. | 19 | // ex. |
| @@ -47,16 +49,18 @@ typedef struct _SSTD_t { | |||
| 47 | uint8_t target2initiator_buffer_size; | 49 | uint8_t target2initiator_buffer_size; |
| 48 | uint8_t *target2initiator_buffer; | 50 | uint8_t *target2initiator_buffer; |
| 49 | } SSTD_t; | 51 | } SSTD_t; |
| 52 | #define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t)) | ||
| 50 | 53 | ||
| 51 | // initiator is transaction start side | 54 | // initiator is transaction start side |
| 52 | void soft_serial_initiator_init(SSTD_t *sstd_table); | 55 | void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size); |
| 53 | // target is interrupt accept side | 56 | // target is interrupt accept side |
| 54 | void soft_serial_target_init(SSTD_t *sstd_table); | 57 | void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size); |
| 55 | 58 | ||
| 56 | // initiator resullt | 59 | // initiator resullt |
| 57 | #define TRANSACTION_END 0 | 60 | #define TRANSACTION_END 0 |
| 58 | #define TRANSACTION_NO_RESPONSE 0x1 | 61 | #define TRANSACTION_NO_RESPONSE 0x1 |
| 59 | #define TRANSACTION_DATA_ERROR 0x2 | 62 | #define TRANSACTION_DATA_ERROR 0x2 |
| 63 | #define TRANSACTION_TYPE_ERROR 0x4 | ||
| 60 | #ifndef SERIAL_USE_MULTI_TRANSACTION | 64 | #ifndef SERIAL_USE_MULTI_TRANSACTION |
| 61 | int soft_serial_transaction(void); | 65 | int soft_serial_transaction(void); |
| 62 | #else | 66 | #else |
| @@ -72,7 +76,7 @@ int soft_serial_transaction(int sstd_index); | |||
| 72 | // target: | 76 | // target: |
| 73 | // TRANSACTION_DATA_ERROR | 77 | // TRANSACTION_DATA_ERROR |
| 74 | // or TRANSACTION_ACCEPTED | 78 | // or TRANSACTION_ACCEPTED |
| 75 | #define TRANSACTION_ACCEPTED 0x4 | 79 | #define TRANSACTION_ACCEPTED 0x8 |
| 76 | #ifdef SERIAL_USE_MULTI_TRANSACTION | 80 | #ifdef SERIAL_USE_MULTI_TRANSACTION |
| 77 | int soft_serial_get_and_clean_status(int sstd_index); | 81 | int soft_serial_get_and_clean_status(int sstd_index); |
| 78 | #endif | 82 | #endif |
