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.
This commit is contained in:
parent
8f5ac39fb9
commit
a91f439aec
|
@ -71,8 +71,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////// for backward compatibility ////////////////////////////////
|
//////////////// for backward compatibility ////////////////////////////////
|
||||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
#if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION)
|
||||||
/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
|
/* --- USE OLD API (compatible with let's split serial.c) */
|
||||||
#if SERIAL_SLAVE_BUFFER_LENGTH > 0
|
#if SERIAL_SLAVE_BUFFER_LENGTH > 0
|
||||||
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,7 +112,7 @@ int serial_update_buffers()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // end of Simple API (OLD API, compatible with let's split serial.c)
|
#endif // end of OLD API (compatible with let's split serial.c)
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define ALWAYS_INLINE __attribute__((always_inline))
|
#define ALWAYS_INLINE __attribute__((always_inline))
|
||||||
|
|
|
@ -15,31 +15,36 @@
|
||||||
// // 4: about 26kbps
|
// // 4: about 26kbps
|
||||||
// // 5: about 20kbps
|
// // 5: about 20kbps
|
||||||
//
|
//
|
||||||
// //// USE Simple API (OLD API, compatible with let's split serial.c)
|
// //// USE OLD API (compatible with let's split serial.c)
|
||||||
// ex.
|
// ex.
|
||||||
// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||||
// #define SERIAL_MASTER_BUFFER_LENGTH 1
|
// #define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||||
//
|
//
|
||||||
// //// USE flexible API (using multi-type transaction function)
|
// //// USE NEW API
|
||||||
// #define SERIAL_USE_MULTI_TRANSACTION
|
// //// USE simple API (using signle-type transaction function)
|
||||||
|
// #define SERIAL_USE_SINGLE_TRANSACTION
|
||||||
|
// //// USE flexible API (using multi-type transaction function)
|
||||||
|
// #define SERIAL_USE_MULTI_TRANSACTION
|
||||||
//
|
//
|
||||||
// /////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
//////////////// for backward compatibility ////////////////////////////////
|
||||||
/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
|
#if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION)
|
||||||
#if SERIAL_SLAVE_BUFFER_LENGTH > 0
|
/* --- USE OLD API (compatible with let's split serial.c) */
|
||||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
#if SERIAL_SLAVE_BUFFER_LENGTH > 0
|
||||||
#endif
|
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||||
#if SERIAL_MASTER_BUFFER_LENGTH > 0
|
#endif
|
||||||
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
#if SERIAL_MASTER_BUFFER_LENGTH > 0
|
||||||
#endif
|
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||||
|
#endif
|
||||||
|
|
||||||
void serial_master_init(void);
|
void serial_master_init(void);
|
||||||
void serial_slave_init(void);
|
void serial_slave_init(void);
|
||||||
int serial_update_buffers(void);
|
int serial_update_buffers(void);
|
||||||
|
|
||||||
#endif // USE Simple API
|
#endif // end of USE OLD API
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Soft Serial Transaction Descriptor
|
// Soft Serial Transaction Descriptor
|
||||||
typedef struct _SSTD_t {
|
typedef struct _SSTD_t {
|
||||||
|
|
Loading…
Reference in New Issue