summaryrefslogtreecommitdiff
path: root/keyboards/hadron/ver2
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/hadron/ver2')
-rw-r--r--keyboards/hadron/ver2/config.h6
-rw-r--r--keyboards/hadron/ver2/keymaps/default/keymap.c121
-rw-r--r--keyboards/hadron/ver2/keymaps/readme.md22
-rw-r--r--keyboards/hadron/ver2/keymaps/side_numpad/keymap.c162
-rw-r--r--keyboards/hadron/ver2/rules.mk32
-rw-r--r--keyboards/hadron/ver2/ver2.c64
-rw-r--r--keyboards/hadron/ver2/ver2.h7
7 files changed, 100 insertions, 314 deletions
diff --git a/keyboards/hadron/ver2/config.h b/keyboards/hadron/ver2/config.h
index e051db209c..c992f7fe33 100644
--- a/keyboards/hadron/ver2/config.h
+++ b/keyboards/hadron/ver2/config.h
@@ -28,10 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
#define UNUSED_PINS
-
-#define USE_I2C
-#define SSD1306OLED
-#define OLED_ROTATE180
+// configure oled driver for the 128x32 oled
+#define OLED_UPDATE_INTERVAL 33 // ~30fps
/* ws2812 RGB LED*/
#define RGB_DI_PIN D4
diff --git a/keyboards/hadron/ver2/keymaps/default/keymap.c b/keyboards/hadron/ver2/keymaps/default/keymap.c
index 8e3d50d3d7..f24239aa22 100644
--- a/keyboards/hadron/ver2/keymaps/default/keymap.c
+++ b/keyboards/hadron/ver2/keymaps/default/keymap.c
@@ -1,10 +1,4 @@
#include QMK_KEYBOARD_H
-#ifdef USE_I2C
-#include "i2c.h"
-#endif
-#ifdef SSD1306OLED
-#include "ssd1306.h"
-#endif
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
@@ -18,8 +12,8 @@ extern rgblight_config_t rgblight_config;
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
-#define _MOUSECURSOR 8
-#define _ADJUST 16
+#define _MOUSECURSOR 5
+#define _ADJUST 6
enum preonic_keycodes {
QWERTY = SAFE_RANGE,
@@ -307,115 +301,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
-//Functions for ver2
-#ifdef KEYBOARD_hadron_ver2
-#include <LUFA/Drivers/Peripheral/TWI.h>
void matrix_init_user(void) {
- #ifdef USE_I2C
- i2c_master_init();
- #ifdef SSD1306OLED
- // calls code for the SSD1306 OLED
- _delay_ms(400);
- TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
- iota_gfx_init(); // turns on the display
- #endif
- #endif
- #ifdef AUDIO_ENABLE
- startup_user();
- #endif
-}
-
-
-void matrix_scan_user(void) {
- #ifdef SSD1306OLED
- iota_gfx_task(); // this is what updates the display continuously
- #endif
-}
-
-void matrix_update(struct CharacterMatrix *dest,
- const struct CharacterMatrix *source) {
- if (memcmp(dest->display, source->display, sizeof(dest->display))) {
- memcpy(dest->display, source->display, sizeof(dest->display));
- dest->dirty = true;
- }
-}
-//assign the right code to your layers for OLED display
-#define L_BASE 0
-#define L_LOWER 8
-#define L_RAISE 16
-#define L_FNLAYER 64
-#define L_NUMLAY 128
-#define L_NLOWER 136
-#define L_NFNLAYER 192
-#define L_MOUSECURSOR 256
-#define L_ADJUST 65560
-
-void iota_gfx_task_user(void) {
-#if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-#endif
-
- struct CharacterMatrix matrix;
-
- matrix_clear(&matrix);
- matrix_write_P(&matrix, PSTR("USB: "));
-#ifdef PROTOCOL_LUFA
- switch (USB_DeviceState) {
- case DEVICE_STATE_Unattached:
- matrix_write_P(&matrix, PSTR("Unattached"));
- break;
- case DEVICE_STATE_Suspended:
- matrix_write_P(&matrix, PSTR("Suspended"));
- break;
- case DEVICE_STATE_Configured:
- matrix_write_P(&matrix, PSTR("Connected"));
- break;
- case DEVICE_STATE_Powered:
- matrix_write_P(&matrix, PSTR("Powered"));
- break;
- case DEVICE_STATE_Default:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case DEVICE_STATE_Addressed:
- matrix_write_P(&matrix, PSTR("Addressed"));
- break;
- default:
- matrix_write_P(&matrix, PSTR("Invalid"));
- }
+#ifdef AUDIO_ENABLE
+ startup_user();
#endif
-
-// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
-
- char buf[40];
- snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
- matrix_write_P(&matrix, PSTR("\n\nLayer: "));
- switch (layer_state) {
- case L_BASE:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case L_RAISE:
- matrix_write_P(&matrix, PSTR("Raise"));
- break;
- case L_LOWER:
- matrix_write_P(&matrix, PSTR("Lower"));
- break;
- case L_ADJUST:
- matrix_write_P(&matrix, PSTR("ADJUST"));
- break;
- default:
- matrix_write(&matrix, buf);
- }
-
- // Host Keyboard LED Status
- char led[40];
- snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
- matrix_write(&matrix, led);
- matrix_update(&display, &matrix);
}
-
-#endif
diff --git a/keyboards/hadron/ver2/keymaps/readme.md b/keyboards/hadron/ver2/keymaps/readme.md
deleted file mode 100644
index 2f7641d185..0000000000
--- a/keyboards/hadron/ver2/keymaps/readme.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# How to add your own keymap
-
-Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
-
- _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
-
-\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
-
-and contain the following files:
-
-* `keymap.c`
-* `readme.md` *recommended*
-* `config.h` *optional*, found automatically when compiling
-* `Makefile` *optional*, found automatically when compling
-
-When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
-
- * **folder_name** description
-
-# List of Planck keymaps
-
-* **default** default Planck layout
diff --git a/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c
index c63ae93855..74f95b4b75 100644
--- a/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c
+++ b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c
@@ -1,15 +1,4 @@
#include QMK_KEYBOARD_H
-#include <LUFA/Drivers/Peripheral/TWI.h>
-#ifdef AUDIO_ENABLE
- #include "audio.h"
-#endif
-#ifdef USE_I2C
-#include "i2c.h"
-#endif
-#ifdef SSD1306OLED
-#include "ssd1306.h"
-#endif
-extern keymap_config_t keymap_config;
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
@@ -19,12 +8,12 @@ extern rgblight_config_t rgblight_config;
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 0
-#define _LOWER 3
-#define _RAISE 4
-#define _FNLAYER 6
-#define _NUMLAY 7
-#define _MOUSECURSOR 8
-#define _ADJUST 16
+#define _LOWER 1
+#define _RAISE 2
+#define _FNLAYER 3
+#define _NUMLAY 4
+#define _MOUSECURSOR 5
+#define _ADJUST 6
enum preonic_keycodes {
QWERTY = SAFE_RANGE,
@@ -41,10 +30,7 @@ enum preonic_keycodes {
RGBLED_DECREASE_SAT,
RGBLED_INCREASE_VAL,
RGBLED_DECREASE_VAL,
-};
-
-enum macro_keycodes {
- KC_DEMOMACRO,
+ DEMOMACRO,
};
// Custom macros
@@ -57,7 +43,6 @@ enum macro_keycodes {
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY
-#define DEMOMACRO M(KC_DEMOMACRO) // My login macros
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -322,29 +307,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+ case DEMOMACRO:
+ if (record->event.pressed) {
+ SEND_STRING("hello world");
+ }
+ return false;
+ break;
}
return true;
}
void matrix_init_user(void) {
- #ifdef USE_I2C
- i2c_master_init();
- #ifdef SSD1306OLED
- // calls code for the SSD1306 OLED
- _delay_ms(400);
- TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
- iota_gfx_init(); // turns on the display
- #endif
- #endif
- #ifdef AUDIO_ENABLE
- startup_user();
- #endif
-}
-
-void matrix_scan_user(void) {
- #ifdef SSD1306OLED
- iota_gfx_task(); // this is what updates the display continuously
- #endif
+#ifdef AUDIO_ENABLE
+ startup_user();
+#endif
}
#ifdef AUDIO_ENABLE
@@ -373,109 +349,3 @@ void music_scale_user(void)
}
#endif
-
-/*
- * Macro definition
- */
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- if (!eeconfig_is_enabled()) {
- eeconfig_init();
- }
-
- switch (id) {
- case KC_DEMOMACRO:
- if (record->event.pressed){
- return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END);
- }
- }
-
- return MACRO_NONE;
-}
-
-void matrix_update(struct CharacterMatrix *dest,
- const struct CharacterMatrix *source) {
- if (memcmp(dest->display, source->display, sizeof(dest->display))) {
- memcpy(dest->display, source->display, sizeof(dest->display));
- dest->dirty = true;
- }
-}
-
-//assign the right code to your layers for OLED display
-#define L_BASE 0
-#define L_LOWER 8
-#define L_RAISE 16
-#define L_FNLAYER 64
-#define L_NUMLAY 128
-#define L_NLOWER 136
-#define L_NFNLAYER 192
-#define L_MOUSECURSOR 256
-#define L_ADJUST 65560
-
-void iota_gfx_task_user(void) {
-#if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-#endif
-
- struct CharacterMatrix matrix;
-
- matrix_clear(&matrix);
- matrix_write_P(&matrix, PSTR("USB: "));
-#ifdef PROTOCOL_LUFA
- switch (USB_DeviceState) {
- case DEVICE_STATE_Unattached:
- matrix_write_P(&matrix, PSTR("Unattached"));
- break;
- case DEVICE_STATE_Suspended:
- matrix_write_P(&matrix, PSTR("Suspended"));
- break;
- case DEVICE_STATE_Configured:
- matrix_write_P(&matrix, PSTR("Connected"));
- break;
- case DEVICE_STATE_Powered:
- matrix_write_P(&matrix, PSTR("Powered"));
- break;
- case DEVICE_STATE_Default:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case DEVICE_STATE_Addressed:
- matrix_write_P(&matrix, PSTR("Addressed"));
- break;
- default:
- matrix_write_P(&matrix, PSTR("Invalid"));
- }
-#endif
-
-// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
-
- char buf[40];
- snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
- matrix_write_P(&matrix, PSTR("\n\nLayer: "));
- switch (layer_state) {
- case L_BASE:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case L_RAISE:
- matrix_write_P(&matrix, PSTR("Raise"));
- break;
- case L_LOWER:
- matrix_write_P(&matrix, PSTR("Lower"));
- break;
- case L_ADJUST:
- matrix_write_P(&matrix, PSTR("ADJUST"));
- break;
- default:
- matrix_write(&matrix, buf);
- }
-
- // Host Keyboard LED Status
- char led[40];
- snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
- matrix_write(&matrix, led);
- matrix_update(&display, &matrix);
-}
diff --git a/keyboards/hadron/ver2/rules.mk b/keyboards/hadron/ver2/rules.mk
index f2ec0e7b3f..79e5cccb5e 100644
--- a/keyboards/hadron/ver2/rules.mk
+++ b/keyboards/hadron/ver2/rules.mk
@@ -5,27 +5,19 @@ MCU = atmega32u4
BOOTLOADER = halfkay
# Build Options
-# change to "no" to disable the options, or define them in the Makefile in
-# the appropriate keymap folder that will get included automatically
+# comment out to disable the options.
#
-BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = no # Mouse keys
+BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
+MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-AUDIO_ENABLE = no # Audio output on port C6
-UNICODE_ENABLE = no # Unicode
-RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
-SWAP_HANDS_ENABLE = no # Enable one-hand typing
-
+COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-
-
-EXTRAFLAGS += -flto
-
-
-SRC = i2c.c \
- ssd1306.c
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+AUDIO_ENABLE = no # Audio output
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight
+OLED_ENABLE = yes
+OLED_DRIVER = SSD1306
diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c
index f00b4f26d6..ca13427497 100644
--- a/keyboards/hadron/ver2/ver2.c
+++ b/keyboards/hadron/ver2/ver2.c
@@ -1 +1,65 @@
#include "ver2.h"
+
+#ifdef OLED_ENABLE
+__attribute__ ((weak))
+oled_rotation_t oled_init_user(oled_rotation_t rotation) {
+ return OLED_ROTATION_180;
+}
+
+__attribute__ ((weak))
+void oled_task_user(void) {
+ oled_write_P(PSTR("LAYER "), false);
+ oled_write_char(get_highest_layer(layer_state) + 0x30, true);
+
+ led_t led_state = host_keyboard_led_state();
+ oled_set_cursor(18, 0);
+ oled_write_P(PSTR("NUM"), led_state.num_lock);
+ oled_set_cursor(18, 1);
+ oled_write_P(PSTR("CAP"), led_state.caps_lock);
+ oled_set_cursor(18, 2);
+ oled_write_P(PSTR("SCR"), led_state.scroll_lock);
+
+ uint8_t mod_state = get_mods();
+ oled_set_cursor(10, 3);
+ oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT);
+ oled_advance_char();
+ oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL);
+ oled_advance_char();
+ oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT);
+ oled_advance_char();
+ oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI);
+ oled_advance_char();
+
+/* Matrix display is 12 x 12 pixels */
+#define MATRIX_DISPLAY_X 5
+#define MATRIX_DISPLAY_Y 18
+
+ // matrix
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ for (uint8_t y = 0; y < MATRIX_COLS; y++) {
+ bool on = (matrix_get_row(x) & (1 << y)) > 0;
+ oled_write_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2, on);
+ }
+ }
+
+ // outline
+ for (uint8_t x = 0; x < 19; x++) {
+ oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true);
+ oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 9, true);
+ }
+ for (uint8_t y = 0; y < 9; y++) {
+ oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true);
+ oled_write_pixel(MATRIX_DISPLAY_X + 19, MATRIX_DISPLAY_Y+y, true);
+ }
+
+ // oled location
+ for (uint8_t x = 0; x < 3; x++) {
+ oled_write_pixel(MATRIX_DISPLAY_X + 14 + x, MATRIX_DISPLAY_Y + 2, true);
+ }
+
+ // bodge for layer number left hand side
+ for (uint8_t y = 0; y < 8; y++) {
+ oled_write_pixel(35, 0 + y, true);
+ }
+}
+#endif
diff --git a/keyboards/hadron/ver2/ver2.h b/keyboards/hadron/ver2/ver2.h
index 54e141ffac..8127b497f7 100644
--- a/keyboards/hadron/ver2/ver2.h
+++ b/keyboards/hadron/ver2/ver2.h
@@ -1,6 +1,3 @@
-#ifndef VER2_H
-#define VER2_H
+#pragma once
-#include "../hadron.h"
-
-#endif \ No newline at end of file
+#include "hadron.h"