Skip to content

Commit

Permalink
Migrate hadron away from QWIIC_DRIVERS
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed Sep 12, 2021
1 parent bcf4551 commit 10692a3
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 733 deletions.
166 changes: 0 additions & 166 deletions keyboards/hadron/i2c.c

This file was deleted.

46 changes: 0 additions & 46 deletions keyboards/hadron/i2c.h

This file was deleted.

6 changes: 2 additions & 4 deletions keyboards/hadron/ver2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
121 changes: 4 additions & 117 deletions keyboards/hadron/ver2/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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
22 changes: 0 additions & 22 deletions keyboards/hadron/ver2/keymaps/readme.md

This file was deleted.

Loading

0 comments on commit 10692a3

Please sign in to comment.