Keyboard: HP 46010A converter (#3967)

* funged git history, restarting

* tested and working (message typed on this)

* updated documentation to include wiring directions

* formatting

* updated matrix and default layout a bit

* getting ready for merge into main repo

* getting ready for merge into main repo v2

* cleaning

* cleaning repo of extranious files

* updated documentation
pull/3971/head
listofoptions 6 years ago committed by Drashna Jaelre
parent 58b9b22670
commit ce057ea474

@ -0,0 +1,35 @@
/*
Copyright 2018 listofoptions <listofoptions@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/>.
*/
#pragma once
#include "config_common.h"
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 1
#define MANUFACTURER QMK
#define PRODUCT 46010A keyboard converter
#define DESCRIPTION 46010A keyboard converter
#define MATRIX_ROWS 14
#define MATRIX_COLS 8
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5

@ -0,0 +1,3 @@
#include "hp_46010a.h"
#include <avr/io.h>
#include "quantum.h"

@ -0,0 +1,62 @@
/*
Copyright 2018 listofoptions <listofoptions@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/>.
*/
#pragma once
#include "quantum.h"
/* ,---------. ,---------------------------------------------------------. ,---------. ,-------------------.
* | res|stop| | f1| f2| f3| f4|menu|user| f5| f6| f7| f8| |clrl|clrd| | | | | |
* `---------' `---------------------------------------------------------' `---------' `-------------------'
* ,------------------------------------------------------------------------..---------. ,-------------------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| +| back||insl|dell| | *| /| +| -|
* |------------------------------------------------------------------------||---------| |-------------------|
* | tab| q| w| e| r| t| y| u| i| o| p| [| ]| \||insc|delc| | 7| 8| 9|pade|
* |------------------------------------------------------------------------||---------| |-------------------|
* |caps|ctrl| a| s| d| f| g| h| j| k| l| ;| '| retr|| cur|prev| | 4| 5| 6| ,|
* |------------------------------------------------------------------------------------ |-------------------|
* |dele|lshf | z| x| c| v| b| n| m| ,| .| /|rshf |sel | up|next| | 1| 2| 3| tab|
* |-------------------------------------------------------------------------|---------| |--------------- |
* |prnt| |lalt| space |ralt| |left|down|rght| | 0| .| |
* `-----------------------------------------------------------------------------------' `-------------------'
*/
#define LAYOUT_HP_46010A( \
KEY_RES, KEY_STOP, KEY_F1, KEY_F2, KEY_F3, KEY_F4,KEY_MENU,KEY_USER, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_CLRL, KEY_CLRD, KEY_B1, KEY_B2, KEY_B3, KEY_B4, \
KEY_GRAV, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, KEY_MINU, KEY_PLUS, KEY_BACK, KEY_INSL, KEY_DELL, KEY_MULT, KEY_DIV, KEY_ADD, KEY_SUBT, \
KEY_TAB, KEY_Q,KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U, KEY_I, KEY_O, KEY_P, KEY_LBRA, KEY_RBRA, KEY_PIPE, KEY_INSC, KEY_DELC, KEY_P7, KEY_P8, KEY_P9, KEY_PADE, \
KEY_CAPS, KEY_CTRL, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J, KEY_K, KEY_L, KEY_SEMI, KEY_QUOT, KEY_RETR, KEY_CUR, KEY_PREV, KEY_P4, KEY_P5, KEY_P6, KEY_PCOM, \
KEY_DELE, KEY_LSHF, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, KEY_COMA, KEY_DOT, KEY_SLAS,KEY_RSHF, KEY_SEL, KEY_UP, KEY_NEXT, KEY_P1, KEY_P2, KEY_P3, KEY_PTAB, \
KEY_PRNT, KEY_LALT, KEY_SPACE , KEY_RALT, KEY_LEFT, KEY_DOWN, KEY_RGHT, KEY_P0, KEY_PDOT \
) { \
{KEY_USER, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_CLRL, KEY_CLRD, KEY_MENU }, \
{KEY_9, KEY_0, KEY_MINU, KEY_PLUS, KEY_BACK, KEY_INSL, KEY_DELL, KEY_8 }, \
{KEY_O, KEY_P, KEY_LBRA, KEY_RBRA, KEY_PIPE, KEY_INSC, KEY_DELC, KEY_I }, \
{KEY_K, KEY_L, KEY_SEMI, KEY_QUOT, KEY_RETR, KEY_CUR, KEY_PREV, KEY_J }, \
{KEY_COMA, KEY_DOT, KEY_SLAS, KEY_1, KEY_SEL, KEY_UP, KEY_NEXT, KEY_M }, \
{KEY_SPACE, KEY_LALT, KEY_RALT, KC_NO, KEY_LEFT, KEY_DOWN, KEY_RGHT, KC_NO }, \
{KEY_F3, KEY_F2, KEY_F1, KEY_GRAV, KEY_CTRL, KEY_STOP, KEY_G, KEY_F4 }, \
{KEY_6, KEY_5, KEY_4, KEY_3, KEY_CAPS, KEY_RSHF, KEY_LSHF, KEY_7 }, \
{KEY_Y, KEY_T, KEY_R, KEY_E, KEY_W, KEY_Q, KEY_TAB, KEY_U }, \
{KEY_RES, KEY_F, KEY_D, KEY_S, KEY_A, KC_NO, KEY_2, KEY_H }, \
{KEY_P7, KEY_P4, KEY_P8, KEY_P5, KEY_P9, KEY_P6, KEY_PADE, KEY_PCOM }, \
{KEY_MULT, KEY_P1, KEY_DIV, KEY_P2, KEY_PLUS, KEY_P3, KEY_MINU, KEY_PTAB }, \
{KEY_B1, KEY_P0, KEY_B2, KC_NO, KEY_B3, KEY_PDOT, KEY_B4, KC_NO }, \
{KEY_B, KEY_V, KEY_C, KEY_X, KEY_Z, KEY_PRNT, KEY_DELE, KEY_N }, \
}
#define LAYOUT LAYOUT_HP_46010A

@ -0,0 +1,6 @@
{
"keyboard_name": "HP_46010A",
"keyboard_folder": "converter/HP_46010A",
"url": "https://deskthority.net/wiki/HP_46010A",
"maintainer": "listofoptions",
}

@ -0,0 +1,45 @@
/*
Copyright 2018 listofoptions <listofoptions@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/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* ,---------. ,---------------------------------------------------------. ,---------. ,-------------------.
* | esc|xxxx| | f1| f2| f3| f4|xxxx|xxxx| f5| f6| f7| f8| |xxxx|xxxx| | f9| f10| f11| f12|
* `---------' `---------------------------------------------------------' `---------' `-------------------'
* ,------------------------------------------------------------------------..---------. ,-------------------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| back||ins |home| | *| /| +| -|
* |------------------------------------------------------------------------||---------| |-------------------|
* | tab| q| w| e| r| t| y| u| i| o| p| [| ]| \||del | end| | 7| 8| 9|pade|
* |------------------------------------------------------------------------||---------| |-------------------|
* |caps|ctrl| a| s| d| f| g| h| j| k| l| ;| '| retr||xxxx|pgup| | 4| 5| 6| ,|
* |------------------------------------------------------------------------------------ |-------------------|
* |del |lsft | z| x| c| v| b| n| m| ,| .| /|rsft | app| up|pgdn| | 1| 2| 3| tab|
* |-------------------------------------------------------------------------|---------| |--------------- |
* | gui| |lalt| space |ralt| |left|down|rght| | 0| .| |
* `-----------------------------------------------------------------------------------' `-------------------'
*/
[0] = LAYOUT(
KC_ESC, KC_NO, KC_F1, KC_F2, KC_F3, KC_F4,KC_NO, KC_NO, KC_F5, KC_F6, KC_F7, KC_F8, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, \
KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPC, KC_INS, KC_HOME, KC_PAST, KC_PSLS, KC_PPLS, KC_PMNS, \
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_DEL, KC_END, KC_P7, KC_P8, KC_P9, KC_PENT, \
KC_CAPS, KC_LCTL, 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_NO, KC_PGUP, KC_P4, KC_P5, KC_P6, KC_PCMM, \
KC_DEL, 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_APP, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_TAB, \
KC_LGUI, KC_LALT, KC_SPACE , KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT \
)
} ;

@ -0,0 +1,244 @@
/*
Copyright 2018 listofoptions <listofoptions@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/>.
*/
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#if defined(__AVR__)
#include <avr/io.h>
#endif
#include <util/delay.h>
#include "wait.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "timer.h"
#include "LUFA/Drivers/Peripheral/SPI.h"
#include "config.h"
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#endif
#if ( DEBOUNCING_DELAY > 0 )
static uint16_t debouncing_time ;
static bool debouncing = false ;
#endif
static uint8_t matrix [MATRIX_ROWS] = {0};
#if ( DEBOUNCING_DELAY > 0 )
static uint8_t matrix_debounce_old [MATRIX_ROWS] = {0};
static uint8_t matrix_debounce_new [MATRIX_ROWS] = {0};
#endif
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
// the keyboard's internal wiring is such that the inputs to the logic are
// a clock signal, and a reset line.
// the output is a single output pin. im bitbanging here, but the SPI controller
// would work normally
//
// the device functions, by using the clock signal to count 128 bits, the lower
// 3 bits of this 7 bit counter are tied to a 1-of-8 multiplexer, this forms
// the columns.
// the upper 4 bits form the rows, and are decoded using bcd to decimal
// decoders, so that 14 out of 16 of the outputs are wired to the rows of the
// matrix. each switch has a diode, such that the row signal feeds into the
// switch, and then into the diode, then into one of the columns into the
// matrix. the reset pin can be used to reset the entire counter.
#define RESET _BV(PB0)
#define SCLK _BV(PB1)
#define SDATA _BV(PB3)
#define LED _BV(PD6)
inline
static
void SCLK_increment(void) {
PORTB &= ~SCLK ;
_delay_us( 4 ) ; // make sure the line is stable
PORTB |= SCLK ;
_delay_us( 4 ) ;
return ;
}
inline
static
void Matrix_Reset(void) {
PORTB |= RESET ;
_delay_us( 4 ) ; // make sure the line is stable
PORTB &= ~RESET ;
return ;
}
inline
static
uint8_t Matrix_ReceiveByte (void) {
uint8_t received = 0 ;
uint8_t temp = 0 ;
for ( uint8_t bit = 0; bit < MATRIX_COLS; ++bit ) {
// toggle the clock
SCLK_increment();
temp = (PINB & SDATA) << 4 ;
received |= temp >> bit ;
}
return received ;
}
inline
static
void Matrix_ThrowByte(void) {
// we use MATRIX_COLS - 1 here because that would put us at 7 clocks
for ( uint8_t bit = 0; bit < MATRIX_COLS - 1; ++bit ) {
// toggle the clock
SCLK_increment();
}
return ;
}
void matrix_init () {
// debug_matrix = 1;
// PB0 (SS) and PB1 (SCLK) set to outputs
DDRB |= RESET | SCLK ;
// PB2, is unused, and PB3 is our serial input
DDRB &= ~SDATA ;
// SS is reset for this board, and is active High
// SCLK is the serial clock and is active High
PORTB &= ~RESET ;
PORTB |= SCLK ;
// led pin
DDRD |= LED ;
PORTD &= ~LED ;
matrix_init_quantum();
//toggle reset, to put the keyboard logic into a known state
Matrix_Reset() ;
}
uint8_t matrix_scan(void) {
// the first byte of the keyboard's output data can be ignored
Matrix_ThrowByte();
#if ( DEBOUNCING_DELAY > 0 )
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
//transfer old debouncing values
matrix_debounce_old[row] = matrix_debounce_new[row] ;
// read new key-states in
matrix_debounce_new[row] = Matrix_ReceiveByte() ;
if ( matrix_debounce_new[row] != matrix_debounce_old[row] ) {
debouncing = true ;
debouncing_time = timer_read() ;
}
}
#else
// without debouncing we simply just read in the raw matrix
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
matrix[row] = Matrix_ReceiveByte ;
}
#endif
#if ( DEBOUNCING_DELAY > 0 )
if ( debouncing && ( timer_elapsed( debouncing_time ) > DEBOUNCING_DELAY ) ) {
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
matrix[row] = matrix_debounce_new[row] ;
}
debouncing = false ;
}
#endif
Matrix_Reset() ;
matrix_scan_quantum() ;
return 1;
}
inline
uint8_t matrix_get_row( uint8_t row ) {
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 01234567\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
print_bin_reverse8(matrix_get_row(row));
print("\n");
}
}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
// as an aside, I used the M0110 converter:
// tmk_core/common/keyboard.c, quantum/matrix.c, and the project layout of the planck
// the online ducmentation starting from :
// https://docs.qmk.fm/#/config_options
// https://docs.qmk.fm/#/understanding_qmk
// and probably a few i forgot....

@ -0,0 +1,52 @@
# HP 46010A
![46010A](https://deskthority.net/w/images/a/a5/HP_46010A_--_top.jpg)
A converter for the eponymous keyboard.
Keyboard Maintainer: [Listofoptions](https://github.com/listofoptions)
Hardware Supported: HP 46010A, Teensy 2.0
Make example for this keyboard (after setting up your build environment):
make converter/HP_46010A:default
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).
to get a matrix created if your board uses a different one (i used the US layout) please see the following gists:
for the matrix itself: https://gist.github.com/listofoptions/cdf70d94767e9c6c027741850a24c568
for the program to generate the matrix: https://gist.github.com/listofoptions/d245e370678024edbe5bed8c8ab17999
to build the actual converter, you are going to need to either splice into the a connector or, use a multi-meter to buzz/ohm out which wires go where.
from the bottom of the pcb the pins are arraged as follows:
4 5 6
3 2 1
connect a six pin modular connector of the 6p6c variaty.
then lop off the other end of the cable, striping the wires inside.
use the ohm-meter to find the corresponding wire for each pin on the bottom of the pcb
the pin meanings are as follows:
1 reset
2 no connection
3 vcc
4 data out
5 clock
6 ground
wire the ground and power pins to ground and 5v power on the teensy (or other avr device of your choice)
connect
on the teensy the connection is as follows
teensy | HP 46010A
----|-----
gnd | gnd (6)
vcc | vcc (3)
PB0 | reset (1)
PB1 | clock (5)
PB3 | data out (4)
gnd | no connection (2) -- optional

@ -0,0 +1,72 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options.
BOOTLOADER = halfkay
# 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 = yes # Console for debug(+400)
COMMAND_ENABLE = no # 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 controls
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.
API_SYSEX_ENABLE = no
SPLIT_KEYBOARD = no
WAIT_FOR_USB = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
LAYOUTS_HAS_RGB = NO
CUSTOM_MATRIX = yes
SRC = matrix.c
Loading…
Cancel
Save