summaryrefslogtreecommitdiffstats
path: root/keyboards/helix
diff options
context:
space:
mode:
authorTakeshi ISHII <2170248+mtei@users.noreply.github.com>2018-10-28 18:12:44 +0100
committerDrashna Jaelre <drashna@live.com>2018-10-28 18:12:44 +0100
commit8517f8a6606d092014edf23ac9874d6a47fe1178 (patch)
tree39fef3e091006b26b7344663b34cad899ceee844 /keyboards/helix
parentc60a312ba99f4ece511f36bc25c5f63410313b5b (diff)
downloadqmk_firmware-8517f8a6606d092014edf23ac9874d6a47fe1178.tar.gz
qmk_firmware-8517f8a6606d092014edf23ac9874d6a47fe1178.tar.xz
Helix serial.c re-adjust compiler depend value of delay (#4269)
* Helix serial.c add debug code * re-adjust READ_WRITE_WIDTH_ADJUST values * re-adjust READ_WRITE_START_ADJUST values * re-adjust TID_SEND_ADJUST value * Helix serial.c: remove debug code
Diffstat (limited to 'keyboards/helix')
-rw-r--r--keyboards/helix/rev2/split_scomm.c3
-rw-r--r--keyboards/helix/serial.c54
2 files changed, 44 insertions, 13 deletions
diff --git a/keyboards/helix/rev2/split_scomm.c b/keyboards/helix/rev2/split_scomm.c
index 50d233ce9..ada786796 100644
--- a/keyboards/helix/rev2/split_scomm.c
+++ b/keyboards/helix/rev2/split_scomm.c
@@ -7,9 +7,6 @@
#include <stddef.h>
#include <split_scomm.h>
#include "serial.h"
-#ifdef SERIAL_DEBUG_MODE
-#include <avr/io.h>
-#endif
#ifdef CONSOLE_ENABLE
#include <print.h>
#endif
diff --git a/keyboards/helix/serial.c b/keyboards/helix/serial.c
index 830f86b55..c813b6b9a 100644
--- a/keyboards/helix/serial.c
+++ b/keyboards/helix/serial.c
@@ -136,38 +136,68 @@ int serial_update_buffers()
// 5: about 20kbps
#endif
-#define TID_SEND_ADJUST 2
+#if __GNUC__ < 6
+ #define TID_SEND_ADJUST 14
+#else
+ #define TID_SEND_ADJUST 2
+#endif
#if SELECT_SOFT_SERIAL_SPEED == 0
// Very High speed
#define SERIAL_DELAY 4 // micro sec
- #define READ_WRITE_START_ADJUST 33 // cycles
- #define READ_WRITE_WIDTH_ADJUST 6 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_START_ADJUST 33 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_START_ADJUST 34 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#elif SELECT_SOFT_SERIAL_SPEED == 1
// High speed
#define SERIAL_DELAY 6 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_START_ADJUST 33 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#elif SELECT_SOFT_SERIAL_SPEED == 2
// Middle speed
#define SERIAL_DELAY 12 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#elif SELECT_SOFT_SERIAL_SPEED == 3
// Low speed
#define SERIAL_DELAY 24 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#elif SELECT_SOFT_SERIAL_SPEED == 4
// Very Low speed
#define SERIAL_DELAY 36 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#elif SELECT_SOFT_SERIAL_SPEED == 5
// Ultra Low speed
#define SERIAL_DELAY 48 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#else
#error invalid SELECT_SOFT_SERIAL_SPEED value
#endif /* SELECT_SOFT_SERIAL_SPEED */
@@ -187,16 +217,19 @@ int serial_update_buffers()
static SSTD_t *Transaction_table = NULL;
static uint8_t Transaction_table_size = 0;
+inline static void serial_delay(void) ALWAYS_INLINE;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
+inline static void serial_delay_half1(void) ALWAYS_INLINE;
inline static
void serial_delay_half1(void) {
_delay_us(SERIAL_DELAY_HALF1);
}
+inline static void serial_delay_half2(void) ALWAYS_INLINE;
inline static
void serial_delay_half2(void) {
_delay_us(SERIAL_DELAY_HALF2);
@@ -216,6 +249,7 @@ void serial_input_with_pullup(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
+inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
inline static
uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
@@ -270,7 +304,7 @@ void sync_recv(void) {
}
// Used by the reciver to send a synchronization signal to the sender.
-static void sync_send(void)NO_INLINE;
+static void sync_send(void) NO_INLINE;
static
void sync_send(void) {
serial_low();