Skip to content

Instantly share code, notes, and snippets.

#ifndef I2C_DRIVER
# define I2C_DRIVER I2CD1
#endif
// ...
if (io_expander_ready()) {
// If we managed to initialize the mcp23018 - we need to reinitialize the matrix / layer state. During an electric discharge the i2c peripherals might be in a weird state. Giving a delay and resetting the MCU allows to recover from this.
mcp23018_reset_loop = 0;
mcp23018_errors = 0;
  SN32F268 ATmega32U4 AT90USB1286 Proton C - STM32F303xC Blackpill - STM32F411 RP2040 Nice Nano (nRF52840)
Speed 48MHz 16MHz 16MHz 72MHz ~96MHz 2@ 133MHz 64MHz
Voltage 3.3V 5V 5V 3.3V with some 5V capable pins 3.3V with 5V capable pins 3.3v 3.3v
Flash size 32kB (~28kB usable) 32kB (28kB usable) 128kB (120kB usable) 256kB 512kB off-chip flash, up to 16MB 1MB
EEPROM si
@drashna
drashna / autocorrect_dict_larger.txt
Last active May 6, 2025 04:26
Autocorrect dictionaries for QMK Firmware
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@drashna
drashna / keymap.c
Created April 1, 2025 23:27
nano scroll lock scrolling
#include QMK_KEYBOARD_H
// Dummy
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {{{KC_NO}}};
void suspend_power_down_user(void) {
// Switch off sensor + LED making trackball unable to wake host
adns5050_power_down();
}
@drashna
drashna / oled_pet.c
Last active December 3, 2024 06:05
basic implementation of luna/etc with defer exec
// Images credit j-inc(/James Incandenza) and pixelbenny.
// Credit to obosob for initial animation approach.
// heavily modified by drashna because he's a glutton for punishment
#define OLED_ANIM_SIZE (32+1)
#define OLED_ANIM_ROWS 4
#define OLED_ANIM_MAX_FRAMES 3
#define OLED_SLEEP_FRAMES 2
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update_1/arm-none-eabi/include/**",
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update_1/lib/gcc/arm-none-eabi/8.3.1/include/**",
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update_1/lib/gcc/arm-none-eabi/8.3.1/include-fixed/**",
"/usr/local/Cellar/avr-gcc@8/8.4.0_2/avr/include/**",
"/usr/local/Cellar/avr-gcc@8/8.4.0_2/lib/avr-gcc/8/gcc/avr/8.4.0/include/**",
@drashna
drashna / config.h
Last active October 30, 2024 15:23
Caps word state sync
#pragma once
#define SPLIT_TRANSACTION_IDS_USER USER_SYNC_A
@drashna
drashna / oled_font.h
Created August 9, 2024 00:34
Oled font with all glyphs
#pragma once
// additional fonts from
// https://github.com/datacute/TinyOLED-Fonts
#include "progmem.h"
// clang-format off
static const unsigned char font[] PROGMEM = {
0x07, 0x08, 0x7F, 0x08, 0x07, 0x00,
#include QMK_KEYBOARD_H
#ifdef OLED_ENABLE
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_2x4(
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
)
};
@drashna
drashna / keymap.c
Created July 15, 2024 23:05
os configed replacements
uint16_t keycode_config(uint16_t keycode) {
switch (keycode) {
case KC_CAPS_LOCK:
case KC_LOCKING_CAPS_LOCK:
if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
return KC_LEFT_CTRL;
} else if (keymap_config.swap_escape_capslock) {
return KC_ESCAPE;
}
return keycode;