[Keyboard] Add micromod input and display keyboard

This commit is contained in:
Drashna Jael're 2023-07-01 03:28:42 -07:00
parent e723940704
commit 7775bb2383
No known key found for this signature in database
GPG Key ID: DBA1FD3A860D1B11
20 changed files with 392 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// Copyright 2023 Drashna Jael're (@Drashna Jael're)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
// custom matrix
#define MATRIX_ROWS 1
#define MATRIX_COLS 7
#define AUDIO_INIT_DELAY
#define I2C1_CLOCK_SPEED 100000
#define QUANTUM_PAINTER_DISPLAY_TIMEOUT 0

View File

@ -0,0 +1,59 @@
{
"manufacturer": "QMK",
"url": "",
"maintainer": "qmk",
"usb": {
"vid": "0xFEED",
"pid": "0x6465",
"device_version": "0.0.1"
},
"tapping": {
"term": 500
},
"diode_direction": "COL2ROW",
"features": {
"bootmagic": false,
"mousekey": false,
"extrakey": true,
"console": false,
"command": false,
"nkro": false,
},
"layouts": {
"LAYOUT": {
"layout": [
{"label": "Up", "x": 1, "y": 0, "matrix": [0, 2]},
{"label": "Left", "x": 0, "y": 1, "matrix": [0, 4]},
{"label": "Center", "x": 1, "y": 1, "matrix": [0, 6]},
{"label": "Right", "x": 2, "y": 1, "matrix": [0, 5]},
{"label": "A", "x": 5, "y": 1, "matrix": [0, 0]},
{"label": "B", "x": 6, "y": 1, "matrix": [0, 1]},
{"label": "Down", "x": 1, "y": 2, "matrix": [0, 3]}
]
}
},
"rgblight": {
"driver": "apa102",
"led_count": 6,
"animations": {
"breathing": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"snake": true,
"knight": true,
"christmas": true,
"static_gradient": true,
"rgb_test": true,
"alternating": true,
"twinkle": true
},
"default": {
"animation": "rainbow_swirl"
}
},
"backlight": {
"driver": "pwm",
"levels": 10,
"on_state": 0
}
}

View File

@ -0,0 +1,12 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_UP,
KC_LEFT, KC_C, KC_RIGHT, KC_A, KC_B,
KC_DOWN
)
};

View File

@ -0,0 +1,85 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include <stdint.h>
#include "quantum.h"
#include "i2c_master.h"
#define BUTTON_I2C_ADDRESS 0x71
#ifndef BUTTON_I2C_TIMEOUT
#define BUTTON_I2C_TIMEOUT 100
#endif
#define BUTTON_ID 0x00
#define BUTTON_VERSION1 0x01
#define BUTTON_VERSION2 0x02
#define BUTTON_PRESSED 0x03
#define BUTTON_CLICKED 0x04
#define BUTTON_INTERRUPT 0x05
#define BUTTON_DEBOUNCE 0x06
#define BUTTON_CHANGE_ADDREESS 0x1F
static bool is_connected = false;
void matrix_init_custom(void) {
i2c_init();
uint8_t data = 0;
i2c_status_t status = i2c_readReg(BUTTON_I2C_ADDRESS << 1, 0, &data, 1, BUTTON_I2C_TIMEOUT);
is_connected = (status == I2C_STATUS_SUCCESS);
}
uint8_t button_get_pressed(void) {
uint8_t data = 0;
i2c_readReg(BUTTON_I2C_ADDRESS << 1, BUTTON_PRESSED, &data, 1, BUTTON_I2C_TIMEOUT);
return data;
}
uint8_t button_get_clicked(void) {
uint8_t data = 0;
i2c_readReg(BUTTON_I2C_ADDRESS << 1, BUTTON_CLICKED, &data, 1, BUTTON_I2C_TIMEOUT);
return data;
}
uint16_t button_get_debounce(void) {
uint8_t data[2] = {0};
i2c_readReg(BUTTON_I2C_ADDRESS << 1, BUTTON_DEBOUNCE, data, 2, BUTTON_I2C_TIMEOUT);
return (data[0] << 8) | data[1];
}
bool button_get_pressed_interrupt(void) {
uint8_t data = 0;
i2c_status_t status = i2c_readReg(BUTTON_I2C_ADDRESS << 1, BUTTON_INTERRUPT, &data, 1, BUTTON_I2C_TIMEOUT);
return (status == I2C_STATUS_SUCCESS) && ((data & (1 << 1)) >> 1);
}
bool button_get_clicked_interrupt(void) {
uint8_t data = 0;
i2c_status_t status = i2c_readReg(BUTTON_I2C_ADDRESS << 1, BUTTON_INTERRUPT, &data, 1, BUTTON_I2C_TIMEOUT);
return (status == I2C_STATUS_SUCCESS) && ((data & (1 << 0)) >> 0);
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool matrix_has_changed = false;
if (!is_connected) {
return false;
}
uint8_t pressed = button_get_pressed();
if (pressed) {
current_matrix[0] |= pressed;
matrix_has_changed = true;
wait_us(200);
}
uint8_t clicked = button_get_clicked();
if (clicked) {
current_matrix[0] &= ~(clicked);
matrix_has_changed = true;
wait_us(10);
}
return matrix_has_changed;
}

View File

@ -0,0 +1,27 @@
# handwired/micromod_input_display
![handwired/micromod_input_display](imgur.com image replace me!)
*A short description of the keyboard/project*
* Keyboard Maintainer: [Drashna Jael're](https://github.com/Drashna Jael're)
* Hardware Supported: *The PCBs, controllers supported*
* Hardware Availability: *Links to where you can find this hardware*
Make example for this keyboard (after setting up your build environment):
make handwired/micromod_input_display:default
Flashing example for this keyboard:
make handwired/micromod_input_display:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Bootloader
Enter the bootloader in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

View File

@ -0,0 +1,31 @@
// Copyright 2022 Stefan Kerkmann
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define I2C_DRIVER I2CD0
#define I2C1_SDA_PIN GP4
#define I2C1_SCL_PIN GP5
#define AUDIO_PIN GP24
#define AUDIO_PWM_DRIVER PWMD4
#define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_A
#define SPI_DRIVER SPID0
#define SPI_SCK_PIN GP22
#define SPI_MOSI_PIN GP23
#define SPI_MISO_PIN GP20
#define DISPLAY_CS_PIN_ILI9341 GP6
#define DISPLAY_DC_PIN_ILI9341 GP7
#define DISPLAY_RST_PIN_ILI9341 GP18
#define BACKLIGHT_PWM_DRIVER PWMD6
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
#define "SERIAL_NUMBER" "MICROMOD_INPUT_DISPLAY"
#define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))

View File

@ -0,0 +1,10 @@
// Copyright 2022 Stefan Kerkmann
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define HAL_USE_I2C TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_SPI TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,12 @@
{
"keyboard_name": "Input and Display MicroMod RP2040",
"processor": "RP2040",
"bootloader": "rp2040",
"apa102": {
"clock_pin": "GP17",
"data_pin": "GP16"
},
"backlight": {
"pin": "GP13"
}
}

View File

@ -0,0 +1,20 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include_next <mcuconf.h>
#undef RP_I2C_USE_I2C0
#define RP_I2C_USE_I2C0 TRUE
#undef SRP_SPI_USE_SPI0
#define RP_SPI_USE_SPI0 TRUE
#undef RP_PWM_USE_PWM4
#define RP_PWM_USE_PWM4 TRUE
#undef RP_PWM_USE_PWM6
#define RP_PWM_USE_PWM6 TRUE
#define RP_IRQ_RTC_PRIORITY 3

View File

@ -0,0 +1,12 @@
# Raspberry Pi 2040 onekey
To trigger keypress, short together pins *GP4* and *GP5*.
Double-tap reset to enter bootloader mode. Copy the built uf2 file to the device by dragging the file to the new USB disk.
## Supported Hardware
* Raspberry Pi Pico
* SparkFun Pro Micro - RP2040
* Adafruit KB2040 - RP2040 Kee Boar
* ...and many more RP2040 based development boards

View File

@ -0,0 +1,10 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(GP25);
writePinLow(GP25);
keyboard_pre_init_user();
}

View File

@ -0,0 +1,14 @@
DEFAULT_FOLDER = handwired/micromod_input_display/stm32f405
QUANTUM_PAINTER_ENABLE = yes
QUANTUM_PAINTER_DRIVERS = ili9341_spi
RGBLIGHT_ENABLE = yes
AUDIO_ENABLE = yes
AUDIO_DRIVER = pwm_hardware
BACKLIGHT_ENABLE = yes
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += i2c_master.c

View File

@ -0,0 +1,29 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define I2C_DRIVER I2CD2
#define I2C1_SDA_PIN B11
#define I2C1_SCL_PIN B10
#define AUDIO_PIN C7
#define AUDIO_PWM_DRIVER PWMD3
#define AUDIO_PWM_CHANNEL 2
#define AUDIO_PWM_PAL_MODE 2
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN A5
#define SPI_SCK_PAL_MODE 5
#define SPI_MOSI_PIN A7
#define SPI_MOSI_PAL_MODE 5
#define SPI_MISO_PIN A6
#define SPI_MISO_PAL_MODE 5
#define DISPLAY_CS_PIN_ILI9341 C0
#define DISPLAY_DC_PIN_ILI9341 C1
#define DISPLAY_RST_PIN_ILI9341 A0
#define BACKLIGHT_PWM_DRIVER PWMD8
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 3

View File

@ -0,0 +1,10 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define HAL_USE_I2C TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_SPI TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,12 @@
{
"keyboard_name": "Input and Display MicroMod STM32F405",
"apa102": {
"clock_pin": "D2",
"data_pin": "A8"
},
"backlight": {
"pin": "C6"
},
"bootloader": "tinyuf2",
"processor": "STM32F405"
}

View File

@ -0,0 +1,18 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include_next <mcuconf.h>
#undef STM32_I2C_USE_I2C2
#define STM32_I2C_USE_I2C2 TRUE
#undef STM32_SPI_USE_SPI1
#define STM32_SPI_USE_SPI1 TRUE
#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE
#undef STM32_PWM_USE_TIM8
#define STM32_PWM_USE_TIM8 TRUE

View File

@ -0,0 +1,7 @@
# Adafruit Feather STM32F405 Express onekey
* Supported Hardware: [Adafruit Feather STM32F405 Express](https://www.adafruit.com/product/4382)
To trigger keypress, short together pins *GPIO 12 / PC2* and *GPIO 11 / PC3*.
https://learn.adafruit.com/adafruit-stm32f405-feather-express/dfu-bootloader-details#enabling-dfu-bootloader-mode-3045622-2

View File

@ -0,0 +1,10 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(A15);
writePinLow(A15);
keyboard_pre_init_user();
}