Anne Pro working with Obins DFU bootloader

anne_pro
Michiel Visser 2019-06-24 18:13:59 +02:00
parent b98375ce5a
commit c83bd5adb4
7 changed files with 75 additions and 18 deletions

View File

@ -58,7 +58,6 @@ static void rxend(UARTDriver *uartp) {
(void)uartp;
}
static UARTConfig uart_cfg = {
.txend1_cb = txend1,
.txend2_cb = txend2,
@ -71,13 +70,7 @@ static UARTConfig uart_cfg = {
.cr3 = 0
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!record->event.pressed) {
/* Send 'next theme' command to lighting controller */
uartStartSend(&UARTD3, 4, "\x09\x04\x05\x01\x00\x00");
}
return true;
}
extern volatile bool leds_enabled;
void matrix_init_kb(void) {
/* Turn on lighting controller */
@ -93,7 +86,8 @@ void matrix_init_kb(void) {
palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7));
/* Send 'set theme' command to lighting controller */
uartStartSend(&UARTD3, 4, "\x09\x02\x01\x01");
leds_enabled = true;
uartStartSend(&UARTD3, 4, "\x09\x01\x01");
matrix_init_user();
}

View File

@ -17,8 +17,7 @@
#pragma once
#include "quantum.h"
/* The fully-featured LAYOUT() that has every single key available in the matrix.
*/
/* The fully-featured LAYOUT() that has every single key available in the matrix. */
#define LAYOUT(\
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \

View File

@ -73,6 +73,14 @@ const PALConfig pal_default_config = {
* and before any other initialization.
*/
void __early_init(void) {
/* Disable all external interrupt vectors, they are left enabled by the bootloader */
nvicDisableVector(EXTI0_IRQn);
nvicDisableVector(EXTI1_IRQn);
nvicDisableVector(EXTI2_IRQn);
nvicDisableVector(EXTI3_IRQn);
nvicDisableVector(EXTI4_IRQn);
nvicDisableVector(EXTI9_5_IRQn);
nvicDisableVector(EXTI15_10_IRQn);
stm32_clock_init();
}

View File

@ -19,9 +19,9 @@
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0006
#define VENDOR_ID 0x0483
#define PRODUCT_ID 0xdf11
#define DEVICE_VER 0x0200
#define MANUFACTURER QMK
#define PRODUCT Anne Pro

View File

@ -16,12 +16,68 @@
#include QMK_KEYBOARD_H
/* Custom keycodes for the lighting control for the Anne Pro */
enum my_keycodes {
ANNERGB = SAFE_RANGE,
ANNERAT,
ANNEBRT,
ANNEMOD
};
/* Default Anne Pro layout, macOS style with LALT and LWIN switched */
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, KC_NO, KC_NO, KC_RCTL
KC_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), KC_NO, KC_RCTL
),
[1] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______,
_______, _______, KC_UP, _______, ANNERGB, ANNERAT, ANNEBRT, ANNEMOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR,
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, _______,
_______, _______, _______, _______, _______, _______, _______, _______
)
};
/* State of the leds on the keyboard */
volatile bool leds_enabled = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case ANNERGB:
/* Toggle the RGB enabled/disabled */
if (record->event.pressed) {
leds_enabled = !leds_enabled;
if (leds_enabled) {
uartStartSend(&UARTD3, 3, "\x09\x01\x01");
} else {
uartStartSend(&UARTD3, 4, "\x09\x02\x01\x00");
}
}
return false;
case ANNERAT:
/* Change the animation rate */
if (leds_enabled && record->event.pressed) {
uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x01\x00");
}
return false;
case ANNEBRT:
/* Change the brightness */
if (leds_enabled && record->event.pressed) {
uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x00\x01");
}
return false;
case ANNEMOD:
/* Change the lighting mode */
if (leds_enabled && record->event.pressed) {
uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00");
}
return false;
default:
/* Handle other keycodes normally */
return true;
}
}

View File

@ -19,7 +19,7 @@
*/
MEMORY
{
flash0 : org = 0x08000000, len = 64k
flash0 : org = 0x08004000, len = 48k
flash1 : org = 0x00000000, len = 0
flash2 : org = 0x00000000, len = 0
flash3 : org = 0x00000000, len = 0

View File

@ -28,8 +28,8 @@ BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
AUDIO_ENABLE = no