#include "config_common.h"
-#ifdef SUBPROJECT_rev1
- #include "rev1/config.h"
-#endif
+// GCC include 'config.h" sequence in qmk_firmware/keyboards/helix/
+// -include keyboards/helix/config.h
+// -include keyboards/helix/rev?/config.h
+// -include keyboards/helix/rev?/keymaps/MAPNAME/config.h
+// XXXX.c
-#endif
+#include <serial_config.h>
+
+// GCC include search path in qmk_firmare/keyboards/helix/
+// #include "..." search starts here:
+// #include <...> search starts here:
+// keyboards/helix/rev?/keymaps/MAPNAME
+// keyboards/helix
+// keyboards/helix/rev?
+// .
+// ./tmk_core
+// ......
+
+#endif /* CONFIG_H */
#ifndef REV1_CONFIG_H
#define REV1_CONFIG_H
-#include "../config.h"
-
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x3060
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
/* Use I2C or Serial */
#define USE_I2C
#define SSD1306OLED
-#define USE_SERIAL_PD2
-
#define PREVENT_STUCK_MODIFIERS
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100
--- /dev/null
+#ifndef SOFT_SERIAL_CONFIG_H
+#define SOFT_SERIAL_CONFIG_H
+
+/* Soft Serial defines */
+#define SERIAL_PIN_DDR DDRD
+#define SERIAL_PIN_PORT PORTD
+#define SERIAL_PIN_INPUT PIND
+#define SERIAL_PIN_MASK _BV(PD2)
+#define SERIAL_PIN_INTERRUPT INT2_vect
+
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH 1
+
+//// #error rev1/keymaps/OLED_sample serial config
+
+#endif /* SOFT_SERIAL_CONFIG_H */
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
/* Use I2C or Serial, not both */
#define USE_SERIAL
// #define _MASTER_RIGHT
// #define EE_HANDS
-#endif
\ No newline at end of file
+#endif
--- /dev/null
+#ifndef SOFT_SERIAL_CONFIG_H
+#define SOFT_SERIAL_CONFIG_H
+
+/* Soft Serial defines */
+#define SERIAL_PIN_DDR DDRD
+#define SERIAL_PIN_PORT PORTD
+#define SERIAL_PIN_INPUT PIND
+#define SERIAL_PIN_MASK _BV(PD0)
+#define SERIAL_PIN_INTERRUPT INT0_vect
+
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH 1
+
+/// #error rev1 serial config
+
+#endif /* SOFT_SERIAL_CONFIG_H */
#ifndef REV2_CONFIG_H
#define REV2_CONFIG_H
-#include "../config.h"
-
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x3060
/* Use I2C or Serial */
#define USE_I2C
#define USE_SERIAL
-#define USE_SERIAL_PD2
//#define USE_MATRIX_I2C
/* Select hand configuration */
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
// place overrides here
#endif /* CONFIG_USER_H */
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
#undef TAPPING_FORCE_HOLD
#undef TAPPING_TERM
#define TAPPING_TERM 120
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
// place overrides here
#endif /* CONFIG_USER_H */
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
/* Use I2C or Serial */
#define USE_I2C
#error "expected HELIX_ROWS 4 or 5"
#endif
-#define USE_SERIAL_PD2
-
#define PREVENT_STUCK_MODIFIERS
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
#undef TAPPING_TERM
#define TAPPING_TERM 200
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-#include "../../config.h"
-
// place overrides here
#endif /* CONFIG_USER_H */
#include "matrix.h"
#include "split_util.h"
#include "pro_micro.h"
-#include "config.h"
#ifdef USE_MATRIX_I2C
# include "i2c.h"
--- /dev/null
+#ifndef SOFT_SERIAL_CONFIG_H
+#define SOFT_SERIAL_CONFIG_H
+
+/* Soft Serial defines */
+#define SERIAL_PIN_DDR DDRD
+#define SERIAL_PIN_PORT PORTD
+#define SERIAL_PIN_INPUT PIND
+#define SERIAL_PIN_MASK _BV(PD2)
+#define SERIAL_PIN_INTERRUPT INT2_vect
+
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
+
+//// #error rev2 serial config
+
+#endif /* SOFT_SERIAL_CONFIG_H */
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
-#include "config.h"
#ifdef USE_MATRIX_I2C
# include "i2c.h"
void serial_slave_init(void) {
serial_input_with_pullup();
-#ifndef USE_SERIAL_PD2
+#if SERIAL_PIN_MASK == _BV(PD0)
// Enable INT0
EIMSK |= _BV(INT0);
// Trigger on falling edge of INT0
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
-#else
+#elif SERIAL_PIN_MASK == _BV(PD2)
// Enable INT2
EIMSK |= _BV(INT2);
// Trigger on falling edge of INT2
EICRA &= ~(_BV(ISC20) | _BV(ISC21));
+#else
+ #error unknown SERIAL_PIN_MASK value
#endif
}
-#ifndef MY_SERIAL_H
-#define MY_SERIAL_H
+#ifndef SOFT_SERIAL_H
+#define SOFT_SERIAL_H
-#include "config.h"
#include <stdbool.h>
-/* TODO: some defines for interrupt setup */
-#define SERIAL_PIN_DDR DDRD
-#define SERIAL_PIN_PORT PORTD
-#define SERIAL_PIN_INPUT PIND
-
-#ifndef USE_SERIAL_PD2
-#define SERIAL_PIN_MASK _BV(PD0)
-#define SERIAL_PIN_INTERRUPT INT0_vect
-#else
-#define SERIAL_PIN_MASK _BV(PD2)
-#define SERIAL_PIN_INTERRUPT INT2_vect
-#endif
-
-#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-#ifdef KEYBOARD_helix_rev1
-#define SERIAL_MASTER_BUFFER_LENGTH 1
-#else
-#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
-#endif
+// ////////////////////////////////////////////
+// Need Soft Serial defines in serial_config.h
+// ////////////////////////////////////////////
+// ex.
+// #define SERIAL_PIN_DDR DDRD
+// #define SERIAL_PIN_PORT PORTD
+// #define SERIAL_PIN_INPUT PIND
+// #define SERIAL_PIN_MASK _BV(PD?) ?=0,2
+// #define SERIAL_PIN_INTERRUPT INT?_vect ?=0,2
+// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+// #define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
// Buffers for master - slave communication
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
int serial_update_buffers(void);
bool serial_slave_data_corrupt(void);
-#endif
+#endif /* SOFT_SERIAL_H */
#include <stdbool.h>
#include <stdio.h>
#include "pincontrol.h"
-#include "config.h"
enum ssd1306_cmds {
DisplayOff = 0xAE,