Save at a working point

clueboard_arm
skullY 8 years ago
parent 36ae7c7d9a
commit 31782fa961

@ -27,7 +27,7 @@
#define MANUFACTURER "Clueboard"
#define USBSTR_MANUFACTURER 'C', '\x00', 'l', '\x00', 'u', '\x00', 'e', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00'
#define PRODUCT "Simon Tester"
#define USBSTR_PRODUCT 'S', '\x00', 'i', '\x00', 'm', '\x00', 'o', '\x00', 'n', '\x00'
#define USBSTR_PRODUCT 'S', '\x00', 'i', '\x00', 'm', '\x00', 'o', '\x00', 'n', '\x00', ' ', '\x00', 'T', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00', 'e', '\x00', 'r', '\x00'
#define DESCRIPTION A switch tester that plays Simon
/* key matrix size */
@ -53,12 +53,6 @@
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION CUSTOM_MATRIX
/* backlight control */
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 6
@ -134,4 +128,12 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1
/* Remap PA11->PA9 and PA12->PA10 on STM32 devices that require it.
*
* The following MCU's are known to require this:
*
* STM32F042x6
*/
#define STM32_REMAP_PINS
#endif

@ -1,37 +0,0 @@
# Copyright 2013 Jun Wako <wakojun@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# QMK Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -1,24 +0,0 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#endif

@ -17,7 +17,42 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP(
KC_1, KC_2, \
KC_3, KC_4 \
KC_1, F(2), \
F(0), F(1) \
),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static bool backlight;
switch (id) {
case 0:
palSetPad(GPIOA, 6);
palSetPad(GPIOA, 3);
palSetPad(GPIOA, 15);
palSetPad(GPIOB, 5);
backlight = false;
break;
case 1:
palClearPad(GPIOA, 6);
palClearPad(GPIOA, 3);
palClearPad(GPIOA, 15);
palClearPad(GPIOB, 5);
backlight = true;
break;
case 2:
if (backlight) {
palSetPad(GPIOA, 6);
palSetPad(GPIOA, 3);
palSetPad(GPIOA, 15);
palSetPad(GPIOB, 5);
backlight = false;
} else {
palClearPad(GPIOA, 6);
palClearPad(GPIOA, 3);
palClearPad(GPIOA, 15);
palClearPad(GPIOB, 5);
backlight = true;
}
}
}

@ -16,9 +16,40 @@
*/
#include "hal.h"
#include "backlight.h"
#include "led.h"
#include "print.h"
void backlight_init_ports(void) {
print("backlight_init_ports()\n");
/*
palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 15, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL);
void led_set(uint8_t usb_led) {
// Set them high to turn off the LEDs
palClearPad(GPIOA, 6);
//palSetPad(GPIOA, 6);
palSetPad(GPIOA, 3);
palSetPad(GPIOA, 15);
palSetPad(GPIOB, 5);
*/
}
void backlight_set(uint8_t level) {
printf("backlight_set(%d)\n", level);
/*
if (level == 0) {
palSetPad(GPIOA, 6);
palSetPad(GPIOA, 3);
palSetPad(GPIOA, 15);
palSetPad(GPIOB, 5);
} else {
palClearPad(GPIOA, 6);
palClearPad(GPIOA, 3);
palClearPad(GPIOA, 15);
palClearPad(GPIOB, 5);
}
*/
}

@ -5,6 +5,7 @@
#include "timer.h"
#include "wait.h"
#include "print.h"
#include "backlight.h"
#include "matrix.h"
@ -25,44 +26,55 @@ static uint16_t debouncing_time = 0;
void matrix_init(void) {
//debug_matrix = true;
//debug_matrix = true;
/* Column(sense) */
palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOB, 7, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOB, 6, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOB, 3, PAL_MODE_INPUT_PULLDOWN);
/* Row(strobe) */
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOA, 7); // Only one row, so leave it in strobe state all the time
palSetPad(GPIOA, 7); // Only one row, so leave it in strobe state all the time.
// I did it this way so hardware hackers would have another
// pin to play with.
memset(matrix, 0, MATRIX_ROWS);
memset(matrix_debouncing, 0, MATRIX_ROWS);
/* Setup the backlight */
/*
palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 15, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL);
// Set them high to turn off the LEDs
palSetPad(GPIOA, 6);
palSetPad(GPIOA, 3);
palSetPad(GPIOA, 15);
palSetPad(GPIOB, 5);
*/
}
uint8_t matrix_scan(void) {
for (int row = 0; row < MATRIX_ROWS; row++) {
matrix_row_t data = 0;
// read col data: { PA5, PA4, PB6, PB3 }
data = (palReadPad(GPIOA, 5) |
palReadPad(GPIOA, 4) |
palReadPad(GPIOB, 6) |
palReadPad(GPIOB, 3));
if (matrix_debouncing[row] != data) {
matrix_debouncing[row] = data;
debouncing = true;
debouncing_time = timer_read();
}
matrix_row_t data = 0;
// read col data: { PA5, PA4, PB6, PB3 }
data = (palReadPad(GPIOA, 5) |
(palReadPad(GPIOA, 4) << 1) |
(palReadPad(GPIOB, 6) << 2) |
(palReadPad(GPIOB, 3) << 3));
if (matrix_debouncing[0] != data) {
matrix_debouncing[0] = data;
debouncing = true;
debouncing_time = timer_read();
}
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
for (int row = 0; row < MATRIX_ROWS; row++) {
matrix[row] = matrix_debouncing[row];
}
matrix[0] = matrix_debouncing[0];
debouncing = false;
}
return 1;

@ -33,6 +33,9 @@ ARMV = 6
#OPT_DEFS = -DCORTEX_VTOR_INIT=0x00001000
OPT_DEFS =
# Options to pass to dfu-util when flashing
DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000
# Build Options
# comment out to disable the options.
#

@ -21,6 +21,11 @@
// This a shortcut to help you visually see your layout.
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define KEYMAP(k00, k01, k02, k03) { { k00, k03, k01, k02, }, }
#define KEYMAP(\
k00, k03, \
k01, k02 \
) { { \
k00, k01, k02, k03, \
}, }
#endif

@ -1026,6 +1026,16 @@ void init_usb_driver(USBDriver *usbp) {
obqObjectInit(&console_buf_queue, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp);
chVTObjectInit(&console_flush_timer);
#endif
#ifdef STM32_REMAP_PINS
/* Remap PA11->PA9 and PA12->PA10 on STM32 devices that require it.
*
* The following MCU's are known to require this:
*
* STM32F042x6
*/
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN;
SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP;
#endif
}
/*

Loading…
Cancel
Save