Skip to content

Commit cb4346e

Browse files
authored
Migrate hadron away from QWIIC_DRIVERS (#14415)
1 parent 8a3f97b commit cb4346e

File tree

15 files changed

+155
-733
lines changed

15 files changed

+155
-733
lines changed

keyboards/hadron/i2c.c

Lines changed: 0 additions & 166 deletions
This file was deleted.

keyboards/hadron/i2c.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

keyboards/hadron/ver2/config.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
2929
#define UNUSED_PINS
3030

31-
32-
#define USE_I2C
33-
#define SSD1306OLED
34-
#define OLED_ROTATE180
31+
// configure oled driver for the 128x32 oled
32+
#define OLED_UPDATE_INTERVAL 33 // ~30fps
3533

3634
/* ws2812 RGB LED*/
3735
#define RGB_DI_PIN D4

keyboards/hadron/ver2/keymaps/default/keymap.c

Lines changed: 4 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
#include QMK_KEYBOARD_H
2-
#ifdef USE_I2C
3-
#include "i2c.h"
4-
#endif
5-
#ifdef SSD1306OLED
6-
#include "ssd1306.h"
7-
#endif
82

93
//Following line allows macro to read current RGB settings
104
extern rgblight_config_t rgblight_config;
@@ -18,8 +12,8 @@ extern rgblight_config_t rgblight_config;
1812
#define _DVORAK 2
1913
#define _LOWER 3
2014
#define _RAISE 4
21-
#define _MOUSECURSOR 8
22-
#define _ADJUST 16
15+
#define _MOUSECURSOR 5
16+
#define _ADJUST 6
2317

2418
enum preonic_keycodes {
2519
QWERTY = SAFE_RANGE,
@@ -307,115 +301,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
307301
return true;
308302
}
309303

310-
//Functions for ver2
311-
#ifdef KEYBOARD_hadron_ver2
312-
#include <LUFA/Drivers/Peripheral/TWI.h>
313304
void matrix_init_user(void) {
314-
#ifdef USE_I2C
315-
i2c_master_init();
316-
#ifdef SSD1306OLED
317-
// calls code for the SSD1306 OLED
318-
_delay_ms(400);
319-
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
320-
iota_gfx_init(); // turns on the display
321-
#endif
322-
#endif
323-
#ifdef AUDIO_ENABLE
324-
startup_user();
325-
#endif
326-
}
327-
328-
329-
void matrix_scan_user(void) {
330-
#ifdef SSD1306OLED
331-
iota_gfx_task(); // this is what updates the display continuously
332-
#endif
333-
}
334-
335-
void matrix_update(struct CharacterMatrix *dest,
336-
const struct CharacterMatrix *source) {
337-
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
338-
memcpy(dest->display, source->display, sizeof(dest->display));
339-
dest->dirty = true;
340-
}
341-
}
342-
//assign the right code to your layers for OLED display
343-
#define L_BASE 0
344-
#define L_LOWER 8
345-
#define L_RAISE 16
346-
#define L_FNLAYER 64
347-
#define L_NUMLAY 128
348-
#define L_NLOWER 136
349-
#define L_NFNLAYER 192
350-
#define L_MOUSECURSOR 256
351-
#define L_ADJUST 65560
352-
353-
void iota_gfx_task_user(void) {
354-
#if DEBUG_TO_SCREEN
355-
if (debug_enable) {
356-
return;
357-
}
358-
#endif
359-
360-
struct CharacterMatrix matrix;
361-
362-
matrix_clear(&matrix);
363-
matrix_write_P(&matrix, PSTR("USB: "));
364-
#ifdef PROTOCOL_LUFA
365-
switch (USB_DeviceState) {
366-
case DEVICE_STATE_Unattached:
367-
matrix_write_P(&matrix, PSTR("Unattached"));
368-
break;
369-
case DEVICE_STATE_Suspended:
370-
matrix_write_P(&matrix, PSTR("Suspended"));
371-
break;
372-
case DEVICE_STATE_Configured:
373-
matrix_write_P(&matrix, PSTR("Connected"));
374-
break;
375-
case DEVICE_STATE_Powered:
376-
matrix_write_P(&matrix, PSTR("Powered"));
377-
break;
378-
case DEVICE_STATE_Default:
379-
matrix_write_P(&matrix, PSTR("Default"));
380-
break;
381-
case DEVICE_STATE_Addressed:
382-
matrix_write_P(&matrix, PSTR("Addressed"));
383-
break;
384-
default:
385-
matrix_write_P(&matrix, PSTR("Invalid"));
386-
}
305+
#ifdef AUDIO_ENABLE
306+
startup_user();
387307
#endif
388-
389-
// 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
390-
391-
char buf[40];
392-
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
393-
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
394-
switch (layer_state) {
395-
case L_BASE:
396-
matrix_write_P(&matrix, PSTR("Default"));
397-
break;
398-
case L_RAISE:
399-
matrix_write_P(&matrix, PSTR("Raise"));
400-
break;
401-
case L_LOWER:
402-
matrix_write_P(&matrix, PSTR("Lower"));
403-
break;
404-
case L_ADJUST:
405-
matrix_write_P(&matrix, PSTR("ADJUST"));
406-
break;
407-
default:
408-
matrix_write(&matrix, buf);
409-
}
410-
411-
// Host Keyboard LED Status
412-
char led[40];
413-
snprintf(led, sizeof(led), "\n%s %s %s",
414-
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
415-
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
416-
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
417-
matrix_write(&matrix, led);
418-
matrix_update(&display, &matrix);
419308
}
420-
421-
#endif

keyboards/hadron/ver2/keymaps/readme.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)