1
0
Fork 0
qmk_firmware/keyboards/hadron/ver2/ver2.c

66 lines
2 KiB
C
Raw Normal View History

adding Hadron v3 keyboard, QWIIC devices support, haptic feedback support (#4462) * add initial support for hadron ver3 * add initial support for hadron ver3 * pull qwiic support for micro_led to be modified for use in hadron's 64x24 ssd1306 oled display * initial work on OLED using qwiic driver * early work to get 128x32 oled working by redefining qwiic micro oled parameters. Currently working, but would affect qwiic's micro oled functionality * moved oled defines to config.h and added ifndef to micro_oled driver * WORKING :D - note, still work in progress to get the start location correct on the 128x32 display. * added equation to automatically calculate display offset based on screen width * adding time-out timer to oled display * changed read lock staus via read_led_state * lock indications fixes * Added scroll lock indication to oled * add support for DRV2605 haptic driver * Improve readabiity of DRV2605 driver. -added typedef for waveform library -added unions for registers * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob <ishtob@gmail.com> * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob <ishtob@gmail.com> * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob <ishtob@gmail.com> * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob <ishtob@gmail.com> * Fixes for PR * PR fixes * fix old persistent layer function to use new set_single_persistent_default_layer * fix issues with changing makefile defines that broken per-key haptic pulse * Comment fixes * Add definable parameter and auto-calibration based on motor choice
2018-12-04 16:04:57 +00:00
#include "ver2.h"
#ifdef OLED_ENABLE
oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return OLED_ROTATION_180; }
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
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);
}
return false;
}
#endif