Skip to content

Instantly share code, notes, and snippets.

[
{"label": "k4E", "matrix": [4, 14], "w": 1, "x": 14, "y": 4},
{"label": "k4D", "matrix": [4, 13], "w": 1, "x": 13, "y": 4},
{"label": "k4C", "matrix": [4, 12], "w": 1, "x": 12, "y": 4},
{"label": "k4B", "matrix": [4, 11], "w": 1, "x": 11, "y": 4},
{"label": "k4A", "matrix": [4, 10], "w": 1, "x": 10, "y": 4},
{"label": "k49", "matrix": [4, 9], "w": 1, "x": 9, "y": 4},
{"label": "k48", "matrix": [4, 8], "w": 1, "x": 8, "y": 4},
{"label": "k47", "matrix": [4, 7], "w": 1, "x": 7, "y": 4},
{"label": "k46", "matrix": [4, 6], "w": 1, "x": 6, "y": 4},
@elpekenin
elpekenin / oled.c
Last active December 14, 2022 01:35
#ifdef OLED_ENABLE
static uint32_t oled_timer = 0;
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; }
void render_space(void) {
oled_write_P(PSTR(" "), false);
}
void render_mod_status_gui_alt(uint8_t modifiers) {
@elpekenin
elpekenin / eink.py
Last active December 14, 2022 19:34
from machine import Pin, SPI
import time
WIDTH = const(264)
HEIGHT = const(176)
cs = Pin(18, Pin.OUT)
dc = Pin(6, Pin.OUT)
rst = Pin(0, Pin.OUT)
// Copyright 2022 Pablo Martinez (@elpekenin)
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined(ONE_HAND_ENABLE)
RGB_MATRIX_EFFECT(onehand_mode)
# if defined(RGB_MATRIX_CUSTOM_EFFECT_IMPLS)
# include "access.h"
# define ONE_HAND_LED_INDEX g_led_config.matrix_co[one_hand_row][one_hand_col]
# define ONE_HAND_BG_COLOR 0, 0, 0
Compiling: platforms/chibios/drivers/audio_dac_basic.c platforms/chibios/drivers/audio_dac_basic.c:53:14: error: unknown type name 'dacsample_t'
53 | static const dacsample_t dac_buffer_1[AUDIO_DAC_BUFFER_SIZE] = {
| ^~~~~~~~~~~
platforms/chibios/drivers/audio_dac_basic.c:60:14: error: unknown type name 'dacsample_t'
60 | static const dacsample_t dac_buffer_2[AUDIO_DAC_BUFFER_SIZE] = {
| ^~~~~~~~~~~
platforms/chibios/drivers/audio_dac_basic.c:66:1: error: unknown type name 'GPTConfig'; did you mean 'SPIConfig'?
66 | GPTConfig gpt6cfg1 = {.frequency = AUDIO_DAC_SAMPLE_RATE,
| ^~~~~~~~~
| SPIConfig
#!/usr/bin/env python3
# ======================== DISCLAIMER ========================
# Haven't tested this at all, so you may need some adjustments
# Firmware-side you'd need:
# a) Enable RAW_HID:
# https://docs.qmk.fm/#/feature_rawhid?id=raw-hid
#
# b) Check layer-control functions here:
# https://docs.qmk.fm/#/feature_layers?id=functions
#ifdef QUANTUM_PAINTER_SPI_DC_RESET_SHIFT_REG_ENABLE
uint32_t qp_comms_spi_send_data_shift_reg(painter_device_t device, const void *data, uint32_t byte_count) {
struct painter_driver_t * driver = (struct painter_driver_t *)device;
struct qp_comms_spi_dc_reset_config_t *comms_config = (struct qp_comms_spi_dc_reset_config_t *)driver->comms_config;
const uint8_t * p = (const uint8_t *)data;
uint32_t bytes_remaining = byte_count;
while (bytes_remaining > 0) {
uint32_t bytes_this_loop = bytes_remaining < 2 ? bytes_remaining : 2;
writePinLow(comms_config->spi_config.chip_select_pin);
@elpekenin
elpekenin / lcd.c
Last active September 28, 2022 11:02
// ===================
// Manual SPI handling
void my_spi(uint8_t value, bool is_data) {
writePinLow(LCD_CS_PIN);
writePin(LCD_DC_PIN, is_data);
spi_write(value);
writePinHigh(LCD_CS_PIN);
}
void my_cmd(uint8_t cmd) {
from machine import Pin,SPI,PWM
import framebuf
import time
import os
FREC = 6_000_000
LCD_SCK = 2
LCD_MOSI = 3
LCD_MISO = 4

XAP Active Window

This project implements a use-case for XAP, changing your keyboard behaviour depending on the active program

  • The code here is organized like #$@*, so feel free to improve it
  • It was done using Windows libraries, so it will need some changes to get it working on another OS

To run it

  1. Install the needed dependencies with pip install -r requirements.txt
  2. Tweak the variables to your needs
  • The MAPPING dict maps *.exe program names to easier to read ones