mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
[Keyboard] add molecule (#12601)
Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
parent
23631de191
commit
7b666245d6
254
keyboards/molecule/adns.c
Normal file
254
keyboards/molecule/adns.c
Normal file
@ -0,0 +1,254 @@
|
||||
/* Copyright 2020 Richard Sutherland <rich@brickbots.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 "spi_master.h"
|
||||
#include "adns.h"
|
||||
#include "debug.h"
|
||||
#include "quantum.h"
|
||||
#include "pointing_device.h"
|
||||
#include "adns9800_srom_A6.h"
|
||||
|
||||
// registers
|
||||
#define REG_Product_ID 0x00
|
||||
#define REG_Revision_ID 0x01
|
||||
#define REG_Motion 0x02
|
||||
#define REG_Delta_X_L 0x03
|
||||
#define REG_Delta_X_H 0x04
|
||||
#define REG_Delta_Y_L 0x05
|
||||
#define REG_Delta_Y_H 0x06
|
||||
#define REG_SQUAL 0x07
|
||||
#define REG_Pixel_Sum 0x08
|
||||
#define REG_Maximum_Pixel 0x09
|
||||
#define REG_Minimum_Pixel 0x0a
|
||||
#define REG_Shutter_Lower 0x0b
|
||||
#define REG_Shutter_Upper 0x0c
|
||||
#define REG_Frame_Period_Lower 0x0d
|
||||
#define REG_Frame_Period_Upper 0x0e
|
||||
#define REG_Configuration_I 0x0f
|
||||
#define REG_Configuration_II 0x10
|
||||
#define REG_Frame_Capture 0x12
|
||||
#define REG_SROM_Enable 0x13
|
||||
#define REG_Run_Downshift 0x14
|
||||
#define REG_Rest1_Rate 0x15
|
||||
#define REG_Rest1_Downshift 0x16
|
||||
#define REG_Rest2_Rate 0x17
|
||||
#define REG_Rest2_Downshift 0x18
|
||||
#define REG_Rest3_Rate 0x19
|
||||
#define REG_Frame_Period_Max_Bound_Lower 0x1a
|
||||
#define REG_Frame_Period_Max_Bound_Upper 0x1b
|
||||
#define REG_Frame_Period_Min_Bound_Lower 0x1c
|
||||
#define REG_Frame_Period_Min_Bound_Upper 0x1d
|
||||
#define REG_Shutter_Max_Bound_Lower 0x1e
|
||||
#define REG_Shutter_Max_Bound_Upper 0x1f
|
||||
#define REG_LASER_CTRL0 0x20
|
||||
#define REG_Observation 0x24
|
||||
#define REG_Data_Out_Lower 0x25
|
||||
#define REG_Data_Out_Upper 0x26
|
||||
#define REG_SROM_ID 0x2a
|
||||
#define REG_Lift_Detection_Thr 0x2e
|
||||
#define REG_Configuration_V 0x2f
|
||||
#define REG_Configuration_IV 0x39
|
||||
#define REG_Power_Up_Reset 0x3a
|
||||
#define REG_Shutdown 0x3b
|
||||
#define REG_Inverse_Product_ID 0x3f
|
||||
#define REG_Motion_Burst 0x50
|
||||
#define REG_SROM_Load_Burst 0x62
|
||||
#define REG_Pixel_Burst 0x64
|
||||
|
||||
// pins
|
||||
#define NCS F7
|
||||
|
||||
extern const uint16_t firmware_length;
|
||||
extern const uint8_t firmware_data[];
|
||||
|
||||
enum motion_burst_propertr{
|
||||
motion = 0,
|
||||
observation,
|
||||
delta_x_l,
|
||||
delta_x_h,
|
||||
delta_y_l,
|
||||
delta_y_h,
|
||||
squal,
|
||||
pixel_sum,
|
||||
maximum_pixel,
|
||||
minimum_pixel,
|
||||
shutter_upper,
|
||||
shutter_lower,
|
||||
frame_period_upper,
|
||||
frame_period_lower,
|
||||
end_data
|
||||
};
|
||||
|
||||
void adns_begin(void){
|
||||
spi_start(NCS, false, 3, 8);
|
||||
}
|
||||
|
||||
void adns_end(void){
|
||||
spi_stop();
|
||||
}
|
||||
|
||||
void adns_write(uint8_t reg_addr, uint8_t data){
|
||||
|
||||
adns_begin();
|
||||
//send address of the register, with MSBit = 1 to indicate it's a write
|
||||
spi_write(reg_addr | 0x80 );
|
||||
spi_write(data);
|
||||
|
||||
// tSCLK-NCS for write operation
|
||||
wait_us(20);
|
||||
|
||||
|
||||
// tSWW/tSWR (=120us) minus tSCLK-NCS. Could be shortened, but is looks like a safe lower bound
|
||||
wait_us(100);
|
||||
adns_end();
|
||||
}
|
||||
|
||||
uint8_t adns_read(uint8_t reg_addr){
|
||||
|
||||
|
||||
adns_begin();
|
||||
// send adress of the register, with MSBit = 0 to indicate it's a read
|
||||
spi_write(reg_addr & 0x7f );
|
||||
uint8_t data = spi_read();
|
||||
|
||||
// tSCLK-NCS for read operation is 120ns
|
||||
wait_us(1);
|
||||
|
||||
|
||||
// tSRW/tSRR (=20us) minus tSCLK-NCS
|
||||
wait_us(19);
|
||||
|
||||
adns_end();
|
||||
return data;
|
||||
}
|
||||
|
||||
void pointing_device_init(void) {
|
||||
dprint("STARTING INTI\n");
|
||||
|
||||
spi_init();
|
||||
// reset serial port
|
||||
adns_begin();
|
||||
adns_end();
|
||||
|
||||
// reboot
|
||||
adns_write(REG_Power_Up_Reset, 0x5a);
|
||||
wait_ms(50);
|
||||
// read registers and discard
|
||||
adns_read(REG_Motion);
|
||||
adns_read(REG_Delta_X_L);
|
||||
adns_read(REG_Delta_X_H);
|
||||
adns_read(REG_Delta_Y_L);
|
||||
adns_read(REG_Delta_Y_H);
|
||||
|
||||
// upload firmware
|
||||
|
||||
// set the configuration_IV register in 3k firmware mode
|
||||
// bit 1 = 1 for 3k mode, other bits are reserved
|
||||
adns_write(REG_Configuration_IV, 0x02);
|
||||
|
||||
// write 0x1d in SROM_enable reg for initializing
|
||||
adns_write(REG_SROM_Enable, 0x1d);
|
||||
|
||||
// wait for more than one frame period
|
||||
// assume that the frame rate is as low as 100fps... even if it should never be that low
|
||||
wait_ms(10);
|
||||
|
||||
// write 0x18 to SROM_enable to start SROM download
|
||||
adns_write(REG_SROM_Enable, 0x18);
|
||||
|
||||
// write the SROM file (=firmware data)
|
||||
|
||||
// write burst destination adress
|
||||
adns_begin();
|
||||
spi_write(REG_SROM_Load_Burst | 0x80);
|
||||
wait_us(15);
|
||||
// send all bytes of the firmware
|
||||
unsigned char c;
|
||||
for(int i = 0; i < firmware_length; i++){
|
||||
c = (unsigned char)pgm_read_byte(firmware_data + i);
|
||||
spi_write(c);
|
||||
wait_us(15);
|
||||
}
|
||||
|
||||
adns_end();
|
||||
wait_ms(10);
|
||||
|
||||
// enable laser(bit 0 = 0b), in normal mode (bits 3,2,1 = 000b)
|
||||
// reading the actual value of the register is important because the real
|
||||
// default value is different from what is said in the datasheet, and if you
|
||||
// change the reserved bytes (like by writing 0x00...) it would not work.
|
||||
uint8_t laser_ctrl0 = adns_read(REG_LASER_CTRL0);
|
||||
adns_write(REG_LASER_CTRL0, laser_ctrl0 & 0xf0);
|
||||
|
||||
wait_ms(1);
|
||||
|
||||
// set the configuration_I register to set the CPI
|
||||
// 0x01 = 50, minimum
|
||||
// 0x44 = 3400, default
|
||||
// 0x8e = 7100
|
||||
// 0xA4 = 8200, maximum
|
||||
adns_write(REG_Configuration_I, 0x10);
|
||||
|
||||
wait_ms(100);
|
||||
dprint("INIT ENDED\n");
|
||||
}
|
||||
|
||||
int16_t convertDeltaToInt(uint8_t high, uint8_t low){
|
||||
|
||||
// join bytes into twos compliment
|
||||
//int16_t twos_comp = (high << 8) | low;
|
||||
//return twos_comp;
|
||||
return (high << 8) | low;
|
||||
}
|
||||
|
||||
motion_delta_t readSensor(void) {
|
||||
adns_begin();
|
||||
|
||||
// read from Motion_Burst to enable burt mode
|
||||
spi_write(REG_Motion_Burst & 0x7f);
|
||||
|
||||
// Wait one frame per docs, thanks u/kbjunky
|
||||
wait_us(100);
|
||||
uint8_t burst_data[pixel_sum];
|
||||
|
||||
for (int i = 0; i < pixel_sum; ++i) {
|
||||
burst_data[i] = spi_read();
|
||||
}
|
||||
|
||||
uint16_t delta_x = convertDeltaToInt(burst_data[delta_x_h], burst_data[delta_x_l]);
|
||||
uint16_t delta_y = convertDeltaToInt(burst_data[delta_y_h], burst_data[delta_y_l]);
|
||||
// Only consider the MSB for motion as this byte has other status bits
|
||||
uint8_t motion_ind = burst_data[motion] & 0b10000000;
|
||||
adns_end();
|
||||
|
||||
motion_delta_t delta = {delta_x, delta_y, motion_ind};
|
||||
return delta;
|
||||
}
|
||||
|
||||
void pointing_device_task(void) {
|
||||
motion_delta_t delta = readSensor();
|
||||
|
||||
report_mouse_t report = pointing_device_get_report();
|
||||
|
||||
if(delta.motion_ind) {
|
||||
// clamp deltas from -127 to 127
|
||||
report.x = delta.delta_x < -127 ? -127 : delta.delta_x > 127 ? 127 : delta.delta_x;
|
||||
report.x = -report.x;
|
||||
report.y = delta.delta_y < -127 ? -127 : delta.delta_y > 127 ? 127 : delta.delta_y;
|
||||
}
|
||||
|
||||
pointing_device_set_report(report);
|
||||
pointing_device_send();
|
||||
}
|
36
keyboards/molecule/adns.h
Normal file
36
keyboards/molecule/adns.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright 2020 Richard Sutherland <rich@brickbots.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
|
||||
|
||||
void adns_begin(void);
|
||||
|
||||
void adns_end(void);
|
||||
|
||||
void adns_write(uint8_t reg_addr, uint8_t data);
|
||||
|
||||
uint8_t adns_read(uint8_t reg_addr);
|
||||
|
||||
|
||||
int16_t convertDeltaToInt(uint8_t high, uint8_t low);
|
||||
|
||||
struct _motion_delta {
|
||||
int16_t delta_x;
|
||||
int16_t delta_y;
|
||||
int8_t motion_ind;
|
||||
};
|
||||
typedef struct _motion_delta motion_delta_t;
|
||||
|
||||
motion_delta_t readSensor(void);
|
3081
keyboards/molecule/adns9800_srom_A6.h
Normal file
3081
keyboards/molecule/adns9800_srom_A6.h
Normal file
File diff suppressed because it is too large
Load Diff
159
keyboards/molecule/config.h
Executable file
159
keyboards/molecule/config.h
Executable file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
Copyright 2021 bbrfkr
|
||||
|
||||
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"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x0000
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER bbrfkr
|
||||
#define PRODUCT molecule
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 4
|
||||
#define MATRIX_COLS 10
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*
|
||||
* Change this to how you wired your keyboard
|
||||
* COLS: AVR pins used for columns, left to right
|
||||
* ROWS: AVR pins used for rows, top to bottom
|
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||
*
|
||||
*/
|
||||
#define MATRIX_ROW_PINS { F4, F5, F6, B6 }
|
||||
#define MATRIX_COL_PINS { D3, D2, D1, D0, D4, C6, D7, E6, B4, B5 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW, ROW2COL */
|
||||
#define DIODE_DIRECTION ROW2COL
|
||||
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
// #define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6
|
||||
// #define USE_SERIAL
|
||||
|
||||
//#define BACKLIGHT_PIN B7
|
||||
//#define BACKLIGHT_LEVELS 3
|
||||
//#define BACKLIGHT_BREATHING
|
||||
|
||||
/* underglow LED */
|
||||
// #define RGB_DI_PIN D3
|
||||
// #ifdef RGBLIGHT_ENABLE
|
||||
// # define RGBLED_NUM 10
|
||||
// # define RGBLED_SPLIT { 5, 5 }
|
||||
// # define RGBLIGHT_ANIMATIONS
|
||||
// #endif
|
||||
|
||||
//#define RGB_DI_PIN E2
|
||||
//#ifdef RGB_DI_PIN
|
||||
//# define RGBLED_NUM 16
|
||||
//# define RGBLIGHT_HUE_STEP 8
|
||||
//# define RGBLIGHT_SAT_STEP 8
|
||||
//# define RGBLIGHT_VAL_STEP 8
|
||||
//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
/*== all animations enable ==*/
|
||||
//# define RGBLIGHT_ANIMATIONS
|
||||
/*== or choose animations ==*/
|
||||
//# define RGBLIGHT_EFFECT_BREATHING
|
||||
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
//# define RGBLIGHT_EFFECT_SNAKE
|
||||
//# define RGBLIGHT_EFFECT_KNIGHT
|
||||
//# define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
//# define RGBLIGHT_EFFECT_RGB_TEST
|
||||
//# define RGBLIGHT_EFFECT_ALTERNATING
|
||||
/*== customize breathing effect ==*/
|
||||
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
|
||||
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
|
||||
/*==== use exp() and sin() ====*/
|
||||
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
|
||||
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
|
||||
//#endif
|
||||
|
||||
|
||||
/* OLED */
|
||||
#define OLED_TIMEOUT 0
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
|
||||
*/
|
||||
//#define GRAVE_ESC_CTRL_OVERRIDE
|
||||
|
||||
/*
|
||||
* Force NKRO
|
||||
*
|
||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
||||
* makefile for this to work.)
|
||||
*
|
||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
||||
* until the next keyboard reset.
|
||||
*
|
||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
||||
* fully operational during normal computer usage.
|
||||
*
|
||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
||||
* power-up.
|
||||
*
|
||||
*/
|
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
|
||||
/* disable these deprecated features by default */
|
||||
#define NO_ACTION_MACRO
|
||||
#define NO_ACTION_FUNCTION
|
||||
|
||||
/* Bootmagic Lite key configuration */
|
||||
//#define BOOTMAGIC_LITE_ROW 0
|
||||
//#define BOOTMAGIC_LITE_COLUMN 0
|
215
keyboards/molecule/info.json
Executable file
215
keyboards/molecule/info.json
Executable file
@ -0,0 +1,215 @@
|
||||
{
|
||||
"keyboard_name": "molecule",
|
||||
"url": "https://github.com/bbrfkr/keyboards/tree/master/molecule",
|
||||
"maintainer": "bbrfkr",
|
||||
"width": 14.75,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{
|
||||
"label":"E",
|
||||
"x":2,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"label":"I",
|
||||
"x":11.75,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"label":"W",
|
||||
"x":1,
|
||||
"y":0.25
|
||||
},
|
||||
{
|
||||
"label":"O",
|
||||
"x":12.75,
|
||||
"y":0.25
|
||||
},
|
||||
{
|
||||
"label":"R",
|
||||
"x":3,
|
||||
"y":0.5
|
||||
},
|
||||
{
|
||||
"label":"U",
|
||||
"x":10.75,
|
||||
"y":0.5
|
||||
},
|
||||
{
|
||||
"label":"T",
|
||||
"x":4,
|
||||
"y":0.75
|
||||
},
|
||||
{
|
||||
"label":"Y",
|
||||
"x":9.75,
|
||||
"y":0.75
|
||||
},
|
||||
{
|
||||
"label":"Q",
|
||||
"x":0,
|
||||
"y":1
|
||||
},
|
||||
{
|
||||
"label":"D",
|
||||
"x":2,
|
||||
"y":1
|
||||
},
|
||||
{
|
||||
"label":"K",
|
||||
"x":11.75,
|
||||
"y":1
|
||||
},
|
||||
{
|
||||
"label":"P",
|
||||
"x":13.75,
|
||||
"y":1
|
||||
},
|
||||
{
|
||||
"label":"S",
|
||||
"x":1,
|
||||
"y":1.25
|
||||
},
|
||||
{
|
||||
"label":"L",
|
||||
"x":12.75,
|
||||
"y":1.25
|
||||
},
|
||||
{
|
||||
"label":"F",
|
||||
"x":3,
|
||||
"y":1.5
|
||||
},
|
||||
{
|
||||
"label":"J",
|
||||
"x":10.75,
|
||||
"y":1.5
|
||||
},
|
||||
{
|
||||
"label":"G",
|
||||
"x":4,
|
||||
"y":1.75
|
||||
},
|
||||
{
|
||||
"label":"H",
|
||||
"x":9.75,
|
||||
"y":1.75
|
||||
},
|
||||
{
|
||||
"label":"A",
|
||||
"x":0,
|
||||
"y":2
|
||||
},
|
||||
{
|
||||
"label":"C",
|
||||
"x":2,
|
||||
"y":2
|
||||
},
|
||||
{
|
||||
"label":",",
|
||||
"x":11.75,
|
||||
"y":2
|
||||
},
|
||||
{
|
||||
"label":";",
|
||||
"x":13.75,
|
||||
"y":2
|
||||
},
|
||||
{
|
||||
"label":"X",
|
||||
"x":1,
|
||||
"y":2.25
|
||||
},
|
||||
{
|
||||
"label":".",
|
||||
"x":12.75,
|
||||
"y":2.25
|
||||
},
|
||||
{
|
||||
"label":"V",
|
||||
"x":3,
|
||||
"y":2.5
|
||||
},
|
||||
{
|
||||
"label":"M",
|
||||
"x":10.75,
|
||||
"y":2.5
|
||||
},
|
||||
{
|
||||
"label":"B",
|
||||
"x":4,
|
||||
"y":2.75
|
||||
},
|
||||
{
|
||||
"label":"N",
|
||||
"x":9.75,
|
||||
"y":2.75
|
||||
},
|
||||
{
|
||||
"label":"Z",
|
||||
"x":0,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"Shift",
|
||||
"x":2,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"Alt",
|
||||
"x":5.25,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"Super",
|
||||
"x":8.5,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"Shift",
|
||||
"x":11.75,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"/",
|
||||
"x":13.75,
|
||||
"y":3
|
||||
},
|
||||
{
|
||||
"label":"Ctrl",
|
||||
"x":1,
|
||||
"y":3.25
|
||||
},
|
||||
{
|
||||
"label":"Space",
|
||||
"x":6.25,
|
||||
"y":3.25,
|
||||
"h":1.5
|
||||
},
|
||||
{
|
||||
"label":"Enter",
|
||||
"x":7.5,
|
||||
"y":3.25,
|
||||
"h":1.5
|
||||
},
|
||||
{
|
||||
"label":"Ctrl",
|
||||
"x":12.75,
|
||||
"y":3.25
|
||||
},
|
||||
{
|
||||
"label":"Lower",
|
||||
"x":5.25,
|
||||
"y":4
|
||||
},
|
||||
{
|
||||
"label":"Raise",
|
||||
"x":8.5,
|
||||
"y":4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
39
keyboards/molecule/keymaps/default/keymap.c
Executable file
39
keyboards/molecule/keymaps/default/keymap.c
Executable file
@ -0,0 +1,39 @@
|
||||
/* Copyright 2021 bbrfkr
|
||||
*
|
||||
* 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
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_QWERTY_BASE,
|
||||
_EUCALYN_BASE,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_FN,
|
||||
};
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
QMKBEST = SAFE_RANGE,
|
||||
QMKURL
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_QWERTY_BASE] = LAYOUT(KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LCTL, KC_LSFT, MO(2), KC_LALT, KC_SPC, KC_ENT, KC_RGUI, MO(3), KC_RSFT, KC_RCTL),
|
||||
[_EUCALYN_BASE] = LAYOUT(KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN, KC_M, KC_R, KC_D, KC_Y, KC_P, KC_A, KC_O, KC_E, KC_I, KC_U, KC_G, KC_T, KC_K, KC_S, KC_N, KC_Z, KC_X, KC_C, KC_V, KC_F, KC_B, KC_H, KC_J, KC_L, KC_SLSH, KC_LCTL, KC_LSFT, MO(2), KC_LALT, KC_SPC, KC_ENT, KC_RGUI, MO(3), KC_RSFT, KC_RCTL),
|
||||
[_LOWER] = LAYOUT(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_F2, KC_F3, KC_WH_U, KC_F4, KC_F5, KC_F6, KC_F7, KC_UP, KC_F8, KC_F9, KC_F1, KC_MS_BTN2, KC_WH_D, KC_MS_BTN1, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_RGHT, KC_F10, KC_LCTL, KC_LSFT, KC_TRNS, KC_LALT, KC_SPC, KC_ENT, KC_RGUI, MO(4), KC_RSFT, KC_RCTL),
|
||||
[_RAISE] = LAYOUT(KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_ESC, KC_DEL, KC_BSPC, KC_GRV, KC_BSLS, KC_MINS, KC_EQL, KC_QUOT, KC_LCBR, KC_RCBR, KC_CAPS, KC_TAB, KC_PSCR, KC_TILD, KC_PIPE, KC_UNDS, KC_PLUS, KC_DQUO, KC_LBRC, KC_RBRC, KC_LCTL, KC_LSFT, MO(4), KC_LALT, KC_SPC, KC_ENT, KC_RGUI, KC_TRNS, KC_RSFT, KC_RCTL),
|
||||
[_FN] = LAYOUT(KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRIU, KC_VOLD, KC_NO, KC_NO, KC_NO, DF(0), DF(1), KC_NO, KC_NO, KC_NO, KC_BRID, KC_MUTE, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LSFT, KC_TRNS, KC_LALT, KC_SPC, KC_ENT, KC_RGUI, KC_TRNS, KC_RSFT, KC_RCTL)
|
||||
};
|
1
keyboards/molecule/keymaps/default/readme.md
Executable file
1
keyboards/molecule/keymaps/default/readme.md
Executable file
@ -0,0 +1 @@
|
||||
# The default keymap for molecule
|
17
keyboards/molecule/molecule.c
Executable file
17
keyboards/molecule/molecule.c
Executable file
@ -0,0 +1,17 @@
|
||||
/* Copyright 2021 bbrfkr
|
||||
*
|
||||
* 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 "molecule.h"
|
40
keyboards/molecule/molecule.h
Executable file
40
keyboards/molecule/molecule.h
Executable file
@ -0,0 +1,40 @@
|
||||
/* Copyright 2021 bbrfkr
|
||||
*
|
||||
* 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"
|
||||
|
||||
/* This is a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \
|
||||
L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \
|
||||
L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \
|
||||
L30, L31, L32, L33, L34, R30, R31, R32, R33, R34 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, R00, R01, R02, R03, R04 }, \
|
||||
{ L10, L11, L12, L13, L14, R10, R11, R12, R13, R14 }, \
|
||||
{ L20, L21, L22, L23, L24, R20, R21, R22, R23, R24 }, \
|
||||
{ L30, L31, L32, L33, L34, R30, R31, R32, R33, R34 }, \
|
||||
}
|
21
keyboards/molecule/readme.md
Executable file
21
keyboards/molecule/readme.md
Executable file
@ -0,0 +1,21 @@
|
||||
# molecule
|
||||
|
||||
[![molecule](https://imgur.com/uYCeS4Y)](https://i.imgur.com/uYCeS4Yh.jpg)
|
||||
|
||||
A 40 keys keyboard with trackball.
|
||||
|
||||
* Keyboard Maintainer: [bbrfkr](https://github.com/bbrfkr) [@bbrfkr](https://twitter.com/bbrfkr)
|
||||
* Hardware Supported: molecule PCB, Pro Micro
|
||||
* Hardware Availability: https://bbrfkr.booth.pm/
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make molecule:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make molecule: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).
|
||||
|
||||
This keyboard project includes [aball](https://github.com/brickbots/aball) project source code partially.
|
27
keyboards/molecule/rules.mk
Executable file
27
keyboards/molecule/rules.mk
Executable file
@ -0,0 +1,27 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
NKRO_ENABLE = no # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
|
||||
# Add trackball support
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
SRC += adns.c
|
||||
QUANTUM_LIB_SRC += spi_master.c
|
Loading…
Reference in New Issue
Block a user