commit
5272218ac9
@ -0,0 +1,10 @@
|
||||
.sidebar-toggle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: auto;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.search {
|
||||
margin-top: 40px;
|
||||
}
|
@ -1,232 +0,0 @@
|
||||
/*
|
||||
* TWIlib.c
|
||||
*
|
||||
* Created: 6/01/2014 10:41:33 PM
|
||||
* Author: Chris Herring
|
||||
* http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "TWIlib.h"
|
||||
#include "util/delay.h"
|
||||
|
||||
void TWIInit()
|
||||
{
|
||||
TWIInfo.mode = Ready;
|
||||
TWIInfo.errorCode = 0xFF;
|
||||
TWIInfo.repStart = 0;
|
||||
// Set pre-scalers (no pre-scaling)
|
||||
TWSR = 0;
|
||||
// Set bit rate
|
||||
TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
|
||||
// Enable TWI and interrupt
|
||||
TWCR = (1 << TWIE) | (1 << TWEN);
|
||||
}
|
||||
|
||||
uint8_t isTWIReady()
|
||||
{
|
||||
if ( (TWIInfo.mode == Ready) | (TWIInfo.mode == RepeatedStartSent) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart)
|
||||
{
|
||||
if (dataLen <= TXMAXBUFLEN)
|
||||
{
|
||||
// Wait until ready
|
||||
while (!isTWIReady()) {_delay_us(1);}
|
||||
// Set repeated start mode
|
||||
TWIInfo.repStart = repStart;
|
||||
// Copy data into the transmit buffer
|
||||
uint8_t *data = (uint8_t *)TXdata;
|
||||
for (int i = 0; i < dataLen; i++)
|
||||
{
|
||||
TWITransmitBuffer[i] = data[i];
|
||||
}
|
||||
// Copy transmit info to global variables
|
||||
TXBuffLen = dataLen;
|
||||
TXBuffIndex = 0;
|
||||
|
||||
// If a repeated start has been sent, then devices are already listening for an address
|
||||
// and another start does not need to be sent.
|
||||
if (TWIInfo.mode == RepeatedStartSent)
|
||||
{
|
||||
TWIInfo.mode = Initializing;
|
||||
TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer
|
||||
TWISendTransmit(); // Send the data
|
||||
}
|
||||
else // Otherwise, just send the normal start signal to begin transmission.
|
||||
{
|
||||
TWIInfo.mode = Initializing;
|
||||
TWISendStart();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1; // return an error if data length is longer than buffer
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t TWIReadData(uint8_t TWIaddr, uint8_t bytesToRead, uint8_t repStart)
|
||||
{
|
||||
// Check if number of bytes to read can fit in the RXbuffer
|
||||
if (bytesToRead < RXMAXBUFLEN)
|
||||
{
|
||||
// Reset buffer index and set RXBuffLen to the number of bytes to read
|
||||
RXBuffIndex = 0;
|
||||
RXBuffLen = bytesToRead;
|
||||
// Create the one value array for the address to be transmitted
|
||||
uint8_t TXdata[1];
|
||||
// Shift the address and AND a 1 into the read write bit (set to write mode)
|
||||
TXdata[0] = (TWIaddr << 1) | 0x01;
|
||||
// Use the TWITransmitData function to initialize the transfer and address the slave
|
||||
TWITransmitData(TXdata, 1, repStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ISR (TWI_vect)
|
||||
{
|
||||
switch (TWI_STATUS)
|
||||
{
|
||||
// ----\/ ---- MASTER TRANSMITTER OR WRITING ADDRESS ----\/ ---- //
|
||||
case TWI_MT_SLAW_ACK: // SLA+W transmitted and ACK received
|
||||
// Set mode to Master Transmitter
|
||||
TWIInfo.mode = MasterTransmitter;
|
||||
case TWI_START_SENT: // Start condition has been transmitted
|
||||
case TWI_MT_DATA_ACK: // Data byte has been transmitted, ACK received
|
||||
if (TXBuffIndex < TXBuffLen) // If there is more data to send
|
||||
{
|
||||
TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer
|
||||
TWIInfo.errorCode = TWI_NO_RELEVANT_INFO;
|
||||
TWISendTransmit(); // Send the data
|
||||
}
|
||||
// This transmission is complete however do not release bus yet
|
||||
else if (TWIInfo.repStart)
|
||||
{
|
||||
TWIInfo.errorCode = 0xFF;
|
||||
TWISendStart();
|
||||
}
|
||||
// All transmissions are complete, exit
|
||||
else
|
||||
{
|
||||
TWIInfo.mode = Ready;
|
||||
TWIInfo.errorCode = 0xFF;
|
||||
TWISendStop();
|
||||
}
|
||||
break;
|
||||
|
||||
// ----\/ ---- MASTER RECEIVER ----\/ ---- //
|
||||
|
||||
case TWI_MR_SLAR_ACK: // SLA+R has been transmitted, ACK has been received
|
||||
// Switch to Master Receiver mode
|
||||
TWIInfo.mode = MasterReceiver;
|
||||
// If there is more than one byte to be read, receive data byte and return an ACK
|
||||
if (RXBuffIndex < RXBuffLen-1)
|
||||
{
|
||||
TWIInfo.errorCode = TWI_NO_RELEVANT_INFO;
|
||||
TWISendACK();
|
||||
}
|
||||
// Otherwise when a data byte (the only data byte) is received, return NACK
|
||||
else
|
||||
{
|
||||
TWIInfo.errorCode = TWI_NO_RELEVANT_INFO;
|
||||
TWISendNACK();
|
||||
}
|
||||
break;
|
||||
|
||||
case TWI_MR_DATA_ACK: // Data has been received, ACK has been transmitted.
|
||||
|
||||
/// -- HANDLE DATA BYTE --- ///
|
||||
TWIReceiveBuffer[RXBuffIndex++] = TWDR;
|
||||
// If there is more than one byte to be read, receive data byte and return an ACK
|
||||
if (RXBuffIndex < RXBuffLen-1)
|
||||
{
|
||||
TWIInfo.errorCode = TWI_NO_RELEVANT_INFO;
|
||||
TWISendACK();
|
||||
}
|
||||
// Otherwise when a data byte (the only data byte) is received, return NACK
|
||||
else
|
||||
{
|
||||
TWIInfo.errorCode = TWI_NO_RELEVANT_INFO;
|
||||
TWISendNACK();
|
||||
}
|
||||
break;
|
||||
|
||||
case TWI_MR_DATA_NACK: // Data byte has been received, NACK has been transmitted. End of transmission.
|
||||
|
||||
/// -- HANDLE DATA BYTE --- ///
|
||||
TWIReceiveBuffer[RXBuffIndex++] = TWDR;
|
||||
// This transmission is complete however do not release bus yet
|
||||
if (TWIInfo.repStart)
|
||||
{
|
||||
TWIInfo.errorCode = 0xFF;
|
||||
TWISendStart();
|
||||
}
|
||||
// All transmissions are complete, exit
|
||||
else
|
||||
{
|
||||
TWIInfo.mode = Ready;
|
||||
TWIInfo.errorCode = 0xFF;
|
||||
TWISendStop();
|
||||
}
|
||||
break;
|
||||
|
||||
// ----\/ ---- MT and MR common ----\/ ---- //
|
||||
|
||||
case TWI_MR_SLAR_NACK: // SLA+R transmitted, NACK received
|
||||
case TWI_MT_SLAW_NACK: // SLA+W transmitted, NACK received
|
||||
case TWI_MT_DATA_NACK: // Data byte has been transmitted, NACK received
|
||||
case TWI_LOST_ARBIT: // Arbitration has been lost
|
||||
// Return error and send stop and set mode to ready
|
||||
if (TWIInfo.repStart)
|
||||
{
|
||||
TWIInfo.errorCode = TWI_STATUS;
|
||||
TWISendStart();
|
||||
}
|
||||
// All transmissions are complete, exit
|
||||
else
|
||||
{
|
||||
TWIInfo.mode = Ready;
|
||||
TWIInfo.errorCode = TWI_STATUS;
|
||||
TWISendStop();
|
||||
}
|
||||
break;
|
||||
case TWI_REP_START_SENT: // Repeated start has been transmitted
|
||||
// Set the mode but DO NOT clear TWINT as the next data is not yet ready
|
||||
TWIInfo.mode = RepeatedStartSent;
|
||||
break;
|
||||
|
||||
// ----\/ ---- SLAVE RECEIVER ----\/ ---- //
|
||||
|
||||
// TODO IMPLEMENT SLAVE RECEIVER FUNCTIONALITY
|
||||
|
||||
// ----\/ ---- SLAVE TRANSMITTER ----\/ ---- //
|
||||
|
||||
// TODO IMPLEMENT SLAVE TRANSMITTER FUNCTIONALITY
|
||||
|
||||
// ----\/ ---- MISCELLANEOUS STATES ----\/ ---- //
|
||||
case TWI_NO_RELEVANT_INFO: // It is not really possible to get into this ISR on this condition
|
||||
// Rather, it is there to be manually set between operations
|
||||
break;
|
||||
case TWI_ILLEGAL_START_STOP: // Illegal START/STOP, abort and return error
|
||||
TWIInfo.errorCode = TWI_ILLEGAL_START_STOP;
|
||||
TWIInfo.mode = Ready;
|
||||
TWISendStop();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* TWIlib.h
|
||||
*
|
||||
* Created: 6/01/2014 10:38:42 PM
|
||||
* Author: Chris Herring
|
||||
* http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TWILIB_H_
|
||||
#define TWILIB_H_
|
||||
// TWI bit rate (was 100000)
|
||||
#define TWI_FREQ 400000
|
||||
// Get TWI status
|
||||
#define TWI_STATUS (TWSR & 0xF8)
|
||||
// Transmit buffer length
|
||||
#define TXMAXBUFLEN 20
|
||||
// Receive buffer length
|
||||
#define RXMAXBUFLEN 20
|
||||
// Global transmit buffer
|
||||
uint8_t TWITransmitBuffer[TXMAXBUFLEN];
|
||||
// Global receive buffer
|
||||
volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN];
|
||||
// Buffer indexes
|
||||
volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time.
|
||||
int RXBuffIndex; // Current index in the receive buffer
|
||||
// Buffer lengths
|
||||
int TXBuffLen; // The total length of the transmit buffer
|
||||
int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN)
|
||||
|
||||
typedef enum {
|
||||
Ready,
|
||||
Initializing,
|
||||
RepeatedStartSent,
|
||||
MasterTransmitter,
|
||||
MasterReceiver,
|
||||
SlaceTransmitter,
|
||||
SlaveReciever
|
||||
} TWIMode;
|
||||
|
||||
typedef struct TWIInfoStruct{
|
||||
TWIMode mode;
|
||||
uint8_t errorCode;
|
||||
uint8_t repStart;
|
||||
}TWIInfoStruct;
|
||||
TWIInfoStruct TWIInfo;
|
||||
|
||||
|
||||
// TWI Status Codes
|
||||
#define TWI_START_SENT 0x08 // Start sent
|
||||
#define TWI_REP_START_SENT 0x10 // Repeated Start sent
|
||||
// Master Transmitter Mode
|
||||
#define TWI_MT_SLAW_ACK 0x18 // SLA+W sent and ACK received
|
||||
#define TWI_MT_SLAW_NACK 0x20 // SLA+W sent and NACK received
|
||||
#define TWI_MT_DATA_ACK 0x28 // DATA sent and ACK received
|
||||
#define TWI_MT_DATA_NACK 0x30 // DATA sent and NACK received
|
||||
// Master Receiver Mode
|
||||
#define TWI_MR_SLAR_ACK 0x40 // SLA+R sent, ACK received
|
||||
#define TWI_MR_SLAR_NACK 0x48 // SLA+R sent, NACK received
|
||||
#define TWI_MR_DATA_ACK 0x50 // Data received, ACK returned
|
||||
#define TWI_MR_DATA_NACK 0x58 // Data received, NACK returned
|
||||
|
||||
// Miscellaneous States
|
||||
#define TWI_LOST_ARBIT 0x38 // Arbitration has been lost
|
||||
#define TWI_NO_RELEVANT_INFO 0xF8 // No relevant information available
|
||||
#define TWI_ILLEGAL_START_STOP 0x00 // Illegal START or STOP condition has been detected
|
||||
#define TWI_SUCCESS 0xFF // Successful transfer, this state is impossible from TWSR as bit2 is 0 and read only
|
||||
|
||||
|
||||
#define TWISendStart() (TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN)|(1<<TWIE)) // Send the START signal, enable interrupts and TWI, clear TWINT flag to resume transfer.
|
||||
#define TWISendStop() (TWCR = (1<<TWINT)|(1<<TWSTO)|(1<<TWEN)|(1<<TWIE)) // Send the STOP signal, enable interrupts and TWI, clear TWINT flag.
|
||||
#define TWISendTransmit() (TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWIE)) // Used to resume a transfer, clear TWINT and ensure that TWI and interrupts are enabled.
|
||||
#define TWISendACK() (TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWIE)|(1<<TWEA)) // FOR MR mode. Resume a transfer, ensure that TWI and interrupts are enabled and respond with an ACK if the device is addressed as a slave or after it receives a byte.
|
||||
#define TWISendNACK() (TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWIE)) // FOR MR mode. Resume a transfer, ensure that TWI and interrupts are enabled but DO NOT respond with an ACK if the device is addressed as a slave or after it receives a byte.
|
||||
|
||||
// Function declarations
|
||||
uint8_t TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart);
|
||||
void TWIInit(void);
|
||||
uint8_t TWIReadData(uint8_t TWIaddr, uint8_t bytesToRead, uint8_t repStart);
|
||||
uint8_t isTWIReady(void);
|
||||
|
||||
#endif // TWICOMMS_H_
|
@ -0,0 +1,149 @@
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
|
||||
#include "i2c_master.h"
|
||||
|
||||
#define F_SCL 400000UL // SCL frequency
|
||||
#define Prescaler 1
|
||||
#define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16 ) / 2)
|
||||
|
||||
void i2c_init(void)
|
||||
{
|
||||
TWBR = (uint8_t)TWBR_val;
|
||||
}
|
||||
|
||||
uint8_t i2c_start(uint8_t address)
|
||||
{
|
||||
// reset TWI control register
|
||||
TWCR = 0;
|
||||
// transmit START condition
|
||||
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||
// wait for end of transmission
|
||||
while( !(TWCR & (1<<TWINT)) );
|
||||
|
||||
// check if the start condition was successfully transmitted
|
||||
if((TWSR & 0xF8) != TW_START){ return 1; }
|
||||
|
||||
// load slave address into data register
|
||||
TWDR = address;
|
||||
// start transmission of address
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
// wait for end of transmission
|
||||
while( !(TWCR & (1<<TWINT)) );
|
||||
|
||||
// check if the device has acknowledged the READ / WRITE mode
|
||||
uint8_t twst = TW_STATUS & 0xF8;
|
||||
if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_write(uint8_t data)
|
||||
{
|
||||
// load data into data register
|
||||
TWDR = data;
|
||||
// start transmission of data
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
// wait for end of transmission
|
||||
while( !(TWCR & (1<<TWINT)) );
|
||||
|
||||
if( (TWSR & 0xF8) != TW_MT_DATA_ACK ){ return 1; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_read_ack(void)
|
||||
{
|
||||
|
||||
// start TWI module and acknowledge data after reception
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA);
|
||||
// wait for end of transmission
|
||||
while( !(TWCR & (1<<TWINT)) );
|
||||
// return received data from TWDR
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
uint8_t i2c_read_nack(void)
|
||||
{
|
||||
|
||||
// start receiving without acknowledging reception
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
// wait for end of transmission
|
||||
while( !(TWCR & (1<<TWINT)) );
|
||||
// return received data from TWDR
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (i2c_start(address | I2C_WRITE)) return 1;
|
||||
|
||||
for (uint16_t i = 0; i < length; i++)
|
||||
{
|
||||
if (i2c_write(data[i])) return 1;
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (i2c_start(address | I2C_READ)) return 1;
|
||||
|
||||
for (uint16_t i = 0; i < (length-1); i++)
|
||||
{
|
||||
data[i] = i2c_read_ack();
|
||||
}
|
||||
data[(length-1)] = i2c_read_nack();
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (i2c_start(devaddr | 0x00)) return 1;
|
||||
|
||||
i2c_write(regaddr);
|
||||
|
||||
for (uint16_t i = 0; i < length; i++)
|
||||
{
|
||||
if (i2c_write(data[i])) return 1;
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (i2c_start(devaddr)) return 1;
|
||||
|
||||
i2c_write(regaddr);
|
||||
|
||||
if (i2c_start(devaddr | 0x01)) return 1;
|
||||
|
||||
for (uint16_t i = 0; i < (length-1); i++)
|
||||
{
|
||||
data[i] = i2c_read_ack();
|
||||
}
|
||||
data[(length-1)] = i2c_read_nack();
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_stop(void)
|
||||
{
|
||||
// transmit STOP condition
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
||||
#ifndef I2C_MASTER_H
|
||||
#define I2C_MASTER_H
|
||||
|
||||
#define I2C_READ 0x01
|
||||
#define I2C_WRITE 0x00
|
||||
|
||||
void i2c_init(void);
|
||||
uint8_t i2c_start(uint8_t address);
|
||||
uint8_t i2c_write(uint8_t data);
|
||||
uint8_t i2c_read_ack(void);
|
||||
uint8_t i2c_read_nack(void);
|
||||
uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length);
|
||||
uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length);
|
||||
uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length);
|
||||
uint8_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length);
|
||||
void i2c_stop(void);
|
||||
|
||||
#endif // I2C_MASTER_H
|
@ -0,0 +1,23 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include QMK_KEYBOARD_CONFIG_H
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
#define SPACE_COUNT 3
|
||||
|
||||
#define TEMPLATE( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
|
||||
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
|
||||
) { \
|
||||
{ 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 }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \
|
||||
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \
|
||||
{ K40, K41, K42, KC_NO, K44, K45, K46, KC_NO, K48, K49, KC_NO, K4B, K4C, KC_NO }\
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
// This space intentionally left blank
|
@ -1 +1,30 @@
|
||||
#include "ca66.h"
|
||||
#include "config.h"
|
||||
|
||||
void bootmagic_lite(void)
|
||||
{
|
||||
// The lite version of TMK's bootmagic.
|
||||
// 100% less potential for accidentally making the
|
||||
// keyboard do stupid things.
|
||||
|
||||
// We need multiple scans because debouncing can't be turned off.
|
||||
matrix_scan();
|
||||
wait_ms(DEBOUNCING_DELAY);
|
||||
matrix_scan();
|
||||
|
||||
// If the Esc (matrix 0,0) is held down on power up,
|
||||
// reset the EEPROM valid state and jump to bootloader.
|
||||
if ( matrix_get_row(0) & (1<<0) )
|
||||
{
|
||||
// Set the TMK/QMK EEPROM state as invalid.
|
||||
eeconfig_disable();
|
||||
// Jump to bootloader.
|
||||
bootloader_jump();
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_init_kb(void)
|
||||
{
|
||||
bootmagic_lite();
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Ckeys.org
|
||||
|
||||
[ckeys](https://ckeys.org/) is a mechanical keyboard based non profit, located in Seattle, Washington.
|
||||
|
||||
In addition, to hosting the [Seattle Mechanical Keyboard Meetups](https://ckeys.org/events/), they have [soldering workshops](https://ckeys.org/workshops/) featuring hardware hosted in this repository.
|
||||
|
||||
* Supported Hardware
|
||||
* The Obelus - 4x4 Macropad
|
||||
* naKey - Through hole numpad
|
@ -0,0 +1,17 @@
|
||||
#ifndef CONFIG_KEYMAP_H
|
||||
#define CONFIG_KEYMAP_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
// help for fast typist+dual function keys?
|
||||
#define PERMISSIVE_HOLD
|
||||
|
||||
/* speed up mousekeys a bit */
|
||||
#define MOUSEKEY_DELAY 50
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_MAX_SPEED 8
|
||||
#define MOUSEKEY_TIME_TO_MAX 30
|
||||
#define MOUSEKEY_WHEEL_MAX_SPEED 8
|
||||
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
|
||||
|
||||
#endif
|
@ -0,0 +1,92 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "xtonhasvim.h"
|
||||
|
||||
enum layers {
|
||||
_QWERTY,
|
||||
_FUN,
|
||||
_MOVE,
|
||||
_MOUSE
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[_QWERTY] = LAYOUT(
|
||||
KC_GRV, 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_NO, 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,
|
||||
LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(_MOVE,KC_SCLN), KC_QUOT, KC_ENT,
|
||||
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO,
|
||||
KC_LCTL, KC_LALT, KC_LGUI, VIM_START, TG(_MOUSE), KC_SPC, KC_RGUI, KC_RALT, X_____X, KC_RCTL, MO(_FUN)),
|
||||
|
||||
[_FUN] = 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_DEL,
|
||||
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, RESET,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, BL_STEP, _______, _______, _______, _______, _______, _______,
|
||||
TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
[_MOVE] = LAYOUT(
|
||||
X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X,
|
||||
X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X, X_____X, X_____X,
|
||||
X_____X, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X, X_____X,
|
||||
_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______,
|
||||
TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
|
||||
[_MOUSE] = LAYOUT(
|
||||
X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X,
|
||||
X_____X, X_____X, X_____X, KC_MS_UP, X_____X, X_____X, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_UP, KC_MS_WH_RIGHT, X_____X, X_____X, X_____X, X_____X,
|
||||
X_____X, X_____X,KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, X_____X, X_____X, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, X_____X, X_____X, X_____X,
|
||||
_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______,
|
||||
TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
[_EDIT] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
TO(_QWERTY), _______, _______, VIM_START, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
[_CMD] = LAYOUT(
|
||||
X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X,
|
||||
X_____X, X_____X, VIM_W, VIM_E, X_____X, X_____X, VIM_Y, VIM_U, VIM_I, VIM_O, VIM_P, X_____X, X_____X, X_____X,
|
||||
VIM_ESC, VIM_A, VIM_S, VIM_D, X_____X, VIM_G, VIM_H, VIM_J, VIM_K, VIM_L, X_____X, X_____X, X_____X,
|
||||
VIM_SHIFT, X_____X, X_____X, VIM_X, VIM_C, VIM_V, VIM_B, X_____X, X_____X, VIM_COMMA, VIM_PERIOD, X_____X, VIM_SHIFT,X_____X,
|
||||
TO(_QWERTY), _______, _______, TO(_QWERTY), X_____X, X_____X, _______, _______, _______, _______, _______),
|
||||
|
||||
};
|
||||
|
||||
#define LED_BIT 1 << 2
|
||||
#define LED_MASK ~(1 << 2)
|
||||
|
||||
void user_led_on(void) {
|
||||
DDRB |= LED_BIT;
|
||||
PORTB &= LED_MASK;
|
||||
}
|
||||
|
||||
void user_led_off(void) {
|
||||
DDRB &= ~LED_BIT;
|
||||
PORTB &= LED_MASK;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
user_led_off();
|
||||
}
|
||||
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
static uint32_t last_state = 0;
|
||||
|
||||
if(last_state != state) {
|
||||
switch (biton32(state)) {
|
||||
case _CMD:
|
||||
user_led_on();
|
||||
break;
|
||||
default:
|
||||
user_led_off();
|
||||
break;
|
||||
}
|
||||
last_state = state;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# Xton has a DZ60 and it's Vimtastic!
|
||||
|
||||
Mine has a split spacebar, no arrowkeys and an opaque case. Changes from the default layout:
|
||||
|
||||
* Vim mode toggled by hitting left spacebar (see `users/xtonhasvim`). Reusing the capslock LED to indicate VIM is on.
|
||||
* Momentary directional control by holding down `;`.
|
||||
* Mousekeys toggled with middle space button.
|
||||
* Escape is dual-function with control (which replaces capslock AS IT SHOULD BE).
|
||||
* Bottom left key is the "halp my kb doesn't work" key that always dumps you back to QWERTY.
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef FACEW_CONFIG_H
|
||||
#define FACEW_CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#define VENDOR_ID 0x20A0
|
||||
#define PRODUCT_ID 0x422D
|
||||
#define MANUFACTURER NotActuallyWinkeyless
|
||||
#define PRODUCT facew
|
||||
|
||||
#define RGBLED_NUM 16
|
||||
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 11
|
||||
|
||||
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
|
||||
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6}
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
#define NO_BACKLIGHT_CLOCK
|
||||
#define BACKLIGHT_LEVELS 1
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
|
||||
#define NO_UART 1
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
#endif
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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 "facew.h"
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
#include "backlight.h"
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
#include "rgblight.h"
|
||||
#endif
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "action_layer.h"
|
||||
#include "i2c.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
void rgblight_set(void) {
|
||||
if (!rgblight_config.enable) {
|
||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||
led[i].r = 0;
|
||||
led[i].g = 0;
|
||||
led[i].b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_init();
|
||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
void backlight_init_ports(void) {
|
||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
if (level == 0) {
|
||||
// Turn out the lights
|
||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
||||
} else {
|
||||
// Turn on the lights
|
||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef FACEW_H
|
||||
#define FACEW_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define LAYOUT_all( \
|
||||
K61, K71, K72, K73, K74, K64, K65, K75, K76, K77, K78, K68, K66, K10, K60,\
|
||||
K11, K01, K02, K03, K04, K14, K15, K05, K06, K07, K08, K18, K16, K20, \
|
||||
K12, K21, K22, K23, K24, K34, K35, K25, K26, K27, K28, K38, K40, \
|
||||
K19, K13, K41, K42, K43, K44, K54, K55, K45, K46, K47, K58, K49, K50,\
|
||||
K09, K00, K39, K30, K59, K69, K57, K29\
|
||||
){ \
|
||||
{ KC_NO, K01, K02, K03, K04, K05, K06, K07, K08, K09, K00}, \
|
||||
{ KC_NO, K11, K12, K13, K14, K15, K16, KC_NO, K18, K19, K10}, \
|
||||
{ KC_NO, K21, K22, K23, K24, K25, K26, K27, K28, K29, K20}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, K34, K35, KC_NO, KC_NO, K38, K39, K30}, \
|
||||
{ KC_NO, K41, K42, K43, K44, K45, K46, K47, KC_NO, K49, K40}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, K54, K55, KC_NO, K57, K58, K59, K50}, \
|
||||
{ KC_NO, K61, KC_NO, KC_NO, K64, K65, K66, KC_NO, K68, K69, K60}, \
|
||||
{ KC_NO, K71, K72, K73, K74, K75, K76, K77, K78, KC_NO, KC_NO}, \
|
||||
}
|
||||
|
||||
#define LAYOUT_60_ansi( \
|
||||
K61, K71, K72, K73, K74, K64, K65, K75, K76, K77, K78, K68, K66, K60,\
|
||||
K11, K01, K02, K03, K04, K14, K15, K05, K06, K07, K08, K18, K16, K20, \
|
||||
K12, K21, K22, K23, K24, K34, K35, K25, K26, K27, K28, K38, K40, \
|
||||
K19, K41, K42, K43, K44, K54, K55, K45, K46, K47, K58, K49, \
|
||||
K09, K00, K39, K30, K59, K69, K57, K29\
|
||||
){ \
|
||||
{ KC_NO, K01, K02, K03, K04, K05, K06, K07, K08, K09, K00}, \
|
||||
{ KC_NO, K11, K12, KC_NO, K14, K15, K16, KC_NO, K18, K19, KC_NO}, \
|
||||
{ KC_NO, K21, K22, K23, K24, K25, K26, K27, K28, K29, K20}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, K34, K35, KC_NO, KC_NO, K38, K39, K30}, \
|
||||
{ KC_NO, K41, K42, K43, K44, K45, K46, K47, KC_NO, K49, K40}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, K54, K55, KC_NO, K57, K58, K59, KC_NO}, \
|
||||
{ KC_NO, K61, KC_NO, KC_NO, K64, K65, K66, KC_NO, K68, K69, K60}, \
|
||||
{ KC_NO, K71, K72, K73, K74, K75, K76, K77, K78, KC_NO, KC_NO}, \
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
// Please do not modify this file
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||
if (bitrate_div >= 16) {
|
||||
bitrate_div = (bitrate_div - 16) / 2;
|
||||
}
|
||||
TWBR = bitrate_div;
|
||||
}
|
||||
|
||||
void i2c_init(void) {
|
||||
// set pull-up resistors on I2C bus pins
|
||||
PORTC |= 0b11;
|
||||
|
||||
i2c_set_bitrate(400);
|
||||
|
||||
// enable TWI (two-wire interface)
|
||||
TWCR |= (1 << TWEN);
|
||||
|
||||
// enable TWI interrupt and slave address ACK
|
||||
TWCR |= (1 << TWIE);
|
||||
TWCR |= (1 << TWEA);
|
||||
}
|
||||
|
||||
uint8_t i2c_start(uint8_t address) {
|
||||
// reset TWI control register
|
||||
TWCR = 0;
|
||||
|
||||
// begin transmission and wait for it to end
|
||||
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the start condition was successfully transmitted
|
||||
if ((TWSR & 0xF8) != TW_START) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// transmit address and wait
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the device has acknowledged the READ / WRITE mode
|
||||
uint8_t twst = TW_STATUS & 0xF8;
|
||||
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
}
|
||||
|
||||
uint8_t i2c_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
|
||||
// transmit data and wait
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||
if (i2c_start(address)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < length; i++) {
|
||||
if (i2c_write(data[i])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
// Please do not modify this file
|
||||
|
||||
#ifndef __I2C_H__
|
||||
#define __I2C_H__
|
||||
|
||||
void i2c_init(void);
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||
|
||||
#endif
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"keyboard_name": "FaceW",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 15,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT_all": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_60_ansi": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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] = {
|
||||
[0] = LAYOUT_all(
|
||||
KC_GESC, 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_BSLS, KC_GRV,
|
||||
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_BSPC,
|
||||
MO(1), 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_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL
|
||||
),
|
||||
[1] = LAYOUT_all(
|
||||
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_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_DEL,
|
||||
MO(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS, KC_TRNS, MO(2),
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
[2] = LAYOUT_all(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
MO(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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] = {
|
||||
[0] = LAYOUT_all(
|
||||
KC_GESC, 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_NO, 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_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_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, TG(2),
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, MO(1), KC_RALT, KC_RGUI, KC_RCTL
|
||||
),
|
||||
[1] = LAYOUT_all(
|
||||
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_NO, KC_DEL,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
[2] = LAYOUT_all(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT
|
||||
),
|
||||
|
||||
[3] = LAYOUT_all(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
||||
|
@ -0,0 +1,18 @@
|
||||
MechMerlin's FaceW Sprit Edition Layout
|
||||
======================
|
||||
|
||||
This is the preferred 60% layout used by u/merlin36, host of the [MechMerlin YouTube channel](www.youtube.com/mechmerlin).
|
||||
|
||||
## Keyboard Notes
|
||||
- The FaceW Sprit Edition can be purchased on [mechanicalkeyboards.com](www.mechanicalkeyboards.com)
|
||||
- Uses ps2avru instead of ps2avrgb
|
||||
- To put in reset mode hold `q` while inserting the USB cable
|
||||
- Use flashing instructions from ps2avrgb QMK port
|
||||
|
||||
## Keymap Notes
|
||||
- Does not support any form of inswitch lighting as Merlin hates them.
|
||||
- Arrow toggle switch to the right of right shift
|
||||
- Reset is FN + Left Shift + R
|
||||
|
||||
### Build
|
||||
To build this keymap, simply run `make facew:mechmerlin` from the qmk_firmware directory.
|
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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 <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
#define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
void matrix_init(void) {
|
||||
// all outputs for rows high
|
||||
DDRB = 0xFF;
|
||||
PORTB = 0xFF;
|
||||
// all inputs for columns
|
||||
DDRA = 0x00;
|
||||
DDRC &= ~(0x111111<<2);
|
||||
DDRD &= ~(1<<PIND7);
|
||||
// all columns are pulled-up
|
||||
PORTA = 0xFF;
|
||||
PORTC |= (0b111111<<2);
|
||||
PORTD |= (1<<PIND7);
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix[row] = 0x00;
|
||||
matrix_debouncing[row] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_set_row_status(uint8_t row) {
|
||||
DDRB = (1 << row);
|
||||
PORTB = ~(1 << row);
|
||||
}
|
||||
|
||||
uint8_t bit_reverse(uint8_t x) {
|
||||
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix_set_row_status(row);
|
||||
_delay_us(5);
|
||||
|
||||
matrix_row_t cols = (
|
||||
// cols 0..7, PORTA 0 -> 7
|
||||
(~PINA) & 0xFF
|
||||
) | (
|
||||
// cols 8..13, PORTC 7 -> 0
|
||||
bit_reverse((~PINC) & 0xFF) << 8
|
||||
) | (
|
||||
// col 14, PORTD 7
|
||||
((~PIND) & (1 << PIND7)) << 7
|
||||
);
|
||||
|
||||
if (matrix_debouncing[row] != cols) {
|
||||
matrix_debouncing[row] = cols;
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
_delay_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
matrix_scan_user();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
# FaceW
|
||||
|
||||
A 60% no frills keyboard.
|
||||
|
||||
The FaceW is a special run of the WKL B.Face sourced from Sprit that doesn't have underglow RGB LEDs
|
||||
but does have in switch LEDs. Also unlike the B.Face, it is based on ps2avru instead of ps2avrGB. It
|
||||
is designed and manufactured in Korea. It originally uses BootMapperClient for programming but
|
||||
can now also use QMK.
|
||||
|
||||
Keyboard Maintainer: [MechMerlin](www.github.com/mechmerlin)
|
||||
Hardware Supported: FaceW Sprit Edition PCB
|
||||
Hardware Availability: https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1352
|
||||
|
||||
## Keyboard Notes
|
||||
- The FaceW Sprit Edition can be purchased on [mechanicalkeyboards.com](www.mechanicalkeyboards.com)
|
||||
- Uses ps2avru instead of ps2avrgb
|
||||
- To put in reset mode hold `q` while inserting the USB cable
|
||||
- When flashing, type `bootloadHID -r yourfile.hex` and wait awhile
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make facew:default
|
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
@ -0,0 +1,52 @@
|
||||
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32a
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# unsupported features for now
|
||||
NO_UART = yes
|
||||
NO_SUSPEND_POWER_DOWN = yes
|
||||
|
||||
# processor frequency
|
||||
F_CPU = 12000000
|
||||
|
||||
# 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 = bootloadHID
|
||||
|
||||
# build options
|
||||
BOOTMAGIC_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
COMMAND_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||
|
||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
# custom matrix setup
|
||||
CUSTOM_MATRIX = yes
|
||||
SRC = matrix.c i2c.c
|
||||
|
||||
# programming options
|
||||
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||
|
||||
LAYOUTS = 60_ansi
|
@ -0,0 +1,396 @@
|
||||
/* Name: usbconfig.h
|
||||
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||
* Author: Christian Starkjohann
|
||||
* Creation Date: 2005-04-01
|
||||
* Tabsize: 4
|
||||
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||
*/
|
||||
|
||||
#ifndef __usbconfig_h_included__
|
||||
#define __usbconfig_h_included__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
General Description:
|
||||
This file is an example configuration (with inline documentation) for the USB
|
||||
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||
section at the end of this file).
|
||||
*/
|
||||
|
||||
/* ---------------------------- Hardware Config ---------------------------- */
|
||||
|
||||
#define USB_CFG_IOPORTNAME D
|
||||
/* This is the port where the USB bus is connected. When you configure it to
|
||||
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||
*/
|
||||
#define USB_CFG_DMINUS_BIT 3
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||
* This may be any bit in the port.
|
||||
*/
|
||||
#define USB_CFG_DPLUS_BIT 2
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||
* This may be any bit in the port. Please note that D+ must also be connected
|
||||
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||
* markers every millisecond.]
|
||||
*/
|
||||
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||
* crystal!
|
||||
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||
* not need to modify this setting.
|
||||
*/
|
||||
#define USB_CFG_CHECK_CRC 0
|
||||
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||
* currently only available for 18 MHz crystal clock. You must choose
|
||||
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||
|
||||
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||
* V+, you can connect and disconnect the device from firmware by calling
|
||||
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||
* This constant defines the port on which the pullup resistor is connected.
|
||||
*/
|
||||
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||
* above) where the 1.5k pullup resistor is connected. See description
|
||||
* above for details.
|
||||
*/
|
||||
|
||||
/* --------------------------- Functional Range ---------------------------- */
|
||||
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||
* number).
|
||||
*/
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||
*/
|
||||
#define USB_CFG_EP3_NUMBER 3
|
||||
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||
*/
|
||||
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||
/* The above macro defines the startup condition for data toggling on the
|
||||
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||
* sent with the oposite value of this configuration!
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_HALT 0
|
||||
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||
* it is required by the standard. We have made it a config option because it
|
||||
* bloats the code considerably.
|
||||
*/
|
||||
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||
* want to send any data over them. If this macro is defined to 1, functions
|
||||
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||
* you need the interrupt-in endpoints in order to comply to an interface
|
||||
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||
* of bytes in flash memory and the transmit buffers in RAM.
|
||||
*/
|
||||
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||
* low speed devices.
|
||||
*/
|
||||
#define USB_CFG_IS_SELF_POWERED 0
|
||||
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||
* device is powered from the USB bus.
|
||||
*/
|
||||
#define USB_CFG_MAX_BUS_POWER 500
|
||||
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||
* The value is in milliamperes. [It will be divided by two since USB
|
||||
* communicates power requirements in units of 2 mA.]
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||
* bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||
/* Set this to 1 if you need to send control replies which are generated
|
||||
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||
* data from a static buffer, set it to 0 and return the data from
|
||||
* usbFunctionSetup(). This saves a couple of bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||
* You must implement the function usbFunctionWriteOut() which receives all
|
||||
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||
* can be found in 'usbRxToken'.
|
||||
*/
|
||||
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||
* usbdrv.h.
|
||||
*/
|
||||
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||
* where the driver's constants (descriptors) are located. Or in other words:
|
||||
* Define this to 1 for boot loaders on the ATMega128.
|
||||
*/
|
||||
#define USB_CFG_LONG_TRANSFERS 0
|
||||
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||
* in a single control-in or control-out transfer. Note that the capability
|
||||
* for long transfers increases the driver size.
|
||||
*/
|
||||
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||
/* This macro is a hook if you want to do unconventional things. If it is
|
||||
* defined, it's inserted at the beginning of received message processing.
|
||||
* If you eat the received message and don't want default processing to
|
||||
* proceed, do a return after doing your things. One possible application
|
||||
* (besides debugging) is to flash a status LED on each packet.
|
||||
*/
|
||||
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||
* one parameter which distinguishes between the start of RESET state and its
|
||||
* end.
|
||||
*/
|
||||
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||
* received.
|
||||
*/
|
||||
#define USB_COUNT_SOF 1
|
||||
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||
* connected to D- instead of D+.
|
||||
*/
|
||||
/* #ifdef __ASSEMBLER__
|
||||
* macro myAssemblerMacro
|
||||
* in YL, TCNT0
|
||||
* sts timer0Snapshot, YL
|
||||
* endm
|
||||
* #endif
|
||||
* #define USB_SOF_HOOK myAssemblerMacro
|
||||
* This macro (if defined) is executed in the assembler module when a
|
||||
* Start Of Frame condition is detected. It is recommended to define it to
|
||||
* the name of an assembler macro which is defined here as well so that more
|
||||
* than one assembler instruction can be used. The macro may use the register
|
||||
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||
* designs running on the internal RC oscillator.
|
||||
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||
*/
|
||||
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||
* sent by the host. Duplicates occur only as a consequence of communication
|
||||
* errors, when the host does not receive an ACK. Please note that you need to
|
||||
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||
* for each control- and out-endpoint to check for duplicate packets.
|
||||
*/
|
||||
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||
*/
|
||||
#define USB_USE_FAST_CRC 0
|
||||
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||
* run the AVR close to its limit.
|
||||
*/
|
||||
|
||||
/* -------------------------- Device Description --------------------------- */
|
||||
|
||||
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||
* USB-IDs-for-free.txt for details!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||
/* Version number of the device: Minor number first, then major number.
|
||||
*/
|
||||
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
|
||||
#define USB_CFG_VENDOR_NAME_LEN 13
|
||||
/* These two values define the vendor name returned by the USB device. The name
|
||||
* must be given as a list of characters under single quotes. The characters
|
||||
* are interpreted as Unicode (UTF-16) entities.
|
||||
* If you don't want a vendor name string, undefine these macros.
|
||||
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||
* details.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
|
||||
#define USB_CFG_DEVICE_NAME_LEN 8
|
||||
/* Same as above for the device name. If you don't want a device name, undefine
|
||||
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||
* you use a shared VID/PID.
|
||||
*/
|
||||
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||
/* Same as above for the serial number. If you don't want a serial number,
|
||||
* undefine the macros.
|
||||
* It may be useful to provide the serial number through other means than at
|
||||
* compile time. See the section about descriptor properties below for how
|
||||
* to fine tune control over USB descriptors such as the string descriptor
|
||||
* for the serial number.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_CLASS 0
|
||||
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||
/* See USB specification if you want to conform to an existing device class.
|
||||
* Class 0xff is "vendor specific".
|
||||
*/
|
||||
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||
/* See USB specification if you want to conform to an existing device class or
|
||||
* protocol. The following classes must be set at interface level:
|
||||
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||
*/
|
||||
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||
/* Define this to the length of the HID report descriptor, if you implement
|
||||
* an HID device. Otherwise don't define it or define it to 0.
|
||||
* If you use this define, you must add a PROGMEM character array named
|
||||
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||
* Don't forget to keep the array and this define in sync!
|
||||
*/
|
||||
|
||||
/* #define USB_PUBLIC static */
|
||||
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||
* This technique saves a couple of bytes in flash memory.
|
||||
*/
|
||||
|
||||
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||
/* If you don't want to use the driver's default USB descriptors, you can
|
||||
* provide our own. These can be provided as (1) fixed length static data in
|
||||
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||
* information about this function.
|
||||
* Descriptor handling is configured through the descriptor's properties. If
|
||||
* no properties are defined or if they are 0, the default descriptor is used.
|
||||
* Possible properties are:
|
||||
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||
* you want RAM pointers.
|
||||
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||
* in static memory is in RAM, not in flash memory.
|
||||
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||
* the driver must know the descriptor's length. The descriptor itself is
|
||||
* found at the address of a well known identifier (see below).
|
||||
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||
* char usbDescriptorDevice[];
|
||||
* char usbDescriptorConfiguration[];
|
||||
* char usbDescriptorHidReport[];
|
||||
* char usbDescriptorString0[];
|
||||
* int usbDescriptorStringVendor[];
|
||||
* int usbDescriptorStringDevice[];
|
||||
* int usbDescriptorStringSerialNumber[];
|
||||
* Other descriptors can't be provided statically, they must be provided
|
||||
* dynamically at runtime.
|
||||
*
|
||||
* Descriptor properties are or-ed or added together, e.g.:
|
||||
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||
*
|
||||
* The following descriptors are defined:
|
||||
* USB_CFG_DESCR_PROPS_DEVICE
|
||||
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||
* USB_CFG_DESCR_PROPS_STRINGS
|
||||
* USB_CFG_DESCR_PROPS_STRING_0
|
||||
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||
* USB_CFG_DESCR_PROPS_HID
|
||||
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||
*
|
||||
* Note about string descriptors: String descriptors are not just strings, they
|
||||
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||
* int serialNumberDescriptor[] = {
|
||||
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||
* };
|
||||
*/
|
||||
|
||||
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||
|
||||
#define usbMsgPtr_t unsigned short
|
||||
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional MCU Description ------------------------ */
|
||||
|
||||
/* The following configurations have working defaults in usbdrv.h. You
|
||||
* usually don't need to set them explicitly. Only if you want to run
|
||||
* the driver on a device which is not yet supported or with a compiler
|
||||
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||
* interrupt than INT0, you may have to define some of these.
|
||||
*/
|
||||
/* #define USB_INTR_CFG MCUCR */
|
||||
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE GIMSK */
|
||||
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||
/* #define USB_INTR_PENDING GIFR */
|
||||
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||
/* #define USB_INTR_VECTOR INT0_vect */
|
||||
|
||||
/* Set INT1 for D- falling edge to count SOF */
|
||||
/* #define USB_INTR_CFG EICRA */
|
||||
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE EIMSK */
|
||||
#define USB_INTR_ENABLE_BIT INT1
|
||||
/* #define USB_INTR_PENDING EIFR */
|
||||
#define USB_INTR_PENDING_BIT INTF1
|
||||
#define USB_INTR_VECTOR INT1_vect
|
||||
|
||||
#endif /* __usbconfig_h_included__ */
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYMAP_COMMON_H
|
||||
#define KEYMAP_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
// #include "keycode.h"
|
||||
// #include "action.h"
|
||||
|
||||
#define KEYMAP_GRID( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_MIT( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_OFFSET( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP KEYMAP_GRID
|
||||
#define LAYOUT_ortho_4x12 LAYOUT_planck_grid
|
||||
|
||||
#endif
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYMAP_COMMON_H
|
||||
#define KEYMAP_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
// #include "keycode.h"
|
||||
// #include "action.h"
|
||||
|
||||
#define KEYMAP_GRID( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_MIT( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_OFFSET( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP KEYMAP_GRID
|
||||
#define LAYOUT_ortho_4x12 LAYOUT_planck_grid
|
||||
|
||||
#endif
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYMAP_COMMON_H
|
||||
#define KEYMAP_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
// #include "keycode.h"
|
||||
// #include "action.h"
|
||||
|
||||
#define KEYMAP_GRID( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_MIT( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_OFFSET( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP KEYMAP_GRID
|
||||
#define LAYOUT_ortho_4x12 LAYOUT_planck_grid
|
||||
|
||||
#endif
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYMAP_COMMON_H
|
||||
#define KEYMAP_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
// #include "keycode.h"
|
||||
// #include "action.h"
|
||||
|
||||
#define KEYMAP_GRID( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_MIT( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP_OFFSET( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \
|
||||
K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \
|
||||
) \
|
||||
{ \
|
||||
{ K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \
|
||||
{ K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \
|
||||
{ K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \
|
||||
}
|
||||
|
||||
#define KEYMAP KEYMAP_GRID
|
||||
#define LAYOUT_ortho_4x12 LAYOUT_planck_grid
|
||||
|
||||
#endif
|
@ -0,0 +1,212 @@
|
||||
/**
|
||||
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
*/
|
||||
|
||||
#include "backlight.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "backlight_custom.h"
|
||||
#include "breathing_custom.h"
|
||||
|
||||
// DEBUG
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Port D: digital pins of the AVR chipset
|
||||
#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital)
|
||||
#define CAPSLOCK_PORT (1 << 2) // 2nd pin
|
||||
#define BACKLIGHT_PORT (1 << 4) // 4th pin
|
||||
#define SCROLLLOCK_PORT (1 << 6) // 6th pin
|
||||
|
||||
#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64
|
||||
#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default
|
||||
|
||||
#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask
|
||||
|
||||
#define PWM_MAX 0xFF
|
||||
#define TIMER_TOP 255 // 8 bit PWM
|
||||
|
||||
extern backlight_config_t backlight_config;
|
||||
|
||||
/**
|
||||
* References
|
||||
* Port Registers: https://www.arduino.cc/en/Reference/PortManipulation
|
||||
* TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b
|
||||
* Timers: http://www.avrbeginners.net/architecture/timers/timers.html
|
||||
* 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/
|
||||
* PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware
|
||||
*/
|
||||
|
||||
// @Override
|
||||
// turn LEDs on and off depending on USB caps/num/scroll lock states.
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
|
||||
// turn on
|
||||
DDRD |= NUMLOCK_PORT;
|
||||
PORTD |= NUMLOCK_PORT;
|
||||
} else {
|
||||
// turn off
|
||||
DDRD &= ~NUMLOCK_PORT;
|
||||
PORTD &= ~NUMLOCK_PORT;
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||
DDRD |= CAPSLOCK_PORT;
|
||||
PORTD |= CAPSLOCK_PORT;
|
||||
} else {
|
||||
DDRD &= ~CAPSLOCK_PORT;
|
||||
PORTD &= ~CAPSLOCK_PORT;
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
|
||||
DDRD |= SCROLLLOCK_PORT;
|
||||
PORTD |= SCROLLLOCK_PORT;
|
||||
} else {
|
||||
DDRD &= ~SCROLLLOCK_PORT;
|
||||
PORTD &= ~SCROLLLOCK_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
|
||||
// sets up Timer 1 for 8-bit PWM
|
||||
void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE
|
||||
// default 8 bit mode
|
||||
TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH
|
||||
TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW
|
||||
|
||||
// clear output compare value A
|
||||
// outb(OCR1AH, 0);
|
||||
// outb(OCR1AL, 0);
|
||||
|
||||
// clear output comparator registers for B
|
||||
OCR1BH = 0; // outb(OCR1BH, 0);
|
||||
OCR1BL = 0; // outb(OCR1BL, 0);
|
||||
}
|
||||
|
||||
bool is_init = false;
|
||||
void timer1Init(void) {
|
||||
// timer1SetPrescaler(TIMER1PRESCALE)
|
||||
// set to DIV/64
|
||||
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE;
|
||||
|
||||
// reset TCNT1
|
||||
TCNT1H = 0; // outb(TCNT1H, 0);
|
||||
TCNT1L = 0; // outb(TCNT1L, 0);
|
||||
|
||||
// TOIE1: Timer Overflow Interrupt Enable (Timer 1);
|
||||
TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1);
|
||||
|
||||
is_init = true;
|
||||
}
|
||||
|
||||
void timer1UnInit(void) {
|
||||
// set prescaler back to NONE
|
||||
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP
|
||||
|
||||
// disable timer overflow interrupt
|
||||
TIMSK &= ~_BV(TOIE1); // overflow bit?
|
||||
|
||||
setPWM(0);
|
||||
|
||||
is_init = false;
|
||||
}
|
||||
|
||||
|
||||
// handle TCNT1 overflow
|
||||
//! Interrupt handler for tcnt1 overflow interrupt
|
||||
ISR(TIMER1_OVF_vect, ISR_NOBLOCK)
|
||||
{
|
||||
// sei();
|
||||
// handle breathing here
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
if (is_breathing()) {
|
||||
custom_breathing_handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO call user defined function
|
||||
}
|
||||
|
||||
// enable timer 1 PWM
|
||||
// timer1PWMBOn()
|
||||
void timer1PWMBEnable(void) {
|
||||
// turn on channel B (OC1B) PWM output
|
||||
// set OC1B as non-inverted PWM
|
||||
TCCR1A |= _BV(COM1B1);
|
||||
TCCR1A &= ~_BV(COM1B0);
|
||||
}
|
||||
|
||||
// disable timer 1 PWM
|
||||
// timer1PWMBOff()
|
||||
void timer1PWMBDisable(void) {
|
||||
TCCR1A &= ~_BV(COM1B1);
|
||||
TCCR1A &= ~_BV(COM1B0);
|
||||
}
|
||||
|
||||
void enableBacklight(void) {
|
||||
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
|
||||
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
|
||||
}
|
||||
|
||||
void disableBacklight(void) {
|
||||
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
|
||||
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
|
||||
}
|
||||
|
||||
void startPWM(void) {
|
||||
timer1Init();
|
||||
timer1PWMBEnable();
|
||||
enableBacklight();
|
||||
}
|
||||
|
||||
void stopPWM(void) {
|
||||
timer1UnInit();
|
||||
disableBacklight();
|
||||
timer1PWMBDisable();
|
||||
}
|
||||
|
||||
void b_led_init_ports(void) {
|
||||
/* turn backlight on/off depending on user preference */
|
||||
#if BACKLIGHT_ON_STATE == 0
|
||||
// DDRx register: sets the direction of Port D
|
||||
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
|
||||
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
|
||||
#else
|
||||
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
|
||||
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
|
||||
#endif
|
||||
|
||||
timer1PWMSetup();
|
||||
startPWM();
|
||||
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
breathing_enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
void b_led_set(uint8_t level) {
|
||||
if (level > BACKLIGHT_LEVELS) {
|
||||
level = BACKLIGHT_LEVELS;
|
||||
}
|
||||
|
||||
setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS));
|
||||
}
|
||||
|
||||
// called every matrix scan
|
||||
void b_led_task(void) {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
void setPWM(uint16_t xValue) {
|
||||
if (xValue > TIMER_TOP) {
|
||||
xValue = TIMER_TOP;
|
||||
}
|
||||
OCR1B = xValue; // timer1PWMBSet(xValue);
|
||||
}
|
||||
|
||||
#endif // BACKLIGHT_ENABLE
|
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
*/
|
||||
|
||||
#ifndef BACKLIGHT_CUSTOM_H
|
||||
#define BACKLIGHT_CUSTOM_H
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
void b_led_init_ports(void);
|
||||
void b_led_set(uint8_t level);
|
||||
void b_led_task(void);
|
||||
void setPWM(uint16_t xValue);
|
||||
|
||||
#endif // BACKLIGHT_CUSTOM_H
|
@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Breathing effect code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Works in conjunction with `backlight.c`.
|
||||
*
|
||||
* Code adapted from `quantum.c` to register with the existing TIMER1 overflow
|
||||
* handler in `backlight.c` instead of setting up its own timer.
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
*/
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
|
||||
#include "backlight_custom.h"
|
||||
|
||||
#ifndef BREATHING_PERIOD
|
||||
#define BREATHING_PERIOD 6
|
||||
#endif
|
||||
|
||||
#define breathing_min() do {breathing_counter = 0;} while (0)
|
||||
#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0)
|
||||
|
||||
// TODO make this share code with quantum.c
|
||||
|
||||
#define BREATHING_NO_HALT 0
|
||||
#define BREATHING_HALT_OFF 1
|
||||
#define BREATHING_HALT_ON 2
|
||||
#define BREATHING_STEPS 128
|
||||
|
||||
static uint8_t breathing_period = BREATHING_PERIOD;
|
||||
static uint8_t breathing_halt = BREATHING_NO_HALT;
|
||||
static uint16_t breathing_counter = 0;
|
||||
|
||||
static bool breathing = false;
|
||||
|
||||
bool is_breathing(void) {
|
||||
return breathing;
|
||||
}
|
||||
|
||||
// See http://jared.geek.nz/2013/feb/linear-led-pwm
|
||||
static uint16_t cie_lightness(uint16_t v) {
|
||||
if (v <= 5243) // if below 8% of max
|
||||
return v / 9; // same as dividing by 900%
|
||||
else {
|
||||
uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare
|
||||
// to get a useful result with integer division, we shift left in the expression above
|
||||
// and revert what we've done again after squaring.
|
||||
y = y * y * y >> 8;
|
||||
if (y > 0xFFFFUL) // prevent overflow
|
||||
return 0xFFFFU;
|
||||
else
|
||||
return (uint16_t) y;
|
||||
}
|
||||
}
|
||||
|
||||
void breathing_enable(void) {
|
||||
breathing = true;
|
||||
breathing_counter = 0;
|
||||
breathing_halt = BREATHING_NO_HALT;
|
||||
// interrupt already registered
|
||||
}
|
||||
|
||||
void breathing_pulse(void) {
|
||||
if (get_backlight_level() == 0)
|
||||
breathing_min();
|
||||
else
|
||||
breathing_max();
|
||||
breathing_halt = BREATHING_HALT_ON;
|
||||
// breathing_interrupt_enable();
|
||||
breathing = true;
|
||||
}
|
||||
|
||||
void breathing_disable(void) {
|
||||
breathing = false;
|
||||
// backlight_set(get_backlight_level());
|
||||
b_led_set(get_backlight_level()); // custom implementation of backlight_set()
|
||||
}
|
||||
|
||||
void breathing_self_disable(void)
|
||||
{
|
||||
if (get_backlight_level() == 0)
|
||||
breathing_halt = BREATHING_HALT_OFF;
|
||||
else
|
||||
breathing_halt = BREATHING_HALT_ON;
|
||||
}
|
||||
|
||||
void breathing_toggle(void) {
|
||||
if (is_breathing())
|
||||
breathing_disable();
|
||||
else
|
||||
breathing_enable();
|
||||
}
|
||||
|
||||
void breathing_period_set(uint8_t value)
|
||||
{
|
||||
if (!value)
|
||||
value = 1;
|
||||
breathing_period = value;
|
||||
}
|
||||
|
||||
void breathing_period_default(void) {
|
||||
breathing_period_set(BREATHING_PERIOD);
|
||||
}
|
||||
|
||||
void breathing_period_inc(void)
|
||||
{
|
||||
breathing_period_set(breathing_period+1);
|
||||
}
|
||||
|
||||
void breathing_period_dec(void)
|
||||
{
|
||||
breathing_period_set(breathing_period-1);
|
||||
}
|
||||
|
||||
/* To generate breathing curve in python:
|
||||
* from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)]
|
||||
*/
|
||||
static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// Use this before the cie_lightness function.
|
||||
static inline uint16_t scale_backlight(uint16_t v) {
|
||||
return v / BACKLIGHT_LEVELS * get_backlight_level();
|
||||
}
|
||||
|
||||
void custom_breathing_handler(void) {
|
||||
uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS;
|
||||
// resetting after one period to prevent ugly reset at overflow.
|
||||
breathing_counter = (breathing_counter + 1) % (breathing_period * 244);
|
||||
uint8_t index = breathing_counter / interval % BREATHING_STEPS;
|
||||
|
||||
if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) ||
|
||||
((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1)))
|
||||
{
|
||||
// breathing_interrupt_disable();
|
||||
}
|
||||
|
||||
setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U)));
|
||||
}
|
||||
|
||||
#endif // BACKLIGHT_BREATHING
|
||||
#endif // BACKLIGHT_ENABLE
|
@ -0,0 +1,11 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#define TAPPING_TERM 200
|
||||
|
||||
|
||||
#define RGBLIGHT_HUE_STEP 12
|
||||
#define RGBLIGHT_SAT_STEP 15
|
||||
#define RGBLIGHT_VAL_STEP 18
|
||||
|
||||
#endif
|
@ -0,0 +1,49 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#define MUSIC_MASK (keycode != KC_NO)
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
|
||||
#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 2
|
||||
|
||||
// help for fast typist+dual function keys?
|
||||
#define PERMISSIVE_HOLD
|
||||
|
||||
/* disable debug print */
|
||||
#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
#define NO_PRINT
|
||||
|
||||
/* speed up mousekeys a bit */
|
||||
#define MOUSEKEY_DELAY 50
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_MAX_SPEED 8
|
||||
#define MOUSEKEY_TIME_TO_MAX 30
|
||||
#define MOUSEKEY_WHEEL_MAX_SPEED 8
|
||||
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
|
||||
|
||||
#endif
|
@ -0,0 +1,200 @@
|
||||
/* Copyright 2015-2017 Christon DeWan
|
||||
*
|
||||
* 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
|
||||
#include "action_layer.h"
|
||||
#include "xtonhasvim.h"
|
||||
|
||||
/************************************
|
||||
* states
|
||||
************************************/
|
||||
|
||||
enum layers {
|
||||
_QWERTY,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST,
|
||||
_MOVE,
|
||||
_MOUSE
|
||||
};
|
||||
|
||||
/************************************
|
||||
* keymaps!
|
||||
************************************/
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Ctrl*| A* | S | D | F | G | H | J | K | L | ;* | " |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Mouse| | Alt | GUI |Lower*| Space |Raise*| GUI | Alt | | Vim |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*
|
||||
* - Ctrl acts as Esc when tapped.
|
||||
* - Holding A or ; switches to movement layer.
|
||||
* - Raise and Lower are one-shot layers.
|
||||
*/
|
||||
[_QWERTY] = {
|
||||
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
|
||||
{LCTL_T(KC_ESC), LT(_MOVE,KC_A), KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(_MOVE,KC_SCLN), KC_QUOT},
|
||||
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT) },
|
||||
{TG(_MOUSE), X_____X, KC_LALT, KC_LGUI, OSL(_LOWER), KC_SPC, KC_SPC, OSL(_RAISE), KC_LGUI, KC_LALT, X_____X, VIM_START }
|
||||
},
|
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ~ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Next | Vol- | Vol+ | Play |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | Bail | | | | | | | | Bail | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = {
|
||||
{KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_BSPC},
|
||||
{KC_DEL, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE},
|
||||
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, X_____X, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY},
|
||||
{X_____X, TO(_QWERTY), _______, _______, _______, KC_BSPC, KC_BSPC, OSL(_ADJUST), _______, _______, TO(_QWERTY), X_____X}
|
||||
},
|
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ` | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Del | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Next | Vol- | Vol+ | Play |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | Bail | | | | | | | | Bail | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = {
|
||||
{KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSPC},
|
||||
{KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS},
|
||||
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY},
|
||||
{X_____X, TO(_QWERTY), _______, _______, OSL(_ADJUST), X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X}
|
||||
},
|
||||
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-------------------------------------------------------------------------------------.
|
||||
* |RGBPlain| Reset| | | | | | | | | | Del |
|
||||
* |--------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* |RGBMode-| | |Aud on|Audoff|AGnorm|AGswap| | | | |Lite+ |
|
||||
* |--------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* |RGBMode+|Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | |Lite- |
|
||||
* |--------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | RGB | Bail | | | | | | | | Bail | |
|
||||
* `-------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = {
|
||||
{RGB_MODE_PLAIN, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL },
|
||||
{RGB_MODE_REVERSE, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, RGB_VAI},
|
||||
{RGB_MODE_FORWARD, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, RGB_VAD},
|
||||
{RGB_TOG, TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, TO(_QWERTY), X_____X}
|
||||
},
|
||||
|
||||
|
||||
/* movement layer (hold semicolon)
|
||||
*/
|
||||
[_MOVE] = {
|
||||
{TO(_QWERTY), X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X},
|
||||
{_______, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X},
|
||||
{_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______},
|
||||
{X_____X, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X}
|
||||
},
|
||||
|
||||
/* mouse layer
|
||||
*/
|
||||
[_MOUSE] = {
|
||||
{TO(_QWERTY), X_____X, X_____X, KC_MS_UP, X_____X, X_____X, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_UP, KC_MS_WH_RIGHT, X_____X, X_____X },
|
||||
{_______, X_____X, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, X_____X, X_____X, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, X_____X, X_____X},
|
||||
{_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______},
|
||||
{_______, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X}
|
||||
},
|
||||
|
||||
/* vim edit mode. just has an escape -> _CMD key */
|
||||
[_EDIT] = {
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
||||
{VIM_START, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
||||
{_______, TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, TO(_QWERTY), _______}
|
||||
},
|
||||
|
||||
/* vim command layer.
|
||||
*/
|
||||
[_CMD] = {
|
||||
{X_____X, X_____X, VIM_W, VIM_E, X_____X, X_____X, VIM_Y, VIM_U, VIM_I, VIM_O, VIM_P, X_____X},
|
||||
{VIM_ESC, VIM_A, VIM_S, VIM_D, X_____X, VIM_G, VIM_H, VIM_J, VIM_K, VIM_L, X_____X, X_____X},
|
||||
{VIM_SHIFT, X_____X, VIM_X, VIM_C, VIM_V, VIM_B, X_____X, X_____X, VIM_COMMA, VIM_PERIOD, X_____X, VIM_SHIFT},
|
||||
{X_____X, TO(_QWERTY), _______, _______, X_____X, X_____X, X_____X, X_____X, _______, _______, TO(_QWERTY), X_____X}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** Set just 4 LEDs closest to the user. Slightly less annoying to bystanders.*/
|
||||
void rgbflag(uint8_t r, uint8_t g, uint8_t b) {
|
||||
for(int i = 0; i < RGBLED_NUM; i++){
|
||||
switch(i) {
|
||||
case 9 ... 12:
|
||||
// rgblight_setrgb_at(r,g,b,i);
|
||||
led[i].r = r;
|
||||
led[i].g = g;
|
||||
led[i].b = b;
|
||||
break;
|
||||
default:
|
||||
// rgblight_setrgb_at(0,0,0,i);
|
||||
led[i].r = 0;
|
||||
led[i].g = 0;
|
||||
led[i].b = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rgblight_set();
|
||||
}
|
||||
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
if(rgblight_get_mode() == 1) {
|
||||
switch (biton32(state)) {
|
||||
case _RAISE:
|
||||
case _LOWER:
|
||||
case _ADJUST:
|
||||
rgbflag(0x00, 0x00, 0xFF);
|
||||
break;
|
||||
case _MOVE:
|
||||
case _MOUSE:
|
||||
rgbflag(0xFF, 0x00, 0x00);
|
||||
break;
|
||||
case _CMD:
|
||||
rgbflag(0x00, 0xFF, 0x00);
|
||||
break;
|
||||
case _EDIT:
|
||||
rgbflag(0x7A, 0x00, 0xFF);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgbflag(0x00, 0xFF, 0xFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
# Xton has a tiny keyboard! With Vim!
|
||||
|
||||
Based on the standard Planck layout with a few changes:
|
||||
|
||||
* Escape moved to dual-function with control.
|
||||
* Dedicated movement and mouse layers.
|
||||
* Top and middle row swapped in `_RAISE` and `_LOWER` because I never use F-keys.
|
||||
* Vim layers! See `users/xtonhasvim`.
|
||||
|
@ -0,0 +1,6 @@
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
||||
|
||||
MOUSEKEY_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.1",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.1",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"layouts": {
|
||||
"KEYMAP": {
|
||||
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, {"x":16, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, {"x":16, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":15, "y":2}, {"x":16, "y":2}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}]
|
||||
"LAYOUT": {
|
||||
"layout": [{"label":"TAB", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0}, {"label":"Y", "x":13, "y":0}, {"label":"U", "x":14, "y":0}, {"label":"I", "x":15, "y":0}, {"label":"O", "x":16, "y":0}, {"x":17, "y":0}, {"x":17, "y":0}, {"label":"P", "x":17, "y":0}, {"label":"BSPC", "x":18, "y":0}, {"label":"ESC", "x":0, "y":1}, {"label":"A", "x":1, "y":1}, {"label":"S", "x":2, "y":1}, {"label":"D", "x":3, "y":1}, {"label":"F", "x":4, "y":1}, {"label":"G", "x":5, "y":1}, {"label":"LEFT", "x":7, "y":1}, {"label":"DOWN", "x":8, "y":1}, {"label":"UP", "x":10, "y":1}, {"label":"RGHT", "x":11, "y":1}, {"label":"H", "x":13, "y":1}, {"label":"J", "x":14, "y":1}, {"label":"K", "x":15, "y":1}, {"label":"L", "x":16, "y":1}, {"label":";", "x":17, "y":1}, {"label":"'", "x":18, "y":1}, {"label":"CTRL", "x":0, "y":2}, {"label":"Z", "x":1, "y":2}, {"label":"X", "x":2, "y":2}, {"label":"C", "x":3, "y":2}, {"label":"V", "x":4, "y":2}, {"label":"B", "x":5, "y":2}, {"label":"LOWER", "x":6, "y":2}, {"label":"BSPC", "x":7, "y":2}, {"label":"ENT", "x":8, "y":2}, {"label":"RALT", "x":10, "y":2}, {"label":"SPC", "x":11, "y":2}, {"label":"RAISE", "x":12, "y":2}, {"label":"N", "x":13, "y":2}, {"label":"M", "x":14, "y":2}, {"label":",", "x":15, "y":2}, {"label":".", "x":16, "y":2}, {"label":"/", "x":17, "y":2}, {"label":"LGUI", "x":18, "y":2}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.3",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.3",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"layouts": {
|
||||
"KEYMAP": {
|
||||
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, {"x":16, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, {"x":16, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":15, "y":2}, {"x":16, "y":2}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}]
|
||||
"LAYOUT": {
|
||||
"layout": [{"label":"TAB", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0}, {"label":"Y", "x":13, "y":0}, {"label":"U", "x":14, "y":0}, {"label":"I", "x":15, "y":0}, {"label":"O", "x":16, "y":0}, {"x":17, "y":0}, {"x":17, "y":0}, {"label":"P", "x":17, "y":0}, {"label":"BSPC", "x":18, "y":0}, {"label":"ESC", "x":0, "y":1}, {"label":"A", "x":1, "y":1}, {"label":"S", "x":2, "y":1}, {"label":"D", "x":3, "y":1}, {"label":"F", "x":4, "y":1}, {"label":"G", "x":5, "y":1}, {"label":"LEFT", "x":7, "y":1}, {"label":"DOWN", "x":8, "y":1}, {"label":"UP", "x":10, "y":1}, {"label":"RGHT", "x":11, "y":1}, {"label":"H", "x":13, "y":1}, {"label":"J", "x":14, "y":1}, {"label":"K", "x":15, "y":1}, {"label":"L", "x":16, "y":1}, {"label":";", "x":17, "y":1}, {"label":"'", "x":18, "y":1}, {"label":"CTRL", "x":0, "y":2}, {"label":"Z", "x":1, "y":2}, {"label":"X", "x":2, "y":2}, {"label":"C", "x":3, "y":2}, {"label":"V", "x":4, "y":2}, {"label":"B", "x":5, "y":2}, {"label":"LOWER", "x":6, "y":2}, {"label":"BSPC", "x":7, "y":2}, {"label":"ENT", "x":8, "y":2}, {"label":"RALT", "x":10, "y":2}, {"label":"SPC", "x":11, "y":2}, {"label":"RAISE", "x":12, "y":2}, {"label":"N", "x":13, "y":2}, {"label":"M", "x":14, "y":2}, {"label":",", "x":15, "y":2}, {"label":".", "x":16, "y":2}, {"label":"/", "x":17, "y":2}, {"label":"LGUI", "x":18, "y":2}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.3",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"keyboard_name": "Monkeebs Orthodox Rev.3",
|
||||
"maintainer": "qmk",
|
||||
"width": 17,
|
||||
"height": 17.24,
|
||||
"layouts": {
|
||||
"KEYMAP": {
|
||||
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, {"x":16, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, {"x":16, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":15, "y":2}, {"x":16, "y":2}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}]
|
||||
"LAYOUT": {
|
||||
"layout": [{"label":"TAB", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0}, {"label":"Y", "x":13, "y":0}, {"label":"U", "x":14, "y":0}, {"label":"I", "x":15, "y":0}, {"label":"O", "x":16, "y":0}, {"x":17, "y":0}, {"x":17, "y":0}, {"label":"P", "x":17, "y":0}, {"label":"BSPC", "x":18, "y":0}, {"label":"ESC", "x":0, "y":1}, {"label":"A", "x":1, "y":1}, {"label":"S", "x":2, "y":1}, {"label":"D", "x":3, "y":1}, {"label":"F", "x":4, "y":1}, {"label":"G", "x":5, "y":1}, {"label":"LEFT", "x":7, "y":1}, {"label":"DOWN", "x":8, "y":1}, {"label":"UP", "x":10, "y":1}, {"label":"RGHT", "x":11, "y":1}, {"label":"H", "x":13, "y":1}, {"label":"J", "x":14, "y":1}, {"label":"K", "x":15, "y":1}, {"label":"L", "x":16, "y":1}, {"label":";", "x":17, "y":1}, {"label":"'", "x":18, "y":1}, {"label":"CTRL", "x":0, "y":2}, {"label":"Z", "x":1, "y":2}, {"label":"X", "x":2, "y":2}, {"label":"C", "x":3, "y":2}, {"label":"V", "x":4, "y":2}, {"label":"B", "x":5, "y":2}, {"label":"LOWER", "x":6, "y":2}, {"label":"BSPC", "x":7, "y":2}, {"label":"ENT", "x":8, "y":2}, {"label":"RALT", "x":10, "y":2}, {"label":"SPC", "x":11, "y":2}, {"label":"RAISE", "x":12, "y":2}, {"label":"N", "x":13, "y":2}, {"label":"M", "x":14, "y":2}, {"label":",", "x":15, "y":2}, {"label":".", "x":16, "y":2}, {"label":"/", "x":17, "y":2}, {"label":"LGUI", "x":18, "y":2}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"keyboard_name": "paladin64",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 15,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT_all": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_60_ansi": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_infinity": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.5}, {"label":"Win", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":6}, {"label":"Alt", "x":10, "y":4, "w":1.5}, {"label":"Win", "x":11.5, "y":4}, {"label":"Menu", "x":12.5, "y":4}, {"label":"Ctrl", "x":13.5, "y":4, "w":1.5}]
|
||||
},
|
||||
|
||||
"LAYOUT_aek_103": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.5}, {"label":"Win", "x":1.5, "y":4, "w":1.25}, {"label":"Alt", "x":2.75, "y":4, "w":1.5}, {"x":4.25, "y":4, "w":6.5}, {"label":"Alt", "x":10.75, "y":4, "w":1.5}, {"label":"Menu", "x":12.25, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.5, "y":4, "w":1.5}]
|
||||
},
|
||||
|
||||
"LAYOUT_iso": {
|
||||
"layout": [{"label":"\u00ac", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"\"", "x":2, "y":0}, {"label":"\u00a3", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Enter", "x":13.75, "y":1, "w":1.25, "h":2}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"@", "x":11.75, "y":2}, {"label":"~", "x":12.75, "y":2}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"label":"|", "x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.5}, {"label":"Win", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"label":"AltGr", "x":11, "y":4, "w":1.5}, {"label":"Menu", "x":12.5, "y":4}, {"label":"Ctrl", "x":13.5, "y":4, "w":1.5}]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6060
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER Play Keyboard
|
||||
#define PRODUCT pk60
|
||||
#define DESCRIPTION A 60% keyboard PCB
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
/* key matrix pins */
|
||||
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 }
|
||||
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, F7, B5, B4, D7, D6, B3, B2 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* number of backlight levels */
|
||||
#define BACKLIGHT_PIN B7
|
||||
#ifdef BACKLIGHT_PIN
|
||||
#define BACKLIGHT_LEVELS 5
|
||||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
/* 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
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
/* prevent stuck modifiers */
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
|
||||
#define RGB_DI_PIN E2
|
||||
#ifdef RGB_DI_PIN
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLED_NUM 12
|
||||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"keyboard_name": "pk60",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 15,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT_ansi": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Del", "x":13, "y":0}, {"label":"Bs", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_iso": {
|
||||
"layout": [{"label":"~", "x":0, "y":0.25}, {"label":"!", "x":1, "y":0.25}, {"label":"@", "x":2, "y":0.25}, {"label":"#", "x":3, "y":0.25}, {"label":"$", "x":4, "y":0.25}, {"label":"%", "x":5, "y":0.25}, {"label":"^", "x":6, "y":0.25}, {"label":"&", "x":7, "y":0.25}, {"label":"*", "x":8, "y":0.25}, {"label":"(", "x":9, "y":0.25}, {"label":")", "x":10, "y":0.25}, {"label":"_", "x":11, "y":0.25}, {"label":"+", "x":12, "y":0.25}, {"label":"Del", "x":13, "y":0.25}, {"label":"Bs", "x":14, "y":0.25}, {"label":"Tab", "x":0, "y":1.25, "w":1.5}, {"label":"Q", "x":1.5, "y":1.25}, {"label":"W", "x":2.5, "y":1.25}, {"label":"E", "x":3.5, "y":1.25}, {"label":"R", "x":4.5, "y":1.25}, {"label":"T", "x":5.5, "y":1.25}, {"label":"Y", "x":6.5, "y":1.25}, {"label":"U", "x":7.5, "y":1.25}, {"label":"I", "x":8.5, "y":1.25}, {"label":"O", "x":9.5, "y":1.25}, {"label":"P", "x":10.5, "y":1.25}, {"label":"{", "x":11.5, "y":1.25}, {"label":"}", "x":12.5, "y":1.25}, {"label":"Enter", "x":13.75, "y":1.25, "w":1.25, "h":2}, {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75}, {"label":"A", "x":1.75, "y":2.25}, {"label":"S", "x":2.75, "y":2.25}, {"label":"D", "x":3.75, "y":2.25}, {"label":"F", "x":4.75, "y":2.25}, {"label":"G", "x":5.75, "y":2.25}, {"label":"H", "x":6.75, "y":2.25}, {"label":"J", "x":7.75, "y":2.25}, {"label":"K", "x":8.75, "y":2.25}, {"label":"L", "x":9.75, "y":2.25}, {"label":":", "x":10.75, "y":2.25}, {"label":"@", "x":11.75, "y":2.25}, {"label":"~", "x":12.75, "y":2.25}, {"label":"Shift", "x":0, "y":3.25, "w":1.25}, {"label":"|", "x":1.25, "y":3.25}, {"label":"Z", "x":2.25, "y":3.25}, {"label":"X", "x":3.25, "y":3.25}, {"label":"C", "x":4.25, "y":3.25}, {"label":"V", "x":5.25, "y":3.25}, {"label":"B", "x":6.25, "y":3.25}, {"label":"N", "x":7.25, "y":3.25}, {"label":"M", "x":8.25, "y":3.25}, {"label":"<", "x":9.25, "y":3.25}, {"label":">", "x":10.25, "y":3.25}, {"label":"?", "x":11.25, "y":3.25}, {"label":"Shift", "x":12.25, "y":3.25, "w":1.75}, {"x":14, "y":3.25}, {"label":"Ctrl", "x":0, "y":4.25, "w":1.25}, {"label":"Win", "x":1.25, "y":4.25, "w":1.25}, {"label":"Alt", "x":2.5, "y":4.25, "w":1.25}, {"x":3.75, "y":4.25, "w":6.25}, {"label":"Alt", "x":10, "y":4.25, "w":1.25}, {"label":"Win", "x":11.25, "y":4.25, "w":1.25}, {"label":"Menu", "x":12.5, "y":4.25, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4.25, "w":1.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_225u_arrow": {
|
||||
"layout": [{"label":"~", "x":0, "y":0.25}, {"label":"!", "x":1, "y":0.25}, {"label":"@", "x":2, "y":0.25}, {"label":"#", "x":3, "y":0.25}, {"label":"$", "x":4, "y":0.25}, {"label":"%", "x":5, "y":0.25}, {"label":"^", "x":6, "y":0.25}, {"label":"&", "x":7, "y":0.25}, {"label":"*", "x":8, "y":0.25}, {"label":"(", "x":9, "y":0.25}, {"label":")", "x":10, "y":0.25}, {"label":"_", "x":11, "y":0.25}, {"label":"+", "x":12, "y":0.25}, {"label":"Del", "x":13, "y":0.25}, {"label":"Bs", "x":14, "y":0.25}, {"label":"Tab", "x":0, "y":1.25, "w":1.5}, {"label":"Q", "x":1.5, "y":1.25}, {"label":"W", "x":2.5, "y":1.25}, {"label":"E", "x":3.5, "y":1.25}, {"label":"R", "x":4.5, "y":1.25}, {"label":"T", "x":5.5, "y":1.25}, {"label":"Y", "x":6.5, "y":1.25}, {"label":"U", "x":7.5, "y":1.25}, {"label":"I", "x":8.5, "y":1.25}, {"label":"O", "x":9.5, "y":1.25}, {"label":"P", "x":10.5, "y":1.25}, {"label":"{", "x":11.5, "y":1.25}, {"label":"}", "x":12.5, "y":1.25}, {"label":"|", "x":13.5, "y":1.25, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75}, {"label":"A", "x":1.75, "y":2.25}, {"label":"S", "x":2.75, "y":2.25}, {"label":"D", "x":3.75, "y":2.25}, {"label":"F", "x":4.75, "y":2.25}, {"label":"G", "x":5.75, "y":2.25}, {"label":"H", "x":6.75, "y":2.25}, {"label":"J", "x":7.75, "y":2.25}, {"label":"K", "x":8.75, "y":2.25}, {"label":"L", "x":9.75, "y":2.25}, {"label":":", "x":10.75, "y":2.25}, {"label":"\"", "x":11.75, "y":2.25}, {"label":"Enter", "x":12.75, "y":2.25, "w":2.25}, {"label":"Shift", "x":0, "y":3.25, "w":2.25}, {"label":"Z", "x":2.25, "y":3.25}, {"label":"X", "x":3.25, "y":3.25}, {"label":"C", "x":4.25, "y":3.25}, {"label":"V", "x":5.25, "y":3.25}, {"label":"B", "x":6.25, "y":3.25}, {"label":"N", "x":7.25, "y":3.25}, {"label":"M", "x":8.25, "y":3.25}, {"label":"<", "x":9.25, "y":3.25}, {"label":">", "x":10.25, "y":3.25}, {"label":"Shift", "x":11.25, "y":3.25, "w":1.75}, {"label":"Up", "x":13, "y":3.25}, {"x":14, "y":3.25}, {"label":"Ctrl", "x":0, "y":4.25, "w":1.25}, {"label":"Win", "x":1.25, "y":4.25, "w":1.25}, {"label":"Alt", "x":2.5, "y":4.25, "w":1.25}, {"x":3.75, "y":4.25, "w":6.25}, {"label":"Alt", "x":10, "y":4.25}, {"label":"Ctrl", "x":11, "y":4.25}, {"label":"Left", "x":12, "y":4.25}, {"label":"Down", "x":13, "y":4.25}, {"label":"Right", "x":14, "y":4.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_2u_arrow": {
|
||||
"layout": [{"label":"~", "x":0, "y":0.25}, {"label":"!", "x":1, "y":0.25}, {"label":"@", "x":2, "y":0.25}, {"label":"#", "x":3, "y":0.25}, {"label":"$", "x":4, "y":0.25}, {"label":"%", "x":5, "y":0.25}, {"label":"^", "x":6, "y":0.25}, {"label":"&", "x":7, "y":0.25}, {"label":"*", "x":8, "y":0.25}, {"label":"(", "x":9, "y":0.25}, {"label":")", "x":10, "y":0.25}, {"label":"_", "x":11, "y":0.25}, {"label":"+", "x":12, "y":0.25}, {"label":"Del", "x":13, "y":0.25}, {"label":"Bs", "x":14, "y":0.25}, {"label":"Tab", "x":0, "y":1.25, "w":1.5}, {"label":"Q", "x":1.5, "y":1.25}, {"label":"W", "x":2.5, "y":1.25}, {"label":"E", "x":3.5, "y":1.25}, {"label":"R", "x":4.5, "y":1.25}, {"label":"T", "x":5.5, "y":1.25}, {"label":"Y", "x":6.5, "y":1.25}, {"label":"U", "x":7.5, "y":1.25}, {"label":"I", "x":8.5, "y":1.25}, {"label":"O", "x":9.5, "y":1.25}, {"label":"P", "x":10.5, "y":1.25}, {"label":"{", "x":11.5, "y":1.25}, {"label":"}", "x":12.5, "y":1.25}, {"label":"|", "x":13.5, "y":1.25, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75}, {"label":"A", "x":1.75, "y":2.25}, {"label":"S", "x":2.75, "y":2.25}, {"label":"D", "x":3.75, "y":2.25}, {"label":"F", "x":4.75, "y":2.25}, {"label":"G", "x":5.75, "y":2.25}, {"label":"H", "x":6.75, "y":2.25}, {"label":"J", "x":7.75, "y":2.25}, {"label":"K", "x":8.75, "y":2.25}, {"label":"L", "x":9.75, "y":2.25}, {"label":":", "x":10.75, "y":2.25}, {"label":"\"", "x":11.75, "y":2.25}, {"label":"Enter", "x":12.75, "y":2.25, "w":2.25}, {"label":"Shift", "x":0, "y":3.25, "w":2}, {"label":"Z", "x":2, "y":3.25}, {"label":"X", "x":3, "y":3.25}, {"label":"C", "x":4, "y":3.25}, {"label":"V", "x":5, "y":3.25}, {"label":"B", "x":6, "y":3.25}, {"label":"N", "x":7, "y":3.25}, {"label":"M", "x":8, "y":3.25}, {"label":"<", "x":9, "y":3.25}, {"label":">", "x":10, "y":3.25}, {"label":"?", "x":11, "y":3.25}, {"label":"Shift", "x":12, "y":3.25}, {"label":"Up", "x":13, "y":3.25}, {"x":14, "y":3.25}, {"label":"Ctrl", "x":0, "y":4.25, "w":1.25}, {"label":"Win", "x":1.25, "y":4.25, "w":1.25}, {"label":"Alt", "x":2.5, "y":4.25, "w":1.25}, {"x":3.75, "y":4.25, "w":6.25}, {"label":"Alt", "x":10, "y":4.25}, {"label":"Ctrl", "x":11, "y":4.25}, {"label":"Left", "x":12, "y":4.25}, {"label":"Down", "x":13, "y":4.25}, {"label":"Right", "x":14, "y":4.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_minila": {
|
||||
"layout": [{"label":"~", "x":0, "y":0.25}, {"label":"!", "x":1, "y":0.25}, {"label":"@", "x":2, "y":0.25}, {"label":"#", "x":3, "y":0.25}, {"label":"$", "x":4, "y":0.25}, {"label":"%", "x":5, "y":0.25}, {"label":"^", "x":6, "y":0.25}, {"label":"&", "x":7, "y":0.25}, {"label":"*", "x":8, "y":0.25}, {"label":"(", "x":9, "y":0.25}, {"label":")", "x":10, "y":0.25}, {"label":"_", "x":11, "y":0.25}, {"label":"+", "x":12, "y":0.25}, {"label":"Del", "x":13, "y":0.25}, {"label":"Bs", "x":14, "y":0.25}, {"label":"Tab", "x":0, "y":1.25, "w":1.5}, {"label":"Q", "x":1.5, "y":1.25}, {"label":"W", "x":2.5, "y":1.25}, {"label":"E", "x":3.5, "y":1.25}, {"label":"R", "x":4.5, "y":1.25}, {"label":"T", "x":5.5, "y":1.25}, {"label":"Y", "x":6.5, "y":1.25}, {"label":"U", "x":7.5, "y":1.25}, {"label":"I", "x":8.5, "y":1.25}, {"label":"O", "x":9.5, "y":1.25}, {"label":"P", "x":10.5, "y":1.25}, {"label":"{", "x":11.5, "y":1.25}, {"label":"}", "x":12.5, "y":1.25}, {"label":"|", "x":13.5, "y":1.25, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75}, {"label":"A", "x":1.75, "y":2.25}, {"label":"S", "x":2.75, "y":2.25}, {"label":"D", "x":3.75, "y":2.25}, {"label":"F", "x":4.75, "y":2.25}, {"label":"G", "x":5.75, "y":2.25}, {"label":"H", "x":6.75, "y":2.25}, {"label":"J", "x":7.75, "y":2.25}, {"label":"K", "x":8.75, "y":2.25}, {"label":"L", "x":9.75, "y":2.25}, {"label":":", "x":10.75, "y":2.25}, {"label":"\"", "x":11.75, "y":2.25}, {"label":"Enter", "x":12.75, "y":2.25, "w":2.25}, {"label":"Shift", "x":0, "y":3.25, "w":2}, {"label":"Z", "x":2, "y":3.25}, {"label":"X", "x":3, "y":3.25}, {"label":"C", "x":4, "y":3.25}, {"label":"V", "x":5, "y":3.25}, {"label":"B", "x":6, "y":3.25}, {"label":"N", "x":7, "y":3.25}, {"label":"M", "x":8, "y":3.25}, {"label":"<", "x":9, "y":3.25}, {"label":">", "x":10, "y":3.25}, {"label":"?", "x":11, "y":3.25}, {"label":"Shift", "x":12, "y":3.25}, {"label":"Up", "x":13, "y":3.25}, {"x":14, "y":3.25}, {"label":"Ctrl", "x":0, "y":4.25, "w":1.75}, {"label":"Win", "x":1.75, "y":4.25, "w":1.25}, {"label":"Alt", "x":3, "y":4.25, "w":1.25}, {"x":4.25, "y":4.25, "w":1.25}, {"x":5.5, "y":4.25, "w":3}, {"label":"Alt", "x":8.5, "y":4.25, "w":1.25}, {"label":"Ctrl", "x":9.75, "y":4.25, "w":1.25}, {"x":11, "y":4.25}, {"label":"Left", "x":12, "y":4.25}, {"label":"Down", "x":13, "y":4.25}, {"label":"Right", "x":14, "y":4.25}]
|
||||
},
|
||||
|
||||
"LAYOUT_all": {
|
||||
"layout": [{"label":"~", "x":0, "y":0.25}, {"label":"!", "x":1, "y":0.25}, {"label":"@", "x":2, "y":0.25}, {"label":"#", "x":3, "y":0.25}, {"label":"$", "x":4, "y":0.25}, {"label":"%", "x":5, "y":0.25}, {"label":"^", "x":6, "y":0.25}, {"label":"&", "x":7, "y":0.25}, {"label":"*", "x":8, "y":0.25}, {"label":"(", "x":9, "y":0.25}, {"label":")", "x":10, "y":0.25}, {"label":"_", "x":11, "y":0.25}, {"label":"+", "x":12, "y":0.25}, {"label":"Del", "x":13, "y":0.25}, {"label":"Bs", "x":14, "y":0.25}, {"label":"Tab", "x":0, "y":1.25, "w":1.5}, {"label":"Q", "x":1.5, "y":1.25}, {"label":"W", "x":2.5, "y":1.25}, {"label":"E", "x":3.5, "y":1.25}, {"label":"R", "x":4.5, "y":1.25}, {"label":"T", "x":5.5, "y":1.25}, {"label":"Y", "x":6.5, "y":1.25}, {"label":"U", "x":7.5, "y":1.25}, {"label":"I", "x":8.5, "y":1.25}, {"label":"O", "x":9.5, "y":1.25}, {"label":"P", "x":10.5, "y":1.25}, {"label":"{", "x":11.5, "y":1.25}, {"label":"}", "x":12.5, "y":1.25}, {"label":"|", "x":13.5, "y":1.25, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2.25, "w":1.75}, {"label":"A", "x":1.75, "y":2.25}, {"label":"S", "x":2.75, "y":2.25}, {"label":"D", "x":3.75, "y":2.25}, {"label":"F", "x":4.75, "y":2.25}, {"label":"G", "x":5.75, "y":2.25}, {"label":"H", "x":6.75, "y":2.25}, {"label":"J", "x":7.75, "y":2.25}, {"label":"K", "x":8.75, "y":2.25}, {"label":"L", "x":9.75, "y":2.25}, {"label":":", "x":10.75, "y":2.25}, {"label":"\"", "x":11.75, "y":2.25}, {"label":"\"", "x":12.75, "y":2.25}, {"label":"Enter", "x":13.75, "y":2.25, "w":1.25}, {"label":"Shift", "x":0, "y":3.25}, {"x":1, "y":3.25}, {"label":"Z", "x":2, "y":3.25}, {"label":"X", "x":3, "y":3.25}, {"label":"C", "x":4, "y":3.25}, {"label":"V", "x":5, "y":3.25}, {"label":"B", "x":6, "y":3.25}, {"label":"N", "x":7, "y":3.25}, {"label":"M", "x":8, "y":3.25}, {"label":"<", "x":9, "y":3.25}, {"label":">", "x":10, "y":3.25}, {"label":"?", "x":11, "y":3.25}, {"label":"Shift", "x":12, "y":3.25}, {"label":"Up", "x":13, "y":3.25}, {"x":14, "y":3.25}, {"label":"Ctrl", "x":0, "y":4.25, "w":1.25}, {"label":"Win", "x":1.25, "y":4.25, "w":1.25}, {"label":"Alt", "x":2.5, "y":4.25, "w":1.25}, {"x":3.75, "y":4.25}, {"x":4.75, "y":4.25, "w":5.25}, {"label":"Alt", "x":10, "y":4.25}, {"label":"Ctrl", "x":11, "y":4.25}, {"label":"Left", "x":12, "y":4.25}, {"label":"Down", "x":13, "y":4.25}, {"label":"Right", "x":14, "y":4.25}]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
LAYOUT_all(
|
||||
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_NO, 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_NO, KC_ENT,
|
||||
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_RSFT, MO(1),
|
||||
KC_LCTL, KC_LGUI, KC_LALT, MO(1), KC_SPC, MO(1), KC_RALT, MO(1), KC_NO, KC_APP, KC_RCTL),
|
||||
|
||||
LAYOUT_all(
|
||||
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_TRNS, KC_DEL,
|
||||
RESET, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PSCR, KC_CALC,
|
||||
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_SLCK, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
};
|
||||
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
|
||||
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||
DDRF |= (1 << 4); PORTF &= ~(1 << 4);
|
||||
} else {
|
||||
DDRF &= ~(1 << 4); PORTF &= ~(1 << 4);
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_COMPOSE)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (usb_led & (1 << USB_LED_KANA)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
# Default Play Keyboard60 Layout
|
||||
|
||||
This is the default layout that comes flashed on every Play Keyboard60. All key pins are shown in the file.
|
@ -0,0 +1 @@
|
||||
#include "pk60.h"
|
@ -0,0 +1,90 @@
|
||||
#ifndef pk60_H
|
||||
#define pk60_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define LAYOUT_ansi( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K47, K49, K4A, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D, KC_NO }, \
|
||||
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D, K3E }, \
|
||||
{ K40, K41, K42, KC_NO, KC_NO, KC_NO, KC_NO, K47, KC_NO, K49, K4A, KC_NO, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#define LAYOUT_iso( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K47, K49, K4A, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, KC_NO, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, KC_NO }, \
|
||||
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D, K3E }, \
|
||||
{ K40, K41, K42, KC_NO, KC_NO, KC_NO, KC_NO, K47, KC_NO, K49, K4A, KC_NO, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#define LAYOUT_225u_arrow( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K47, K49, K4A, K4B, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D, KC_NO }, \
|
||||
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D, K3E }, \
|
||||
{ K40, K41, K42, KC_NO, KC_NO, KC_NO, KC_NO, K47, KC_NO, K49, K4A, K4B, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#define LAYOUT_2u_arrow( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
|
||||
K40, K41, K42, K47, K49, K4A, K4B, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D, KC_NO }, \
|
||||
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
|
||||
{ K40, K41, K42, KC_NO, KC_NO, KC_NO, KC_NO, K47, KC_NO, K49, K4A, K4B, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#define LAYOUT_minila( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
|
||||
K40, K41, K42, K43, K47, K48, K49, K4A, K4B, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D, KC_NO }, \
|
||||
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
|
||||
{ K40, K41, K42, K43, KC_NO, KC_NO, KC_NO, K47, K48, K49, K4A, K4B, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#define LAYOUT_all( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
|
||||
K40, K41, K42, K43, K47, K48, K49, K4A, K4B, K4C, K4D \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, KC_NO }, \
|
||||
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
|
||||
{ K40, K41, K42, K43, KC_NO, KC_NO, KC_NO, K47, K48, K49, K4A, K4B, K4C, K4D, KC_NO } \
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,13 @@
|
||||
# Play Keyboard60
|
||||
|
||||
![Play Keyboard60](https://i.imgur.com/3pvC6I4.png)
|
||||
|
||||
A 60% keyboard PCB made by Play Keyboard.
|
||||
It supports GH60 layout and mutultiple layouts like arrows, 2u shift, minila, etc.
|
||||
Fitted with all stock GH60 cases, with WS2812 RGB underglow.
|
||||
|
||||
Keyboard Maintainer: [Barry Huang](https://github.com/yj7272098)
|
||||
Hardware Supported: Play Keyboard60
|
||||
Hardware Availability: [Play Keyboard](http://playkeyboard.qdm.com.tw/)
|
||||
|
||||
Powered by QMK Firmware.
|
@ -0,0 +1,56 @@
|
||||
# MCU name
|
||||
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
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
BOOTLOADER=amtel-dfu
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # 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 = no # Commands for debug and configuration
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
@ -0,0 +1,5 @@
|
||||
AUTO_SHIFT_ENABLE = yes
|
||||
AUTO_SHIFT_MODIFIERS = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
DEFAULT_FOLDER = planck/rev5
|
@ -1 +1 @@
|
||||
# The default keymap for redox
|
||||
# The default keymap for Redox
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2018 Mattia Dal Ben <matthewdibi@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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
/* Use I2C or Serial, not both */
|
||||
|
||||
// #define USE_SERIAL
|
||||
#define USE_I2C
|
||||
|
||||
/* Select hand configuration */
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
#undef RGBLED_NUM
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLED_NUM 14
|
||||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
|
||||
#endif
|
@ -0,0 +1,117 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0
|
||||
#define _SYMB 1
|
||||
#define _NAV 2
|
||||
#define _ADJUST 3
|
||||
|
||||
enum custom_keycodes {
|
||||
QWERTY = SAFE_RANGE,
|
||||
SYMB,
|
||||
NAV,
|
||||
ADJUST,
|
||||
};
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define KC_ KC_TRNS
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* QWERTY
|
||||
* ,------------------------------------------------. ,------------------------------------------------.
|
||||
* |\-Lyr2| 1 | 2 | 3 | 4 | 5 | Lyr1 | | Lyr1 | 6 | 7 | 8 | 9 | 0 |'-Lyr2|
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | è |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | Esc | A | S | D | F | G | PgUp | | End | H | J | K | L | ò | à |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | PgDn | | Home | N | M | , | . | ù |-(Sft)|
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* |<(Gui)| + | - |*(Alt)|/(Ctr)|Bcksp | Del | |Enter |Space |ì(AlG)| Left | Down | Up | Right|
|
||||
* `------------------------------------------------' `------------------------------------------------'
|
||||
*/
|
||||
[_QWERTY] = LAYOUT(
|
||||
//,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
|
||||
LT(_NAV, KC_GRV) , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 ,MO(_SYMB), MO(_SYMB), KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,LT(_NAV, KC_MINS),
|
||||
//|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
|
||||
KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T ,RALT(KC_LBRC), RALT(KC_RBRC) , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_LBRC,
|
||||
//|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
|
||||
KC_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , LT(_ADJUST, KC_PGUP), LT( _ADJUST, KC_END) , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_QUOT,
|
||||
//|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
|
||||
KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B ,KC_PGDN, KC_HOME , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_BSLASH,RSFT_T(KC_SLSH),
|
||||
//|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
|
||||
LGUI_T(KC_NONUS_BSLASH),KC_PPLS,KC_PMNS,LALT_T(KC_PAST),LCTL_T(KC_PSLS),KC_BSPC,KC_DEL , KC_ENT , KC_SPC, RALT_T(KC_EQL),KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT
|
||||
//`----+----+----+----+----+----+----' `----+----+----+----+----+----+----'
|
||||
),
|
||||
|
||||
/* Symbols
|
||||
* ,------------------------------------------------. ,------------------------------------------------.
|
||||
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | ! | @ | { | } | | | | | | | 7 | 8 | 9 | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | # | $ | [ | ] | ~ | | | | | 4 | 5 | 6 | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | % | ^ | ( | ) | ` | | | | | 1 | 2 | 3 | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | 0 | 0 | . | | |
|
||||
* `------------------------------------------------' `------------------------------------------------'
|
||||
*/
|
||||
|
||||
[_SYMB] = LAYOUT(
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX,
|
||||
_______, KC_EXLM, RALT(KC_SCLN), RALT(KC_LCBR), RALT(KC_RCBR), KC_TILD, _______, _______, XXXXXXX, KC_KP_7, KC_KP_8, KC_KP_9, XXXXXXX, XXXXXXX,
|
||||
_______, RALT(KC_QUOT), KC_DLR , RALT(KC_LBRC), RALT(KC_RBRC), RALT(KC_EQL), _______, _______, XXXXXXX, KC_KP_4, KC_KP_5, KC_KP_6, XXXXXXX, XXXXXXX,
|
||||
_______, KC_PERC, LSFT(KC_EQL) , LSFT(KC_8), LSFT(KC_9), RALT(KC_MINS), _______, _______, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, XXXXXXX, XXXXXXX,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_0, KC_KP_0, KC_PDOT, XXXXXXX, XXXXXXX
|
||||
),
|
||||
|
||||
/* Navigation
|
||||
* ,------------------------------------------------. ,------------------------------------------------.
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | |MOUS_U| |WHEL_U| | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | |MOUS_L|MOUS_D|MOUS_R|WHEL_D| | | | | LEFT | DOWN | UP |RIGHT | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
* | | | | |MOUS_1|MOUS_2| | | | | | | | | |
|
||||
* `------------------------------------------------' `------------------------------------------------'
|
||||
*/
|
||||
[_NAV] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
XXXXXXX, XXXXXXX, KC_MS_U, XXXXXXX, KC_WH_U, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, XXXXXXX, _______, _______, KC_LEFT, KC_DOWN, KC_UP , KC_RIGHT,XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
),
|
||||
|
||||
[_ADJUST] = LAYOUT(
|
||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX,
|
||||
XXXXXXX, RESET , RGB_M_P, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, XXXXXXX, KC_DEL, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
|
||||
)
|
||||
|
||||
};
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
#endif
|
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
# The italian keymap for Redox
|
@ -0,0 +1,5 @@
|
||||
RGBLIGHT_ENABLE = yes
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2015 Jack Humbert
|
||||
|
||||
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_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#endif
|
@ -0,0 +1,163 @@
|
||||
#include <util/twi.h>
|
||||
#include <avr/io.h>
|
||||
#include <stdlib.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/twi.h>
|
||||
#include <stdbool.h>
|
||||
#include "i2c.h"
|
||||
|
||||
#ifdef USE_I2C
|
||||
|
||||
// Limits the amount of we wait for any one i2c transaction.
|
||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||
// 9 bits, a single transaction will take around 90μs to complete.
|
||||
//
|
||||
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||
// poll loop takes at least 8 clock cycles to execute
|
||||
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
||||
|
||||
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
||||
|
||||
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
static volatile uint8_t slave_buffer_pos;
|
||||
static volatile bool slave_has_register_set = false;
|
||||
|
||||
// Wait for an i2c operation to finish
|
||||
inline static
|
||||
void i2c_delay(void) {
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
|
||||
// easier way, but will wait slightly longer
|
||||
// _delay_us(100);
|
||||
}
|
||||
|
||||
// Setup twi to run at 100kHz
|
||||
void i2c_master_init(void) {
|
||||
// no prescaler
|
||||
TWSR = 0;
|
||||
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||
// Check datasheets for more info.
|
||||
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
||||
}
|
||||
|
||||
// Start a transaction with the given i2c slave address. The direction of the
|
||||
// transfer is set with I2C_READ and I2C_WRITE.
|
||||
// returns: 0 => success
|
||||
// 1 => error
|
||||
uint8_t i2c_master_start(uint8_t address) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check that we started successfully
|
||||
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
||||
return 1;
|
||||
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
||||
return 1; // slave did not acknowledge
|
||||
else
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
|
||||
// Finish the i2c transaction.
|
||||
void i2c_master_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
}
|
||||
|
||||
// Write one byte to the i2c slave.
|
||||
// returns 0 => slave ACK
|
||||
// 1 => slave NACK
|
||||
uint8_t i2c_master_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check if the slave acknowledged us
|
||||
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
||||
}
|
||||
|
||||
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||
// if ack=0 the acknowledge bit is not set.
|
||||
// returns: byte read from i2c device
|
||||
uint8_t i2c_master_read(int ack) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
||||
|
||||
i2c_delay();
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
void i2c_reset_state(void) {
|
||||
TWCR = 0;
|
||||
}
|
||||
|
||||
void i2c_slave_init(uint8_t address) {
|
||||
TWAR = address << 0; // slave i2c address
|
||||
// TWEN - twi enable
|
||||
// TWEA - enable address acknowledgement
|
||||
// TWINT - twi interrupt flag
|
||||
// TWIE - enable the twi interrupt
|
||||
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
||||
}
|
||||
|
||||
ISR(TWI_vect);
|
||||
|
||||
ISR(TWI_vect) {
|
||||
uint8_t ack = 1;
|
||||
switch(TW_STATUS) {
|
||||
case TW_SR_SLA_ACK:
|
||||
// this device has been addressed as a slave receiver
|
||||
slave_has_register_set = false;
|
||||
break;
|
||||
|
||||
case TW_SR_DATA_ACK:
|
||||
// this device has received data as a slave receiver
|
||||
// The first byte that we receive in this transaction sets the location
|
||||
// of the read/write location of the slaves memory that it exposes over
|
||||
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||
// slave_buffer_pos after each write.
|
||||
if(!slave_has_register_set) {
|
||||
slave_buffer_pos = TWDR;
|
||||
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
||||
ack = 0;
|
||||
slave_buffer_pos = 0;
|
||||
}
|
||||
slave_has_register_set = true;
|
||||
} else {
|
||||
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
||||
BUFFER_POS_INC();
|
||||
}
|
||||
break;
|
||||
|
||||
case TW_ST_SLA_ACK:
|
||||
case TW_ST_DATA_ACK:
|
||||
// master has addressed this device as a slave transmitter and is
|
||||
// requesting data.
|
||||
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
||||
BUFFER_POS_INC();
|
||||
break;
|
||||
|
||||
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||
TWCR = 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Reset everything, so we are ready for the next TWI interrupt
|
||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||
contacted_by_master = true;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,50 @@
|
||||
#ifndef I2C_H
|
||||
#define I2C_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "split_util.h"
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
#define I2C_READ 1
|
||||
#define I2C_WRITE 0
|
||||
|
||||
#define I2C_ACK 1
|
||||
#define I2C_NACK 0
|
||||
|
||||
#define SLAVE_BUFFER_SIZE 0x10
|
||||
|
||||
// i2c SCL clock frequency
|
||||
#define SCL_CLOCK 400000L
|
||||
|
||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
void i2c_master_init(void);
|
||||
uint8_t i2c_master_start(uint8_t address);
|
||||
void i2c_master_stop(void);
|
||||
uint8_t i2c_master_write(uint8_t data);
|
||||
uint8_t i2c_master_read(int);
|
||||
void i2c_reset_state(void);
|
||||
void i2c_slave_init(uint8_t address);
|
||||
|
||||
|
||||
static inline unsigned char i2c_start_read(unsigned char addr) {
|
||||
return i2c_master_start((addr << 1) | I2C_READ);
|
||||
}
|
||||
|
||||
static inline unsigned char i2c_start_write(unsigned char addr) {
|
||||
return i2c_master_start((addr << 1) | I2C_WRITE);
|
||||
}
|
||||
|
||||
// from SSD1306 scrips
|
||||
extern unsigned char i2c_rep_start(unsigned char addr);
|
||||
extern void i2c_start_wait(unsigned char addr);
|
||||
extern unsigned char i2c_readAck(void);
|
||||
extern unsigned char i2c_readNak(void);
|
||||
extern unsigned char i2c_read(unsigned char ack);
|
||||
|
||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
This is the c configuration file for the keymap
|
||||
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2015 Jack Humbert
|
||||
|
||||
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"
|
||||
|
||||
/* Use I2C or Serial, not both */
|
||||
|
||||
#define USE_SERIAL
|
||||
// #define USE_I2C
|
||||
|
||||
/* Select hand configuration */
|
||||
|
||||
//#define MASTER_LEFT
|
||||
// #define MASTER_RIGHT
|
||||
#define EE_HANDS
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||
SONG(DVORAK_SOUND), \
|
||||
SONG(COLEMAK_SOUND) \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,199 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.h"
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0
|
||||
#define _COLEMAK 1
|
||||
#define _DVORAK 2
|
||||
#define _LOWER 3
|
||||
#define _RAISE 4
|
||||
#define _ADJUST 16
|
||||
|
||||
enum custom_keycodes {
|
||||
QWERTY = SAFE_RANGE,
|
||||
COLEMAK,
|
||||
DVORAK,
|
||||
LOWER,
|
||||
RAISE,
|
||||
ADJUST
|
||||
};
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Tab | A | S | D | F | G | H | J | K | L | ; | ' |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | GUI | Alt |Adjust|Lower |Space |Space |Raise | Left | Down | Up |Right |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_QWERTY] = LAYOUT_ortho_4x12( \
|
||||
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
KC_LCTRL,KC_LGUI, KC_LALT, ADJUST, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | R | S | T | D | H | N | E | I | O | ' |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_COLEMAK] = LAYOUT_ortho_4x12( \
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | ' | , | . | P | Y | F | G | C | R | L | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_DVORAK] = LAYOUT_ortho_4x12( \
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* |RESET | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = LAYOUT_ortho_4x12( \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||
RESET, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
),
|
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |RESET |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = LAYOUT_ortho_4x12( \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, RESET, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
),
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | Reset| | | | | | | | | | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | |RGB_MOD|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_4x12( \
|
||||
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD \
|
||||
)
|
||||
|
||||
|
||||
};
|
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
persistent_default_layer_set(1UL<<_QWERTY);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case COLEMAK:
|
||||
if (record->event.pressed) {
|
||||
persistent_default_layer_set(1UL<<_COLEMAK);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case DVORAK:
|
||||
if (record->event.pressed) {
|
||||
persistent_default_layer_set(1UL<<_DVORAK);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case ADJUST:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_ADJUST);
|
||||
} else {
|
||||
layer_off(_ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
@ -0,0 +1,510 @@
|
||||
/*
|
||||
Copyright 2012 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* scan matrix
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "split_util.h"
|
||||
#include "pro_micro.h"
|
||||
#include "config.h"
|
||||
#include "timer.h"
|
||||
#include <print.h>
|
||||
|
||||
#if (defined(RGB_MIDI) | defined(RGBLIGHT_ANIMATIONS)) & defined(RGBLIGHT_ENABLE)
|
||||
#include "rgblight.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_I2C
|
||||
# include "i2c.h"
|
||||
#else // USE_SERIAL
|
||||
# include "serial.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEBOUNCING_DELAY
|
||||
# define DEBOUNCING_DELAY 5
|
||||
#endif
|
||||
|
||||
#if (DEBOUNCING_DELAY > 0)
|
||||
static uint16_t debouncing_time;
|
||||
static bool debouncing = false;
|
||||
#endif
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop(matrix[i])
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#else
|
||||
# error "Currently only supports 8 COLS"
|
||||
#endif
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
#define ERROR_DISCONNECT_COUNT 5
|
||||
|
||||
#define ROWS_PER_HAND (MATRIX_ROWS/2)
|
||||
|
||||
static uint8_t error_count = 0;
|
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
static void init_cols(void);
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
static void unselect_row(uint8_t row);
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
static void init_rows(void);
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
||||
static void unselect_cols(void);
|
||||
static void unselect_col(uint8_t col);
|
||||
static void select_col(uint8_t col);
|
||||
#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) {
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void) {
|
||||
return MATRIX_ROWS;
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_cols(void) {
|
||||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
bool has_usb(void) {
|
||||
return UDADDR & _BV(ADDEN); // This will return true of a USB connection has been established
|
||||
}
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
#ifdef DISABLE_JTAG
|
||||
// JTAG disable for PORT F. write JTD bit twice within four cycles.
|
||||
MCUCR |= (1<<JTD);
|
||||
MCUCR |= (1<<JTD);
|
||||
#endif
|
||||
|
||||
// initialize row and col
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
unselect_rows();
|
||||
init_cols();
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
unselect_cols();
|
||||
init_rows();
|
||||
#endif
|
||||
|
||||
TX_RX_LED_INIT;
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
rgblight_init();
|
||||
#endif
|
||||
|
||||
timer_init();
|
||||
#ifdef USE_I2C
|
||||
i2c_slave_init(SLAVE_I2C_ADDRESS);
|
||||
#else
|
||||
serial_slave_init();
|
||||
#endif
|
||||
|
||||
sei();
|
||||
|
||||
matrix_init_quantum();
|
||||
while(!has_usb() || contacted_by_master){
|
||||
matrix_slave_scan();
|
||||
}
|
||||
|
||||
// Set up as master
|
||||
#ifdef USE_I2C
|
||||
i2c_reset_state();
|
||||
i2c_master_init();
|
||||
#else
|
||||
serial_master_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t _matrix_scan(void)
|
||||
{
|
||||
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
// Set row, read cols
|
||||
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
|
||||
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
PORTD ^= (1 << 2);
|
||||
}
|
||||
|
||||
# else
|
||||
read_cols_on_row(matrix+offset, current_row);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
# else
|
||||
read_rows_on_col(matrix+offset, current_col);
|
||||
# endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
|
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||
matrix[i+offset] = matrix_debouncing[i+offset];
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
# endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef USE_I2C
|
||||
|
||||
// Get rows from other half over i2c
|
||||
int i2c_transaction(void) {
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
|
||||
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
// start of matrix stored at 0x00
|
||||
err = i2c_master_write(0x00);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
// Start read
|
||||
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
if (!err) {
|
||||
int i;
|
||||
for (i = 0; i < ROWS_PER_HAND-1; ++i) {
|
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
|
||||
}
|
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
|
||||
i2c_master_stop();
|
||||
} else {
|
||||
i2c_error: // the cable is disconnceted, or something else went wrong
|
||||
i2c_reset_state();
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else // USE_SERIAL
|
||||
|
||||
int serial_transaction(void) {
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
|
||||
if (serial_update_buffers()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
matrix[slaveOffset+i] = serial_slave_buffer[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
uint8_t ret = _matrix_scan();
|
||||
|
||||
#ifdef USE_I2C
|
||||
if( i2c_transaction() ) {
|
||||
#else // USE_SERIAL
|
||||
if( serial_transaction() ) {
|
||||
#endif
|
||||
// turn on the indicator led when halves are disconnected
|
||||
TXLED1;
|
||||
|
||||
error_count++;
|
||||
|
||||
if (error_count > ERROR_DISCONNECT_COUNT) {
|
||||
// reset other half if disconnected
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
matrix[slaveOffset+i] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// turn off the indicator led on no error
|
||||
TXLED0;
|
||||
error_count = 0;
|
||||
}
|
||||
matrix_scan_quantum();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void matrix_slave_scan(void) {
|
||||
#if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE)
|
||||
rgblight_task();
|
||||
#endif
|
||||
_matrix_scan();
|
||||
|
||||
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
|
||||
|
||||
#ifdef USE_I2C
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
i2c_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
serial_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
if (debouncing) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
matrix_row_t matrix_get_row(uint8_t row)
|
||||
{
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print("\nr/c 0123456789ABCDEF\n");
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
pbin_reverse16(matrix_get_row(row));
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
count += bitpop16(matrix[i]);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
static void init_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
{
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[current_row];
|
||||
|
||||
// Clear data in matrix row
|
||||
current_matrix[current_row] = 0;
|
||||
|
||||
// Select row and wait for row selecton to stabilize
|
||||
select_row(current_row);
|
||||
wait_us(30);
|
||||
|
||||
// For each col...
|
||||
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin = col_pins[col_index];
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
}
|
||||
|
||||
// Unselect row
|
||||
unselect_row(current_row);
|
||||
|
||||
return (last_row_value != current_matrix[current_row]);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
|
||||
static void init_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
{
|
||||
bool matrix_changed = false;
|
||||
|
||||
// Select col and wait for col selecton to stabilize
|
||||
select_col(current_col);
|
||||
wait_us(30);
|
||||
|
||||
// For each row...
|
||||
for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
|
||||
{
|
||||
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
|
||||
{
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
|
||||
}
|
||||
|
||||
// Determine if the matrix changed state
|
||||
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
|
||||
{
|
||||
matrix_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Unselect col
|
||||
unselect_col(current_col);
|
||||
|
||||
return matrix_changed;
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,126 @@
|
||||
Let's Split Vitamins Included
|
||||
======
|
||||
![Let's Split Vitamins included, assmebled in 3D printed case](https://i.imgur.com/btl0vNQ.jpg)
|
||||
|
||||
This readme and most of the code are from https://github.com/ahtn/tmk_keyboard/
|
||||
|
||||
|
||||
**Hardware files for the Let's Split vitamins included are stored [here](http://github.com/duckle29/let-s-Split-v2/tree/onboardMCU)**
|
||||
|
||||
## First Time Setup
|
||||
|
||||
Clone the `qmk_firmware` repo and navigate to its top level directory. [Once your build environment is setup](https://docs.qmk.fm/getting_started_build_tools.html), you'll be able to generate the default .hex using the [build/compile instructions](https://docs.qmk.fm/build-compile-instructions) in the docs
|
||||
|
||||
If everything worked correctly you will see a file:
|
||||
|
||||
```bash
|
||||
lets_split_vitamins_rev1_YOUR_KEYMAP_NAME.hex
|
||||
```
|
||||
|
||||
If you want, you can flash the hex file to the keyboard right after compilation, by adding `:avrdude` to the end of the make command like so:
|
||||
|
||||
```bash
|
||||
make lets_split_vitamins/rev1:default:avrdude
|
||||
```
|
||||
|
||||
This will both compile the hex, and flash the connected half.
|
||||
|
||||
For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md.
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md).
|
||||
|
||||
Some features supported by the firmware:
|
||||
|
||||
* Either half can connect to the computer via USB, or both halves can be used
|
||||
independently.
|
||||
* You only need 3 wires to connect the two halves. One for VCC, one for GND and one
|
||||
for serial communication.
|
||||
* Optional support for I2C connection between the two halves if for some
|
||||
reason you require a faster connection between the two halves. Note this
|
||||
requires an extra wire between halves and pull-up resistors on the data lines.
|
||||
This is supported on the vitamins included.
|
||||
The extra data line can also be used for ws2812 type LEDs.
|
||||
If neither I2C nor RGB underglow is used, a TRS cable can be used instead of the 4wire TRRS cables.
|
||||
|
||||
Required Hardware
|
||||
-----------------
|
||||
|Amount| Description |
|
||||
|--|--|
|
||||
| 1 | PCB kit from novelkeys |
|
||||
| 48 | MX compatible switches |
|
||||
| 48 | 1U keycaps
|
||||
| 2 | Half cases. A 3D model for the left half is available [here](https://cad.onshape.com/documents/c6e5ae250d1e24fe46c9ef6c/w/d69f7049c0921df3d2b241f9/e/ecc2b176ab52a6d77bc55051). Mirror that to get a right-half case. Plate cases will be designed in the future.
|
||||
| 1 | USB-mini-B cable of your choice |
|
||||
| 1 | TRS / TRRS cable
|
||||
|
||||
Optional Hardware
|
||||
-----------------
|
||||
|
||||
A speaker can be hooked-up to the footprint on the PCBs. It is already enabled in the default firmware from github.
|
||||
|
||||
A strip of WS2812 LEDs can be hooked up too, a guide will be written on how to do that once I get mine in the mail.
|
||||
The PCB and connectors can safely handle 1A of current, but the USB standard is only rated at 500mA. Keep that in mind when picking the amount of LEDs.
|
||||
|
||||
|
||||
## Using I2C
|
||||
|
||||
On the left half PCB, there's two pads labled ***I2C Pullup*** if you want to use I2C, you need to bridge those two solder jumpers with a soldering iron.
|
||||
|
||||
You can change your configuration between serial and i2c by modifying your `config.h` file.
|
||||
|
||||
Notes on Software Configuration
|
||||
-------------------------------
|
||||
|
||||
Configuring the firmware is similar to any other QMK project. One thing
|
||||
to note is that `MATRIX_ROWS` in `config.h` is the total number of rows between
|
||||
the two halves, so because the let's split vitamins included has 4 rows in each half, it's
|
||||
`MATRIX_ROWS=8`.
|
||||
|
||||
Also, the current implementation assumes a maximum of 8 columns, but it would
|
||||
not be very difficult to adapt it to support more if required.
|
||||
|
||||
|
||||
## Entering bootloader
|
||||
If the keyboard isn't new, and has been flashed before, you need to enter bootloader.
|
||||
To enter bootloader, either use the assigned keys on the keymap, or if none have been put in the keymap, quickly short the reset to gnd twice. (Bottom pins of programming header, see image) ![Reset pins](https://i.imgur.com/LCXlv9W.png)
|
||||
|
||||
If using the default keymap, there's a reset key-combination on each half:
|
||||
***Lower (SW23) and left-shift (SW13)*** on the left half, or
|
||||
***Raise(SW44) and Enter(SW42)*** on the right half
|
||||
It is recommended to add such reset keys to any custom keymaps. It shouldn't be necesarry to have one on each half, but the default layout has that.
|
||||
|
||||
The board exits bootloader mode after 8 seconds, if you haven't started flashing.
|
||||
|
||||
## EEPROM
|
||||
|
||||
If this is the first time you're flashing the boards, you have to flash EEPROM
|
||||
|
||||
0. If your keyboard is plugged in, unplug it
|
||||
1. Open a terminal, and navigate to the qmk_firmware folder
|
||||
2. Run `ls /dev | grep tty` Note down which ports you see
|
||||
2. Plug the keyboard in, if it's new, it should enter bootloader, if it's not new, see **Entering bootloader** on how to enter bootloader mode
|
||||
4. Right after entering bootloader, run `ls /dev | grep tty` again. There should be a new tty, this is the bootloader TTY, note it down. If nothing shows see **Entering bootloader** on how to enter bootloader mode
|
||||
6. For the left hand side, run `avrdude -c avr109 -p m32u4 -P /dev/ttyS1 -U eeprom:w:"./keyboards/lets_split_vitamins/eeprom-lefthand.eep":a`
|
||||
Replace ***/dev/ttyS1*** with the port you noted down earlier. If you're on windows using msys2, replace ***/dev/ttyS1*** with COM2, note that the number is one higher than the tty number.
|
||||
Do the same For the right hand, but change the file to ***eeprom-righthand.eep***
|
||||
|
||||
Your EEPROM should be flashed :)
|
||||
|
||||
In the future, you shouldn't need to flash EEPROM (it will in fact wear the eeprom memory, so don't)
|
||||
|
||||
## Flashing
|
||||
If you haven't flashed EEPROM before, do that first.
|
||||
|
||||
To flash keymaps onto the keyboard, use:
|
||||
```bash
|
||||
make lets_split_vitamins/rev1:[KEYMAP]:avrdude
|
||||
```
|
||||
from the qmk_firmware folder. Default being the default keymap.
|
||||
|
||||
You can plug either half into USB and it will work. you can also remove the TRS/TRRS cable, and plug both halves in. (which is why the default layout has reset on both halves)
|
||||
|
||||
Enjoy your keyboard! :D
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2015 Jack Humbert
|
||||
|
||||
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 REV1_CONFIG_H
|
||||
#define REV1_CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xBEE5
|
||||
#define PRODUCT_ID 0xF33D
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER Duckle29
|
||||
#define PRODUCT Lets Split sockets vitamins included
|
||||
#define DESCRIPTION A split keyboard for the cheapish makers
|
||||
|
||||
/* key matrix size */
|
||||
// Rows are doubled-up
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 6
|
||||
|
||||
// wiring of each half
|
||||
#define MATRIX_ROW_PINS { F5, F6, C7, F7 }
|
||||
#define MATRIX_COL_PINS { F1, F4, E2, B6, D7, D6}
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
/* 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
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
/* ws2812 RGB LED */
|
||||
#define RGB_DI_PIN F0
|
||||
#define RGBLIGHT_TIMER
|
||||
#define RGBLED_NUM 16 // Number of LEDs
|
||||
#define ws2812_PORTREG PORTF
|
||||
#define ws2812_DDRREG DDRF
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
|
||||
/* Audio settings */
|
||||
#ifdef AUDIO_ENABLE
|
||||
#define C6_AUDIO // Define this to enable the buzzer
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,13 @@
|
||||
#include "rev1.h"
|
||||
|
||||
|
||||
#ifdef SSD1306OLED
|
||||
void led_set_kb(uint8_t usb_led) {
|
||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
#endif
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
#ifndef REV1_H
|
||||
#define REV1_H
|
||||
#define DISABLE_JTAG // The keyboard uses PF4, PF5 and PF7, which are used by JTAG.
|
||||
#define EE_HANDS // This isn't optional for the vitamins included
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
#include "quantum.h"
|
||||
|
||||
|
||||
#ifdef USE_I2C
|
||||
#include <stddef.h>
|
||||
#ifdef __AVR__
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
|
||||
#define KEYMAP( \
|
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
{ \
|
||||
{ L00, L01, L02, L03, L04, L05 }, \
|
||||
{ L10, L11, L12, L13, L14, L15 }, \
|
||||
{ L20, L21, L22, L23, L24, L25 }, \
|
||||
{ L30, L31, L32, L33, L34, L35 }, \
|
||||
{ R00, R01, R02, R03, R04, R05 }, \
|
||||
{ R10, R11, R12, R13, R14, R15 }, \
|
||||
{ R20, R21, R22, R23, R24, R25 }, \
|
||||
{ R30, R31, R32, R33, R34, R35 } \
|
||||
}
|
||||
|
||||
#define LAYOUT_ortho_4x12 KEYMAP
|
||||
#endif
|
@ -0,0 +1,5 @@
|
||||
BACKLIGHT_ENABLE = no
|
||||
AUDIO_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
DEBUG_ENABLE = no
|
||||
CONSOLE_ENABLE = no
|
@ -0,0 +1,75 @@
|
||||
SRC += matrix.c \
|
||||
i2c.c \
|
||||
split_util.c \
|
||||
serial.c \
|
||||
ssd1306.c
|
||||
|
||||
# MCU name
|
||||
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)
|
||||
|
||||
# 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 = caterina
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
# 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 = no # 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. Do not enable this with audio at the same time.
|
||||
USE_I2C = no
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
CUSTOM_MATRIX = yes
|
||||
|
||||
LAYOUTS = ortho_4x12
|
||||
|
||||
DEFAULT_FOLDER = vitamins_included/rev1
|
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* WARNING: be careful changing this code, it is very timing dependent
|
||||
*/
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000
|
||||
#endif
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdbool.h>
|
||||
#include "serial.h"
|
||||
|
||||
#ifndef USE_I2C
|
||||
|
||||
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||
// value.
|
||||
#define SERIAL_DELAY 24
|
||||
|
||||
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
||||
|
||||
#define SLAVE_DATA_CORRUPT (1<<0)
|
||||
volatile uint8_t status = 0;
|
||||
|
||||
inline static
|
||||
void serial_delay(void) {
|
||||
_delay_us(SERIAL_DELAY);
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_output(void) {
|
||||
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
// make the serial pin an input with pull-up resistor
|
||||
inline static
|
||||
void serial_input(void) {
|
||||
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
|
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static
|
||||
uint8_t serial_read_pin(void) {
|
||||
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_low(void) {
|
||||
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_high(void) {
|
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
void serial_master_init(void) {
|
||||
serial_output();
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void serial_slave_init(void) {
|
||||
serial_input();
|
||||
|
||||
// Enable INT0
|
||||
EIMSK |= _BV(INT0);
|
||||
// Trigger on falling edge of INT0
|
||||
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
|
||||
}
|
||||
|
||||
// Used by the master to synchronize timing with the slave.
|
||||
static
|
||||
void sync_recv(void) {
|
||||
serial_input();
|
||||
// This shouldn't hang if the slave disconnects because the
|
||||
// serial line will float to high if the slave does disconnect.
|
||||
while (!serial_read_pin());
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
// Used by the slave to send a synchronization signal to the master.
|
||||
static
|
||||
void sync_send(void) {
|
||||
serial_output();
|
||||
|
||||
serial_low();
|
||||
serial_delay();
|
||||
|
||||
serial_high();
|
||||
}
|
||||
|
||||
// Reads a byte from the serial line
|
||||
static
|
||||
uint8_t serial_read_byte(void) {
|
||||
uint8_t byte = 0;
|
||||
serial_input();
|
||||
for ( uint8_t i = 0; i < 8; ++i) {
|
||||
byte = (byte << 1) | serial_read_pin();
|
||||
serial_delay();
|
||||
_delay_us(1);
|
||||
}
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
// Sends a byte with MSB ordering
|
||||
static
|
||||
void serial_write_byte(uint8_t data) {
|
||||
uint8_t b = 8;
|
||||
serial_output();
|
||||
while( b-- ) {
|
||||
if(data & (1 << b)) {
|
||||
serial_high();
|
||||
} else {
|
||||
serial_low();
|
||||
}
|
||||
serial_delay();
|
||||
}
|
||||
}
|
||||
|
||||
// interrupt handle to be used by the slave device
|
||||
ISR(SERIAL_PIN_INTERRUPT) {
|
||||
sync_send();
|
||||
|
||||
uint8_t checksum = 0;
|
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||
serial_write_byte(serial_slave_buffer[i]);
|
||||
sync_send();
|
||||
checksum += serial_slave_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum);
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
// read the middle of pulses
|
||||
_delay_us(SERIAL_DELAY/2);
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||
serial_master_buffer[i] = serial_read_byte();
|
||||
sync_send();
|
||||
checksum_computed += serial_master_buffer[i];
|
||||
}
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_send();
|
||||
|
||||
serial_input(); // end transaction
|
||||
|
||||
if ( checksum_computed != checksum_received ) {
|
||||
status |= SLAVE_DATA_CORRUPT;
|
||||
} else {
|
||||
status &= ~SLAVE_DATA_CORRUPT;
|
||||
}
|
||||
contacted_by_master = true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool serial_slave_DATA_CORRUPT(void) {
|
||||
return status & SLAVE_DATA_CORRUPT;
|
||||
}
|
||||
|
||||
// Copies the serial_slave_buffer to the master and sends the
|
||||
// serial_master_buffer to the slave.
|
||||
//
|
||||
// Returns:
|
||||
// 0 => no error
|
||||
// 1 => slave did not respond
|
||||
int serial_update_buffers(void) {
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
cli();
|
||||
|
||||
// signal to the slave that we want to start a transaction
|
||||
serial_output();
|
||||
serial_low();
|
||||
_delay_us(1);
|
||||
|
||||
// wait for the slaves response
|
||||
serial_input();
|
||||
serial_high();
|
||||
_delay_us(SERIAL_DELAY);
|
||||
|
||||
// check if the slave is present
|
||||
if (serial_read_pin()) {
|
||||
// slave failed to pull the line low, assume not present
|
||||
sei();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if the slave is present syncronize with it
|
||||
sync_recv();
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
// receive data from the slave
|
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||
serial_slave_buffer[i] = serial_read_byte();
|
||||
sync_recv();
|
||||
checksum_computed += serial_slave_buffer[i];
|
||||
}
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_recv();
|
||||
|
||||
if (checksum_computed != checksum_received) {
|
||||
sei();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t checksum = 0;
|
||||
// send data to the slave
|
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||
serial_write_byte(serial_master_buffer[i]);
|
||||
sync_recv();
|
||||
checksum += serial_master_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum);
|
||||
sync_recv();
|
||||
|
||||
// always, release the line when not in use
|
||||
serial_output();
|
||||
serial_high();
|
||||
|
||||
sei();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
#ifndef MY_SERIAL_H
|
||||
#define MY_SERIAL_H
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
#include "split_util.h"
|
||||
|
||||
/* TODO: some defines for interrupt setup */
|
||||
#define SERIAL_PIN_DDR DDRD
|
||||
#define SERIAL_PIN_PORT PORTD
|
||||
#define SERIAL_PIN_INPUT PIND
|
||||
#define SERIAL_PIN_MASK _BV(PD0)
|
||||
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||
|
||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||
|
||||
// Buffers for master - slave communication
|
||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||
|
||||
void serial_master_init(void);
|
||||
void serial_slave_init(void);
|
||||
int serial_update_buffers(void);
|
||||
bool serial_slave_data_corrupt(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,20 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/power.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include "split_util.h"
|
||||
#include "matrix.h"
|
||||
#include "keyboard.h"
|
||||
#include "config.h"
|
||||
#include "timer.h"
|
||||
#include "debug.h"
|
||||
|
||||
volatile bool isLeftHand = true;
|
||||
volatile bool contacted_by_master = false;
|
||||
|
||||
// this code runs before the usb and keyboard is initialized
|
||||
void matrix_setup(void) {
|
||||
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#ifndef SPLIT_KEYBOARD_UTIL_H
|
||||
#define SPLIT_KEYBOARD_UTIL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "eeconfig.h"
|
||||
|
||||
#define SLAVE_I2C_ADDRESS 0x32
|
||||
|
||||
extern volatile bool isLeftHand;
|
||||
extern volatile bool contacted_by_master;
|
||||
|
||||
bool has_usb(void);
|
||||
|
||||
// slave version of matix scan, defined in matrix.c
|
||||
void matrix_slave_scan(void);
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,16 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#ifdef ONEHAND_ENABLE
|
||||
__attribute__ ((weak))
|
||||
const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
|
||||
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
|
||||
{{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
|
||||
{{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
|
||||
{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
|
||||
{{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
|
||||
{{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
|
||||
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
|
||||
};
|
||||
#endif
|
@ -0,0 +1,25 @@
|
||||
#ifndef VITAMINS_INCLUDED_H
|
||||
#define VITAMINS_INCLUDED_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#include "rev1.h"
|
||||
|
||||
|
||||
// Used to create a keymap using only KC_ prefixed keys
|
||||
#define KC_KEYMAP( \
|
||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
|
||||
) \
|
||||
KEYMAP( \
|
||||
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
||||
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
||||
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
||||
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
|
||||
)
|
||||
|
||||
#define KC_LAYOUT_ortho_4x12 KC_KEYMAP
|
||||
|
||||
#endif
|
@ -1 +1 @@
|
||||
# The default keymap for xd75
|
||||
# The default keymap for xd75, with led controls
|
||||
|
@ -0,0 +1,83 @@
|
||||
YMD75 / MT84
|
||||
==========================
|
||||
|
||||
This is a port of the QMK firmware for boards that are based on the
|
||||
ps2avrGB firmware, like the [ps2avrGB keyboard] (https://www.keyclack.com/product/gb-ps2avrgb/), for use on the YMD75, from YMDK. YMDK sell the board and name it "YMD75", however the PCB has "MT84" printed on both sides.
|
||||
|
||||
Most of the code was taken and amended from YMD96 and my port JJ50, which in itself was taken from ps2avrGB and amended by Andrew Novak.
|
||||
|
||||
Note that this is a complete replacement for the firmware, so you won't be
|
||||
using Bootmapper Client to change any keyboard settings, since not all the
|
||||
USB report options are supported.
|
||||
|
||||
Hardware Supported: YMD75/MT84 with the ATmega32a chip.
|
||||
Hardware Availability: The YMD75/MT84 PCB is available from YMDK on AliExpress and suchlike.
|
||||
|
||||
This version by Wayne K Jones (github.com/WarmCatUK)
|
||||
|
||||
## Installing and Building
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
```
|
||||
$ make ymd75:default:program
|
||||
```
|
||||
It should detect the keyboard and set it to bootloader mode automatically, prior to flashing firmware.
|
||||
I've found that I need to remove the previous build/file before making a new one as it doesn't overwrite it; but this might just be my personal experience.
|
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||
|
||||
Note that this is a complete replacement for the firmware, so you won't be
|
||||
using Bootmapper Client to change any keyboard settings, since not all the
|
||||
USB report options are supported.
|
||||
In addition you may need the AVR toolchain and `bootloadHID` for flashing:
|
||||
|
||||
```
|
||||
$ brew cask install crosspack-avr
|
||||
$ brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb
|
||||
```
|
||||
|
||||
In order to use the `./program` script, which can reboot the board into
|
||||
the bootloader, you'll need Python 2 with PyUSB installed:
|
||||
|
||||
```
|
||||
$ pip install pyusb
|
||||
```
|
||||
|
||||
If you prefer, you can just build it and flash the firmware directly with
|
||||
`bootloadHID` if you boot the board while holding down `Left Control` to keep it
|
||||
in the bootloader:
|
||||
|
||||
```
|
||||
$ make ymd75
|
||||
$ bootloadHID -r ymd75_default.hex
|
||||
```
|
||||
I dont use windows personally, but the following is from ymd96 regarding flashing the atmega32a:
|
||||
|
||||
Since the YMD75/MT84 uses an ATmega32a chip instead of the 32u4, you need to download [HIDBootFlash v.1.0](http://vusb.wikidot.com/project:hidbootflash) for Windows. If anyone knows of a Linux/Mac bootflasher that works, edit this readme!
|
||||
On Windows, I use [MINGw](http://www.mingw.org/) to compile the keymaps. On Linux or OSX you can simply use the terminal.
|
||||
|
||||
Once you have those two pieces of software:
|
||||
Build the keyboard with
|
||||
```
|
||||
$ make ymd75:default
|
||||
```
|
||||
If you make your own layout, change the `default` word to whatever your layout is.
|
||||
|
||||
And flash the compiled hex file with `HIDBootFlash`. Simply put the board in flashing mode by plugging it in while holding the key below the top right key, and click `find device`. Then you can specify the .hex file and flash it to the device.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
1. Try plugging the board in while pressing `Backspace` (`Key below the top right key`). This will force it to boot only the bootloader without loading the firmware. Once this is done, just reflash the board with the original firmware.
|
||||
2. Sometimes USB hubs can act weird, so try connecting the board directly to your computer or plugging/unplugging the USB hub.
|
||||
3. If you get an error such as "Resource Unavailable" when attemting to flash on Linux, you may want to compile and run `tools/usb_detach.c`. See `tools/README.md` for more info.
|
||||
4. I was occasionally finding that I wasn't flashing changes that I was making to my keymap. If that happens, remove the previous build and simply force rebuild by making with:
|
||||
```
|
||||
$ rm ymd75_default.hex
|
||||
$ make -B ymd75:default
|
||||
$ make -B ymd75:default:program
|
||||
```
|
||||
|
||||
|
||||
|
@ -0,0 +1,215 @@
|
||||
/**
|
||||
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
Modified by Wayne K Jones (github.com/WarmCatUK) 2018
|
||||
*/
|
||||
|
||||
#include "backlight.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "backlight_custom.h"
|
||||
#include "breathing_custom.h"
|
||||
|
||||
// DEBUG
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Port D: digital pins of the AVR chipset
|
||||
//#define NUMLOCK_PORT (1 << 2) // 2nd pin of Port D (digital)
|
||||
#define CAPSLOCK_PORT (1 << 1) // 1st pin
|
||||
#define BACKLIGHT_PORT (1 << 4) // 4th pin
|
||||
//#define SCROLLLOCK_PORT (1 << 6) // 6th pin
|
||||
|
||||
#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64
|
||||
#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default
|
||||
|
||||
#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask
|
||||
|
||||
#define PWM_MAX 0xFF
|
||||
#define TIMER_TOP 255 // 8 bit PWM
|
||||
|
||||
extern backlight_config_t backlight_config;
|
||||
|
||||
/**
|
||||
* References
|
||||
* Port Registers: https://www.arduino.cc/en/Reference/PortManipulation
|
||||
* TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b
|
||||
* Timers: http://www.avrbeginners.net/architecture/timers/timers.html
|
||||
* 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/
|
||||
* PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware
|
||||
*/
|
||||
|
||||
// @Override
|
||||
// turn LEDs on and off depending on USB caps/num/scroll lock states.
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
/*
|
||||
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
|
||||
// turn on
|
||||
DDRD |= NUMLOCK_PORT;
|
||||
PORTD |= NUMLOCK_PORT;
|
||||
} else {
|
||||
// turn off
|
||||
DDRD &= ~NUMLOCK_PORT;
|
||||
PORTD &= ~NUMLOCK_PORT;
|
||||
}
|
||||
*/
|
||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||
DDRD |= CAPSLOCK_PORT;
|
||||
PORTD |= CAPSLOCK_PORT;
|
||||
} else {
|
||||
DDRD &= ~CAPSLOCK_PORT;
|
||||
PORTD &= ~CAPSLOCK_PORT;
|
||||
}
|
||||
/*
|
||||
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
|
||||
DDRD |= SCROLLLOCK_PORT;
|
||||
PORTD |= SCROLLLOCK_PORT;
|
||||
} else {
|
||||
DDRD &= ~SCROLLLOCK_PORT;
|
||||
PORTD &= ~SCROLLLOCK_PORT;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
|
||||
// sets up Timer 1 for 8-bit PWM
|
||||
void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE
|
||||
// default 8 bit mode
|
||||
TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH
|
||||
TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW
|
||||
|
||||
// clear output compare value A
|
||||
// outb(OCR1AH, 0);
|
||||
// outb(OCR1AL, 0);
|
||||
|
||||
// clear output comparator registers for B
|
||||
OCR1BH = 0; // outb(OCR1BH, 0);
|
||||
OCR1BL = 0; // outb(OCR1BL, 0);
|
||||
}
|
||||
|
||||
bool is_init = false;
|
||||
void timer1Init(void) {
|
||||
// timer1SetPrescaler(TIMER1PRESCALE)
|
||||
// set to DIV/64
|
||||
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE;
|
||||
|
||||
// reset TCNT1
|
||||
TCNT1H = 0; // outb(TCNT1H, 0);
|
||||
TCNT1L = 0; // outb(TCNT1L, 0);
|
||||
|
||||
// TOIE1: Timer Overflow Interrupt Enable (Timer 1);
|
||||
TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1);
|
||||
|
||||
is_init = true;
|
||||
}
|
||||
|
||||
void timer1UnInit(void) {
|
||||
// set prescaler back to NONE
|
||||
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP
|
||||
|
||||
// disable timer overflow interrupt
|
||||
TIMSK &= ~_BV(TOIE1); // overflow bit?
|
||||
|
||||
setPWM(0);
|
||||
|
||||
is_init = false;
|
||||
}
|
||||
|
||||
|
||||
// handle TCNT1 overflow
|
||||
//! Interrupt handler for tcnt1 overflow interrupt
|
||||
ISR(TIMER1_OVF_vect, ISR_NOBLOCK)
|
||||
{
|
||||
// sei();
|
||||
// handle breathing here
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
if (is_breathing()) {
|
||||
custom_breathing_handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO call user defined function
|
||||
}
|
||||
|
||||
// enable timer 1 PWM
|
||||
// timer1PWMBOn()
|
||||
void timer1PWMBEnable(void) {
|
||||
// turn on channel B (OC1B) PWM output
|
||||
// set OC1B as non-inverted PWM
|
||||
TCCR1A |= _BV(COM1B1);
|
||||
TCCR1A &= ~_BV(COM1B0);
|
||||
}
|
||||
|
||||
// disable timer 1 PWM
|
||||
// timer1PWMBOff()
|
||||
void timer1PWMBDisable(void) {
|
||||
TCCR1A &= ~_BV(COM1B1);
|
||||
TCCR1A &= ~_BV(COM1B0);
|
||||
}
|
||||
|
||||
void enableBacklight(void) {
|
||||
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
|
||||
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
|
||||
}
|
||||
|
||||
void disableBacklight(void) {
|
||||
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
|
||||
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
|
||||
}
|
||||
|
||||
void startPWM(void) {
|
||||
timer1Init();
|
||||
timer1PWMBEnable();
|
||||
enableBacklight();
|
||||
}
|
||||
|
||||
void stopPWM(void) {
|
||||
timer1UnInit();
|
||||
disableBacklight();
|
||||
timer1PWMBDisable();
|
||||
}
|
||||
|
||||
void b_led_init_ports(void) {
|
||||
/* turn backlight on/off depending on user preference */
|
||||
#if BACKLIGHT_ON_STATE == 0
|
||||
// DDRx register: sets the direction of Port D
|
||||
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
|
||||
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
|
||||
#else
|
||||
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
|
||||
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
|
||||
#endif
|
||||
|
||||
timer1PWMSetup();
|
||||
startPWM();
|
||||
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
breathing_enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
void b_led_set(uint8_t level) {
|
||||
if (level > BACKLIGHT_LEVELS) {
|
||||
level = BACKLIGHT_LEVELS;
|
||||
}
|
||||
|
||||
setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS));
|
||||
}
|
||||
|
||||
// called every matrix scan
|
||||
void b_led_task(void) {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
void setPWM(uint16_t xValue) {
|
||||
if (xValue > TIMER_TOP) {
|
||||
xValue = TIMER_TOP;
|
||||
}
|
||||
OCR1B = xValue; // timer1PWMBSet(xValue);
|
||||
}
|
||||
|
||||
#endif // BACKLIGHT_ENABLE
|
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
*/
|
||||
|
||||
#ifndef BACKLIGHT_CUSTOM_H
|
||||
#define BACKLIGHT_CUSTOM_H
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
void b_led_init_ports(void);
|
||||
void b_led_set(uint8_t level);
|
||||
void b_led_task(void);
|
||||
void setPWM(uint16_t xValue);
|
||||
|
||||
#endif // BACKLIGHT_CUSTOM_H
|
@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Breathing effect code for PS2AVRGB boards (ATMEGA32A)
|
||||
* Works in conjunction with `backlight.c`.
|
||||
*
|
||||
* Code adapted from `quantum.c` to register with the existing TIMER1 overflow
|
||||
* handler in `backlight.c` instead of setting up its own timer.
|
||||
* Kenneth A. (github.com/krusli | krusli.me)
|
||||
*/
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
|
||||
#include "backlight_custom.h"
|
||||
|
||||
#ifndef BREATHING_PERIOD
|
||||
#define BREATHING_PERIOD 6
|
||||
#endif
|
||||
|
||||
#define breathing_min() do {breathing_counter = 0;} while (0)
|
||||
#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0)
|
||||
|
||||
// TODO make this share code with quantum.c
|
||||
|
||||
#define BREATHING_NO_HALT 0
|
||||
#define BREATHING_HALT_OFF 1
|
||||
#define BREATHING_HALT_ON 2
|
||||
#define BREATHING_STEPS 128
|
||||
|
||||
static uint8_t breathing_period = BREATHING_PERIOD;
|
||||
static uint8_t breathing_halt = BREATHING_NO_HALT;
|
||||
static uint16_t breathing_counter = 0;
|
||||
|
||||
static bool breathing = false;
|
||||
|
||||
bool is_breathing(void) {
|
||||
return breathing;
|
||||
}
|
||||
|
||||
// See http://jared.geek.nz/2013/feb/linear-led-pwm
|
||||
static uint16_t cie_lightness(uint16_t v) {
|
||||
if (v <= 5243) // if below 8% of max
|
||||
return v / 9; // same as dividing by 900%
|
||||
else {
|
||||
uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare
|
||||
// to get a useful result with integer division, we shift left in the expression above
|
||||
// and revert what we've done again after squaring.
|
||||
y = y * y * y >> 8;
|
||||
if (y > 0xFFFFUL) // prevent overflow
|
||||
return 0xFFFFU;
|
||||
else
|
||||
return (uint16_t) y;
|
||||
}
|
||||
}
|
||||
|
||||
void breathing_enable(void) {
|
||||
breathing = true;
|
||||
breathing_counter = 0;
|
||||
breathing_halt = BREATHING_NO_HALT;
|
||||
// interrupt already registered
|
||||
}
|
||||
|
||||
void breathing_pulse(void) {
|
||||
if (get_backlight_level() == 0)
|
||||
breathing_min();
|
||||
else
|
||||
breathing_max();
|
||||
breathing_halt = BREATHING_HALT_ON;
|
||||
// breathing_interrupt_enable();
|
||||
breathing = true;
|
||||
}
|
||||
|
||||
void breathing_disable(void) {
|
||||
breathing = false;
|
||||
// backlight_set(get_backlight_level());
|
||||
b_led_set(get_backlight_level()); // custom implementation of backlight_set()
|
||||
}
|
||||
|
||||
void breathing_self_disable(void)
|
||||
{
|
||||
if (get_backlight_level() == 0)
|
||||
breathing_halt = BREATHING_HALT_OFF;
|
||||
else
|
||||
breathing_halt = BREATHING_HALT_ON;
|
||||
}
|
||||
|
||||
void breathing_toggle(void) {
|
||||
if (is_breathing())
|
||||
breathing_disable();
|
||||
else
|
||||
breathing_enable();
|
||||
}
|
||||
|
||||
void breathing_period_set(uint8_t value)
|
||||
{
|
||||
if (!value)
|
||||
value = 1;
|
||||
breathing_period = value;
|
||||
}
|
||||
|
||||
void breathing_period_default(void) {
|
||||
breathing_period_set(BREATHING_PERIOD);
|
||||
}
|
||||
|
||||
void breathing_period_inc(void)
|
||||
{
|
||||
breathing_period_set(breathing_period+1);
|
||||
}
|
||||
|
||||
void breathing_period_dec(void)
|
||||
{
|
||||
breathing_period_set(breathing_period-1);
|
||||
}
|
||||
|
||||
/* To generate breathing curve in python:
|
||||
* from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)]
|
||||
*/
|
||||
static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// Use this before the cie_lightness function.
|
||||
static inline uint16_t scale_backlight(uint16_t v) {
|
||||
return v / BACKLIGHT_LEVELS * get_backlight_level();
|
||||
}
|
||||
|
||||
void custom_breathing_handler(void) {
|
||||
uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS;
|
||||
// resetting after one period to prevent ugly reset at overflow.
|
||||
breathing_counter = (breathing_counter + 1) % (breathing_period * 244);
|
||||
uint8_t index = breathing_counter / interval % BREATHING_STEPS;
|
||||
|
||||
if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) ||
|
||||
((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1)))
|
||||
{
|
||||
// breathing_interrupt_disable();
|
||||
}
|
||||
|
||||
setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U)));
|
||||
}
|
||||
|
||||
#endif // BACKLIGHT_BREATHING
|
||||
#endif // BACKLIGHT_ENABLE
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Base Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||
Modified 2017 Andrew Novak <ndrw.nvk@gmail.com>
|
||||
Modified 2018 Wayne Jones (WarmCatUK) <waynekjones@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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#define VENDOR_ID 0x20A0
|
||||
#define PRODUCT_ID 0x422D
|
||||
|
||||
// TODO: share these strings with usbconfig.h
|
||||
// Edit usbconfig.h to change these.
|
||||
#define MANUFACTURER YMDK
|
||||
#define PRODUCT ymd75 / mt84
|
||||
#define DESCRIPTION 75% Keyboard
|
||||
|
||||
/* matrix size */
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 15
|
||||
#define DIODE_DIRECTION ROW2COL
|
||||
|
||||
#define BACKLIGHT_LEVELS 12
|
||||
|
||||
#define RGB_DI_PIN E2
|
||||
#define RGBLED_NUM 16
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLIGHT_HUE_STEP 12
|
||||
#define RGBLIGHT_SAT_STEP 15
|
||||
#define RGBLIGHT_VAL_STEP 18
|
||||
|
||||
#define NO_UART 1
|
||||
#define BOOTLOADHID_BOOTLOADER 1
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
#endif
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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 <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||
if (bitrate_div >= 16) {
|
||||
bitrate_div = (bitrate_div - 16) / 2;
|
||||
}
|
||||
TWBR = bitrate_div;
|
||||
}
|
||||
|
||||
void i2c_init(void) {
|
||||
// set pull-up resistors on I2C bus pins
|
||||
PORTC |= 0b11;
|
||||
|
||||
i2c_set_bitrate(400);
|
||||
|
||||
// enable TWI (two-wire interface)
|
||||
TWCR |= (1 << TWEN);
|
||||
|
||||
// enable TWI interrupt and slave address ACK
|
||||
TWCR |= (1 << TWIE);
|
||||
TWCR |= (1 << TWEA);
|
||||
}
|
||||
|
||||
uint8_t i2c_start(uint8_t address) {
|
||||
// reset TWI control register
|
||||
TWCR = 0;
|
||||
|
||||
// begin transmission and wait for it to end
|
||||
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the start condition was successfully transmitted
|
||||
if ((TWSR & 0xF8) != TW_START) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// transmit address and wait
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the device has acknowledged the READ / WRITE mode
|
||||
uint8_t twst = TW_STATUS & 0xF8;
|
||||
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
}
|
||||
|
||||
uint8_t i2c_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
|
||||
// transmit data and wait
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||
if (i2c_start(address)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < length; i++) {
|
||||
if (i2c_write(data[i])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef __I2C_H__
|
||||
#define __I2C_H__
|
||||
|
||||
void i2c_init(void);
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||
|
||||
#endif
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"keyboard_name": "ymd75",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 16,
|
||||
"height": 6,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"PrtSc", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Fn", "x":15, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Home", "x":15, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"End", "x":15, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"label":"Enter", "x":12.75, "y":3, "w":2.25}, {"label":"Page Up", "x":15, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"\u2191", "x":14, "y":4}, {"label":"Page Down", "x":15, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"GUI", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Alt", "x":10, "y":5}, {"label":"Fn", "x":11, "y":5}, {"label":"Ctrl", "x":12, "y":5}, {"label":"\u2190", "x":13, "y":5}, {"label":"\u2193", "x":14, "y":5}, {"label":"\u2192", "x":15, "y":5}]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||
Modified 2018 Wayne K Jones <github.com/WarmCatUK>
|
||||
|
||||
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
|
||||
|
||||
#define _MAIN 0
|
||||
#define _FN 1
|
||||
|
||||
enum custom_keycodes {
|
||||
P_MACRO = SAFE_RANGE
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* 0: Main Layer
|
||||
* ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
* │ ESC │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PRSCR│ DEL │ FN │
|
||||
* ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤
|
||||
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ BACKSPACE │HOME │
|
||||
* ├─────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬────────┼─────┤
|
||||
* │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ END │
|
||||
* ├────────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴────────┼─────┤
|
||||
* │ CAPS │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ RETURN │PG_UP│
|
||||
* ├─────────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴───────┬─────┼─────┤
|
||||
* │ LSHIFT │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ RSHIFT │ UP │PG_DN│
|
||||
* ├──────┬─────┴┬────┴─┬───┴─────┴─────┴─────┴─────┴─────┴────┬┴─────┴─┬───┴────┬─────┼─────┼─────┤
|
||||
* │LCTRL │L_GUI │L_ALT │ SPACE │ R_ALT │ R_CTRL │LEFT │DOWN │RIGHT│
|
||||
* └──────┴──────┴──────┴──────────────────────────────────────┴────────┴────────┴─────┴─────┴─────┘
|
||||
*/
|
||||
[_MAIN] = LAYOUT(
|
||||
KC_ESC, 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_PSCR, KC_DEL, MO(_FN),
|
||||
KC_GRV, 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_HOME,
|
||||
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_END,
|
||||
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_PGUP,
|
||||
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_UP, KC_PGDN,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
|
||||
),
|
||||
|
||||
/* 1: Function Layer
|
||||
* ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
* │R_TOG│R_MOD│R_HUI│R_SAI│R_VAI│R_HUD│R_SAD│R_VAD│ │ │ │VOL- │VOL+ │ │ │ │
|
||||
* ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤
|
||||
* │BLTOG│BLINC│BLDEC│ £ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├─────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬────────┼─────┤
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├────────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴────────┼─────┤
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├─────────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴───────┬─────┼─────┤
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├──────┬─────┴┬────┴─┬───┴─────┴─────┴─────┴─────┴─────┴────┬┴─────┴─┬───┴────┬─────┼─────┼─────┤
|
||||
* │ │ │ │ │ │ │ │ │ │
|
||||
* └──────┴──────┴──────┴──────────────────────────────────────┴────────┴────────┴─────┴─────┴─────┘
|
||||
*/
|
||||
[_FN] = LAYOUT(
|
||||
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
BL_TOGG, BL_INC, BL_DEC, P_MACRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS ,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
// GBP £ Macro (sends alt 156 - windows users only)
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
switch(keycode) {
|
||||
case P_MACRO:
|
||||
SEND_STRING(SS_DOWN(X_LALT));
|
||||
SEND_STRING(SS_TAP(X_KP_1));
|
||||
SEND_STRING(SS_TAP(X_KP_5));
|
||||
SEND_STRING(SS_TAP(X_KP_6));
|
||||
SEND_STRING(SS_UP(X_LALT));
|
||||
return false; break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||
Modified 2018 by Wayne K Jones <github.com/WarmCatUK>
|
||||
|
||||
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 <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
void matrix_init(void) {
|
||||
// all outputs for rows high
|
||||
DDRB = 0xFF;
|
||||
PORTB = 0xFF;
|
||||
// all inputs for columns
|
||||
DDRA = 0x00;
|
||||
DDRC &= ~(0x111111<<2);
|
||||
DDRD &= ~(1<<PIND7);
|
||||
// all columns are pulled-up
|
||||
PORTA = 0xFF;
|
||||
PORTC |= (0b111111<<2);
|
||||
PORTD |= (1<<PIND7);
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix[row] = 0x00;
|
||||
matrix_debouncing[row] = 0x00;
|
||||
}
|
||||
matrix_init_quantum(); // missing from original port by Luiz
|
||||
}
|
||||
|
||||
void matrix_set_row_status(uint8_t row) {
|
||||
DDRB = (1 << row);
|
||||
PORTB = ~(1 << row);
|
||||
}
|
||||
|
||||
uint8_t bit_reverse(uint8_t x) {
|
||||
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix_set_row_status(row);
|
||||
_delay_us(5);
|
||||
|
||||
matrix_row_t cols = (
|
||||
// cols 0..7, PORTA 0 -> 7
|
||||
(~PINA) & 0xFF
|
||||
) | (
|
||||
// cols 8..13, PORTC 7 -> 0
|
||||
bit_reverse((~PINC) & 0xFF) << 8
|
||||
) | (
|
||||
// col 14, PORTD 7
|
||||
((~PIND) & (1 << PIND7)) << 7
|
||||
);
|
||||
|
||||
if (matrix_debouncing[row] != cols) {
|
||||
matrix_debouncing[row] = cols;
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
_delay_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
|
||||
//matrix_scan_user();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import usb
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: %s <firmware.hex>' % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
print('Searching for ps2avrGB... ', end='')
|
||||
|
||||
dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
|
||||
if dev is None:
|
||||
raise ValueError('Device not found')
|
||||
|
||||
print('Found', end='\n\n')
|
||||
|
||||
print('Device Information:')
|
||||
print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
|
||||
print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
|
||||
print('Manufacturer: %s' % (dev.iManufacturer))
|
||||
print('Serial: %s' % (dev.iSerialNumber))
|
||||
print('Product: %s' % (dev.iProduct), end='\n\n')
|
||||
|
||||
print('Transferring control to bootloader... ', end='')
|
||||
|
||||
dev.set_configuration()
|
||||
|
||||
request_type = usb.util.build_request_type(
|
||||
usb.util.CTRL_OUT,
|
||||
usb.util.CTRL_TYPE_CLASS,
|
||||
usb.util.CTRL_RECIPIENT_DEVICE)
|
||||
|
||||
USBRQ_HID_SET_REPORT = 0x09
|
||||
HID_REPORT_OPTION = 0x0301
|
||||
|
||||
|
||||
try:
|
||||
dev.ctrl_transfer(
|
||||
request_type,
|
||||
USBRQ_HID_SET_REPORT,
|
||||
HID_REPORT_OPTION,
|
||||
0,
|
||||
[0, 0, 0xFF] + [0] * 5
|
||||
)
|
||||
except usb.core.USBError:
|
||||
# for some reason I keep getting USBError, but it works!
|
||||
pass
|
||||
|
||||
# wait a bit until bootloader starts up
|
||||
time.sleep(2)
|
||||
|
||||
print('OK')
|
||||
print('Programming...')
|
||||
if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
|
||||
print('\nDone!')
|
@ -0,0 +1,66 @@
|
||||
# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||
# Modified 2018 Wayne Jones (WarmCatUK) <waynekjones@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/>.
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32a
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# unsupported features for now
|
||||
NO_UART = yes
|
||||
NO_SUSPEND_POWER_DOWN = yes
|
||||
|
||||
# processor frequency
|
||||
F_CPU = 12000000
|
||||
|
||||
# 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 = bootloadHID
|
||||
|
||||
# build options
|
||||
BOOTMAGIC_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes
|
||||
CONSOLE_ENABLE = no
|
||||
COMMAND_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||
NKRO_ENABLE = no
|
||||
# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
|
||||
|
||||
DISABLE_WS2812 = no
|
||||
|
||||
KEY_LOCK_ENABLE = 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
|
||||
|
||||
|
||||
#OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
# custom matrix setup
|
||||
CUSTOM_MATRIX = yes
|
||||
SRC = matrix.c i2c.c backlight.c
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
||||
|
||||
|
||||
# programming options
|
||||
PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex
|
@ -0,0 +1,396 @@
|
||||
/* Name: usbconfig.h
|
||||
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||
* Author: Christian Starkjohann
|
||||
* Creation Date: 2005-04-01
|
||||
* Tabsize: 4
|
||||
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||
*/
|
||||
|
||||
#ifndef __usbconfig_h_included__
|
||||
#define __usbconfig_h_included__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
General Description:
|
||||
This file is an example configuration (with inline documentation) for the USB
|
||||
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||
section at the end of this file).
|
||||
*/
|
||||
|
||||
/* ---------------------------- Hardware Config ---------------------------- */
|
||||
|
||||
#define USB_CFG_IOPORTNAME D
|
||||
/* This is the port where the USB bus is connected. When you configure it to
|
||||
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||
*/
|
||||
#define USB_CFG_DMINUS_BIT 3
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||
* This may be any bit in the port.
|
||||
*/
|
||||
#define USB_CFG_DPLUS_BIT 2
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||
* This may be any bit in the port. Please note that D+ must also be connected
|
||||
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||
* markers every millisecond.]
|
||||
*/
|
||||
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||
* crystal!
|
||||
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||
* not need to modify this setting.
|
||||
*/
|
||||
#define USB_CFG_CHECK_CRC 0
|
||||
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||
* currently only available for 18 MHz crystal clock. You must choose
|
||||
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||
|
||||
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||
* V+, you can connect and disconnect the device from firmware by calling
|
||||
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||
* This constant defines the port on which the pullup resistor is connected.
|
||||
*/
|
||||
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||
* above) where the 1.5k pullup resistor is connected. See description
|
||||
* above for details.
|
||||
*/
|
||||
|
||||
/* --------------------------- Functional Range ---------------------------- */
|
||||
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||
* number).
|
||||
*/
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||
*/
|
||||
#define USB_CFG_EP3_NUMBER 3
|
||||
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||
*/
|
||||
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||
/* The above macro defines the startup condition for data toggling on the
|
||||
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||
* sent with the oposite value of this configuration!
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_HALT 0
|
||||
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||
* it is required by the standard. We have made it a config option because it
|
||||
* bloats the code considerably.
|
||||
*/
|
||||
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||
* want to send any data over them. If this macro is defined to 1, functions
|
||||
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||
* you need the interrupt-in endpoints in order to comply to an interface
|
||||
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||
* of bytes in flash memory and the transmit buffers in RAM.
|
||||
*/
|
||||
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||
* low speed devices.
|
||||
*/
|
||||
#define USB_CFG_IS_SELF_POWERED 0
|
||||
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||
* device is powered from the USB bus.
|
||||
*/
|
||||
#define USB_CFG_MAX_BUS_POWER 500
|
||||
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||
* The value is in milliamperes. [It will be divided by two since USB
|
||||
* communicates power requirements in units of 2 mA.]
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||
* bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||
/* Set this to 1 if you need to send control replies which are generated
|
||||
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||
* data from a static buffer, set it to 0 and return the data from
|
||||
* usbFunctionSetup(). This saves a couple of bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||
* You must implement the function usbFunctionWriteOut() which receives all
|
||||
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||
* can be found in 'usbRxToken'.
|
||||
*/
|
||||
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||
* usbdrv.h.
|
||||
*/
|
||||
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||
* where the driver's constants (descriptors) are located. Or in other words:
|
||||
* Define this to 1 for boot loaders on the ATMega128.
|
||||
*/
|
||||
#define USB_CFG_LONG_TRANSFERS 0
|
||||
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||
* in a single control-in or control-out transfer. Note that the capability
|
||||
* for long transfers increases the driver size.
|
||||
*/
|
||||
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||
/* This macro is a hook if you want to do unconventional things. If it is
|
||||
* defined, it's inserted at the beginning of received message processing.
|
||||
* If you eat the received message and don't want default processing to
|
||||
* proceed, do a return after doing your things. One possible application
|
||||
* (besides debugging) is to flash a status LED on each packet.
|
||||
*/
|
||||
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||
* one parameter which distinguishes between the start of RESET state and its
|
||||
* end.
|
||||
*/
|
||||
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||
* received.
|
||||
*/
|
||||
#define USB_COUNT_SOF 1
|
||||
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||
* connected to D- instead of D+.
|
||||
*/
|
||||
/* #ifdef __ASSEMBLER__
|
||||
* macro myAssemblerMacro
|
||||
* in YL, TCNT0
|
||||
* sts timer0Snapshot, YL
|
||||
* endm
|
||||
* #endif
|
||||
* #define USB_SOF_HOOK myAssemblerMacro
|
||||
* This macro (if defined) is executed in the assembler module when a
|
||||
* Start Of Frame condition is detected. It is recommended to define it to
|
||||
* the name of an assembler macro which is defined here as well so that more
|
||||
* than one assembler instruction can be used. The macro may use the register
|
||||
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||
* designs running on the internal RC oscillator.
|
||||
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||
*/
|
||||
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||
* sent by the host. Duplicates occur only as a consequence of communication
|
||||
* errors, when the host does not receive an ACK. Please note that you need to
|
||||
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||
* for each control- and out-endpoint to check for duplicate packets.
|
||||
*/
|
||||
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||
*/
|
||||
#define USB_USE_FAST_CRC 0
|
||||
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||
* run the AVR close to its limit.
|
||||
*/
|
||||
|
||||
/* -------------------------- Device Description --------------------------- */
|
||||
|
||||
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||
* USB-IDs-for-free.txt for details!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||
/* Version number of the device: Minor number first, then major number.
|
||||
*/
|
||||
#define USB_CFG_VENDOR_NAME 'Y', 'M', 'D', 'K'
|
||||
#define USB_CFG_VENDOR_NAME_LEN 4
|
||||
/* These two values define the vendor name returned by the USB device. The name
|
||||
* must be given as a list of characters under single quotes. The characters
|
||||
* are interpreted as Unicode (UTF-16) entities.
|
||||
* If you don't want a vendor name string, undefine these macros.
|
||||
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||
* details.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_NAME 'Y','M','D','7','5',' ','K','e','y','b','o','a','r','d'
|
||||
#define USB_CFG_DEVICE_NAME_LEN 14
|
||||
/* Same as above for the device name. If you don't want a device name, undefine
|
||||
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||
* you use a shared VID/PID.
|
||||
*/
|
||||
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||
/* Same as above for the serial number. If you don't want a serial number,
|
||||
* undefine the macros.
|
||||
* It may be useful to provide the serial number through other means than at
|
||||
* compile time. See the section about descriptor properties below for how
|
||||
* to fine tune control over USB descriptors such as the string descriptor
|
||||
* for the serial number.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_CLASS 0
|
||||
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||
/* See USB specification if you want to conform to an existing device class.
|
||||
* Class 0xff is "vendor specific".
|
||||
*/
|
||||
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||
/* See USB specification if you want to conform to an existing device class or
|
||||
* protocol. The following classes must be set at interface level:
|
||||
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||
*/
|
||||
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||
/* Define this to the length of the HID report descriptor, if you implement
|
||||
* an HID device. Otherwise don't define it or define it to 0.
|
||||
* If you use this define, you must add a PROGMEM character array named
|
||||
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||
* Don't forget to keep the array and this define in sync!
|
||||
*/
|
||||
|
||||
/* #define USB_PUBLIC static */
|
||||
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||
* This technique saves a couple of bytes in flash memory.
|
||||
*/
|
||||
|
||||
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||
/* If you don't want to use the driver's default USB descriptors, you can
|
||||
* provide our own. These can be provided as (1) fixed length static data in
|
||||
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||
* information about this function.
|
||||
* Descriptor handling is configured through the descriptor's properties. If
|
||||
* no properties are defined or if they are 0, the default descriptor is used.
|
||||
* Possible properties are:
|
||||
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||
* you want RAM pointers.
|
||||
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||
* in static memory is in RAM, not in flash memory.
|
||||
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||
* the driver must know the descriptor's length. The descriptor itself is
|
||||
* found at the address of a well known identifier (see below).
|
||||
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||
* char usbDescriptorDevice[];
|
||||
* char usbDescriptorConfiguration[];
|
||||
* char usbDescriptorHidReport[];
|
||||
* char usbDescriptorString0[];
|
||||
* int usbDescriptorStringVendor[];
|
||||
* int usbDescriptorStringDevice[];
|
||||
* int usbDescriptorStringSerialNumber[];
|
||||
* Other descriptors can't be provided statically, they must be provided
|
||||
* dynamically at runtime.
|
||||
*
|
||||
* Descriptor properties are or-ed or added together, e.g.:
|
||||
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||
*
|
||||
* The following descriptors are defined:
|
||||
* USB_CFG_DESCR_PROPS_DEVICE
|
||||
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||
* USB_CFG_DESCR_PROPS_STRINGS
|
||||
* USB_CFG_DESCR_PROPS_STRING_0
|
||||
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||
* USB_CFG_DESCR_PROPS_HID
|
||||
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||
*
|
||||
* Note about string descriptors: String descriptors are not just strings, they
|
||||
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||
* int serialNumberDescriptor[] = {
|
||||
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||
* };
|
||||
*/
|
||||
|
||||
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||
|
||||
#define usbMsgPtr_t unsigned short
|
||||
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional MCU Description ------------------------ */
|
||||
|
||||
/* The following configurations have working defaults in usbdrv.h. You
|
||||
* usually don't need to set them explicitly. Only if you want to run
|
||||
* the driver on a device which is not yet supported or with a compiler
|
||||
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||
* interrupt than INT0, you may have to define some of these.
|
||||
*/
|
||||
/* #define USB_INTR_CFG MCUCR */
|
||||
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE GIMSK */
|
||||
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||
/* #define USB_INTR_PENDING GIFR */
|
||||
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||
/* #define USB_INTR_VECTOR INT0_vect */
|
||||
|
||||
/* Set INT1 for D- falling edge to count SOF */
|
||||
/* #define USB_INTR_CFG EICRA */
|
||||
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE EIMSK */
|
||||
#define USB_INTR_ENABLE_BIT INT1
|
||||
/* #define USB_INTR_PENDING EIFR */
|
||||
#define USB_INTR_PENDING_BIT INTF1
|
||||
#define USB_INTR_VECTOR INT1_vect
|
||||
|
||||
#endif /* __usbconfig_h_included__ */
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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 "ymd75.h"
|
||||
//#include "rgblight.h"
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "action_layer.h"
|
||||
#include "i2c.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#include "backlight.h"
|
||||
#include "backlight_custom.h"
|
||||
|
||||
// for keyboard subdirectory level init functions
|
||||
// @Override
|
||||
void matrix_init_kb(void) {
|
||||
// call user level keymaps, if any
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
/// Overrides functions in `quantum.c`
|
||||
void backlight_init_ports(void) {
|
||||
b_led_init_ports();
|
||||
}
|
||||
|
||||
void backlight_task(void) {
|
||||
b_led_task();
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
b_led_set(level);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
// custom RGB driver
|
||||
void rgblight_set(void) {
|
||||
if (!rgblight_config.enable) {
|
||||
for (uint8_t i=0; i<RGBLED_NUM; i++) {
|
||||
led[i].r = 0;
|
||||
led[i].g = 0;
|
||||
led[i].b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_init();
|
||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||
}
|
||||
|
||||
bool rgb_init = false;
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
// if LEDs were previously on before poweroff, turn them back on
|
||||
if (rgb_init == false && rgblight_config.enable) {
|
||||
i2c_init();
|
||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||
rgb_init = true;
|
||||
}
|
||||
|
||||
rgblight_task();
|
||||
#else
|
||||
void matrix_scan_kb(void) {
|
||||
#endif
|
||||
matrix_scan_user();
|
||||
/* Nothing else for now. */
|
||||
}
|
||||
|
||||
__attribute__((weak)) // overridable
|
||||
void matrix_init_user(void) {
|
||||
|
||||
}
|
||||
|
||||
__attribute__((weak)) // overridable
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Base Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||
Modified 2017 Andrew Novak <ndrw.nvk@gmail.com>
|
||||
Modified 2018 Wayne Jones (WarmCatUK) <waynekjones@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/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYMAP_COMMON_H
|
||||
#define KEYMAP_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
#include "quantum_keycodes.h"
|
||||
#include "keycode.h"
|
||||
#include "action.h"
|
||||
|
||||
void matrix_init_user(void);
|
||||
|
||||
#define LAYOUT( \
|
||||
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
||||
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
|
||||
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
|
||||
K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KD2, KE0, \
|
||||
K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, \
|
||||
K00, K10, K20, K56, K57, KB0, KC0, K96, K76, K66 \
|
||||
){ \
|
||||
{ K00, K10, K20, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB0, KC0, KD0, KC_NO }, \
|
||||
{ K01, K11, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KA1, KB1, KC_NO, KD1, KE1 }, \
|
||||
{ K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, KC_NO, KC_NO, KA2, KB2, KC_NO, KD2, KE2 }, \
|
||||
{ K03, K13, K23, K33, K43, K53, KC_NO, KC_NO, KC_NO, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \
|
||||
{ K04, K14, K24, K34, K44, K54, KC_NO, KC_NO, KC_NO, KC_NO, KA4, KB4, KC4, KC_NO, KE4 }, \
|
||||
{ K05, KC_NO, K25, K35, K45, K55, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB5, KC5, KD5, KE5 }, \
|
||||
{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6, KE6 }, \
|
||||
{ K07, K17, K27, K37, K47, K57, K67, K77, KE0, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,68 @@
|
||||
# 60_ansi
|
||||
|
||||
LAYOUT_60_ansi
|
||||
This is the standard 60% ANSI keyboard layout.
|
||||
|
||||
## Requirements
|
||||
|
||||
### 1. Layout defined
|
||||
|
||||
A keyboard's `.h` file needs to have `LAYOUT_60_ansi` defined
|
||||
|
||||
```c
|
||||
#define LAYOUT_60_ansi( \
|
||||
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K27, \
|
||||
K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
|
||||
K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
|
||||
K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \
|
||||
K30, K40, K50, K60, K70, K00, K10, K20 \
|
||||
) { \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07 }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17 }, \
|
||||
{ K20, K21, KC_NO, K23, K24, K25, KC_NO, K27 }, \
|
||||
{ K30, K31, K32, K33, K34, K35, K36, K37 }, \
|
||||
{ K40, KC_NO, K42, K43, K44, K45, K46, K47 }, \
|
||||
{ K50, K51, K52, K53, K54, K55, K56, K57 }, \
|
||||
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \
|
||||
{ K70, K71, K72, K73, K74, K75, K76, K77 } \
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
This layout needs to match the layout defined in
|
||||
|
||||
qmk_firmware/layouts/community/layout.json
|
||||
|
||||
### 2. Configuring rules.mk
|
||||
|
||||
`rules.mk` needs to have the following line:
|
||||
|
||||
LAYOUTS = 60_ansi
|
||||
|
||||
### 3. Defining a keymap
|
||||
|
||||
A keymap must be defined at
|
||||
|
||||
qmk_firmware/layouts/community/60_ansi/yourfoldername/keymap.c
|
||||
|
||||
This keymap must have a `LAYOUT_60_ansi` layout defined.
|
||||
|
||||
```c
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[BASE] = LAYOUT_60_ansi(
|
||||
KC_GESC, 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_BSLASH, \
|
||||
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_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_LGUI, KC_SPACE, MO(1), KC_RALT, KC_RGUI, KC_RCTL),
|
||||
};
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
To make generate a hex file, type
|
||||
|
||||
make yourkeyboard:yourfoldername
|
||||
|
||||
This hex file will contain a keymap with layout `LAYOUT_60_ansi` derived from
|
||||
|
||||
qmk_firmware/layouts/community/60_ansi/yourfoldername/keymap.c
|
||||
|
@ -0,0 +1,23 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include QMK_KEYBOARD_CONFIG_H
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
#define ENABLE_GAME_LAYER
|
||||
|
||||
#define TEMPLATE( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
|
||||
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
|
||||
) LAYOUT_60_hhkb( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
|
||||
K41, K42, K45, K48, K4C \
|
||||
)
|
||||
|
||||
#endif //CONFIG_USER_H
|
@ -0,0 +1 @@
|
||||
// This space intentionally left blank
|
@ -0,0 +1 @@
|
||||
USER_NAME := talljoe
|
@ -0,0 +1,25 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include QMK_KEYBOARD_CONFIG_H
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
#define ENABLE_GAME_LAYER
|
||||
|
||||
#define TEMPLATE_TKL(\
|
||||
KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \
|
||||
KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, \
|
||||
KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, \
|
||||
KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, \
|
||||
KN2, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, \
|
||||
KA4, KP2, KC6, KX1, KK6, KX2, KC0, KM3, KD0, KA1, KO0, KK0, KL0 \
|
||||
) LAYOUT_tkl_ansi( \
|
||||
KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \
|
||||
KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, \
|
||||
KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, \
|
||||
KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, \
|
||||
KN2,KC_NO,KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, \
|
||||
KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0 \
|
||||
)
|
||||
|
||||
#endif //CONFIG_USER_H
|
@ -0,0 +1,89 @@
|
||||
#ifdef KEYBOARD_zeal60
|
||||
#include "config.h"
|
||||
#include "zeal60.h"
|
||||
#include "zeal_backlight.h"
|
||||
#include "action_layer.h"
|
||||
#include "solarized.h"
|
||||
#include "talljoe.h"
|
||||
|
||||
// from zeal_backlight.c
|
||||
// we want to be able to set indicators for the spacebar stabs
|
||||
// but they are not represented by a row/index.
|
||||
extern zeal_backlight_config g_config;
|
||||
void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led );
|
||||
|
||||
void set_backlight_defaults(void) {
|
||||
uint8_t space;
|
||||
uint8_t caps_lock;
|
||||
map_row_column_to_led(3, 12, &caps_lock);
|
||||
map_row_column_to_led(4, 7, &space);
|
||||
zeal_backlight_config default_values = {
|
||||
.use_split_backspace = USE_SPLIT_BACKSPACE,
|
||||
.use_split_left_shift = USE_SPLIT_LEFT_SHIFT,
|
||||
.use_split_right_shift = USE_SPLIT_RIGHT_SHIFT,
|
||||
.use_7u_spacebar = USE_7U_SPACEBAR,
|
||||
.use_iso_enter = USE_ISO_ENTER,
|
||||
.disable_when_usb_suspended = 1,
|
||||
.disable_after_timeout = 0,
|
||||
.brightness = 255,
|
||||
.effect = 10,
|
||||
.color_1 = solarized.base2,
|
||||
.color_2 = solarized.base02,
|
||||
.caps_lock_indicator = { .index = caps_lock, .color = solarized.red },
|
||||
.layer_1_indicator = { .index = space, .color = solarized.blue },
|
||||
.layer_2_indicator = { .index = space, .color = solarized.yellow },
|
||||
.layer_3_indicator = { .index = 254, .color = solarized.red },
|
||||
.alphas_mods = {
|
||||
BACKLIGHT_ALPHAS_MODS_ROW_0,
|
||||
BACKLIGHT_ALPHAS_MODS_ROW_1,
|
||||
BACKLIGHT_ALPHAS_MODS_ROW_2,
|
||||
BACKLIGHT_ALPHAS_MODS_ROW_3,
|
||||
BACKLIGHT_ALPHAS_MODS_ROW_4 }
|
||||
};
|
||||
memcpy(&g_config, &default_values, sizeof(zeal_backlight_config));
|
||||
backlight_config_save();
|
||||
|
||||
solarized_t* S = &solarized;
|
||||
HSV alphas = S->base2;
|
||||
HSV custom_color_map[MATRIX_ROWS][MATRIX_COLS] = CM(
|
||||
S->red, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->red,
|
||||
S->orange, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->orange,
|
||||
S->green, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->green,
|
||||
S->blue, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->blue, S->blue,
|
||||
S->violet, S->magenta, S->yellow, alphas, S->yellow, S->magenta, S->violet, S->green
|
||||
);
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
|
||||
backlight_set_key_color(row, col, custom_color_map[row][col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint8_t last_effect;
|
||||
switch (keycode) {
|
||||
case DFAULTS:
|
||||
if (IS_PRESSED(record->event)) set_backlight_defaults();
|
||||
return false;
|
||||
case BL_TOGG:
|
||||
if (IS_PRESSED(record->event)) {
|
||||
if (g_config.effect) {
|
||||
last_effect = g_config.effect;
|
||||
g_config.effect = 0;
|
||||
} else {
|
||||
g_config.effect = last_effect;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case EFFECT...EFFECT_END:
|
||||
if (IS_PRESSED(record->event)) {
|
||||
uint8_t effect = keycode - EFFECT;
|
||||
g_config.effect = effect;
|
||||
backlight_config_save();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
USER_NAME := talljoe
|
@ -0,0 +1,65 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#define BASE 0
|
||||
#define HHKB 1
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* BASE Level: Default Layer
|
||||
|-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
|
||||
| Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
||||
|-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
|
||||
| Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | |
|
||||
|-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
|
||||
| Cont | A | S | D | F | G | H | J | K | L | ; | ' | Ent | | |
|
||||
|-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
|
||||
| Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | |
|
||||
|-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
|
||||
|
||||
|------+------+-----------------------+------+------|
|
||||
| LAlt | LGUI | ******* Space ******* | RGUI | RAlt |
|
||||
|------+------+-----------------------+------+------|
|
||||
*/
|
||||
|
||||
[BASE] = LAYOUT_60_hhkb( // default layer
|
||||
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_BSLS, KC_GRV, \
|
||||
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_BSPC, \
|
||||
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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), \
|
||||
KC_LALT, KC_LGUI, /* */ KC_SPC, KC_RGUI, KC_RALT),
|
||||
|
||||
|
||||
|
||||
/* Layer HHKB: HHKB mode (HHKB Fn)
|
||||
|------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
|
||||
| Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del |
|
||||
|------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
|
||||
| Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | |
|
||||
|------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
|
||||
| | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | |
|
||||
|------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
|
||||
| | | | | | | + | - | End | PgD | Dow | | | | |
|
||||
|------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
|
||||
|
||||
|------+------+----------------------+------+------+
|
||||
| **** | **** | ******************** | **** | **** |
|
||||
|------+------+----------------------+------+------+
|
||||
|
||||
*/
|
||||
|
||||
[HHKB] = LAYOUT_60_hhkb(
|
||||
KC_PWR, 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_INS, KC_DEL, \
|
||||
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \
|
||||
KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, \
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)};
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void) {
|
||||
|
||||
};
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
["Esc","!\n1","@\n2","#\n3","$\n4","%\n5","^\n6","&\n7","*\n8","(\n9",")\n0","_\n-","+\n=","|\n\\","~\n`"],
|
||||
[{w:1.5},"Tab","Q","W","E","R","T","Y","U","I","O","P","{\n[","}\n]",{w:1.5},"Delete"],
|
||||
[{w:1.75},"Control","A","S","D","F","G","H","J","K","L",":\n;","\"\n'",{w:2.25},"Enter"],
|
||||
[{w:2.25},"Shift","Z","X","C","V","B","N","M","<\n,",">\n.","?\n/",{w:1.75},"Shift","Fn"],
|
||||
[{x:1.5},"Os",{w:1.5},"Alt",{a:7,w:7},"",{a:4,w:1.5},"Alt","Os"]
|
@ -0,0 +1,3 @@
|
||||
# 60_hhkb
|
||||
|
||||
LAYOUT_60_hhkb
|
@ -0,0 +1,11 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_tkl_ansi(\
|
||||
KC_ESC, 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_PSCR,KC_SLCK,KC_PAUS, \
|
||||
KC_GRV, 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_INS ,KC_HOME,KC_PGUP, \
|
||||
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_PGDN, \
|
||||
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_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, \
|
||||
KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT \
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
["Esc",{x:1},"F1","F2","F3","F4",{x:0.5},"F5","F6","F7","F8",{x:0.5},"F9","F10","F11","F12",{x:0.25},"PrtSc","Scroll Lock","Pause\nBreak"],
|
||||
[{y:0.5},"~\n`","!\n1","@\n2","#\n3","$\n4","%\n5","^\n6","&\n7","*\n8","(\n9",")\n0","_\n-","+\n=",{w:2},"Backspace",{x:0.25},"Insert","Home","PgUp"],
|
||||
[{w:1.5},"Tab","Q","W","E","R","T","Y","U","I","O","P","{\n[","}\n]",{w:1.5},"|\n\\",{x:0.25},"Delete","End","PgDn"],
|
||||
[{w:1.75},"Caps Lock","A","S","D","F","G","H","J","K","L",":\n;","\"\n'",{w:2.25},"Enter"],
|
||||
[{w:2.25},"Shift","Z","X","C","V","B","N","M","<\n,",">\n.","?\n/",{w:2.75},"Shift",{x:1.25},"↑"],
|
||||
[{w:1.25},"Ctrl",{w:1.25},"Win",{w:1.25},"Alt",{a:7,w:6.25},"",{a:4,w:1.25},"Alt",{w:1.25},"Win",{w:1.25},"Menu",{w:1.25},"Ctrl",{x:0.25},"←","↓","→"]
|
@ -0,0 +1,3 @@
|
||||
# tkl_ansi
|
||||
|
||||
LAYOUT_tkl_ansi
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
|
||||
/* Copyright 2018 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
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
|
||||
/* Copyright 2018 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
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
|
||||
/* Copyright 2018 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
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
|
||||
/* Copyright 2018 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
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#define VENDOR_ID 0x20A0
|
||||
#define PRODUCT_ID 0x422D
|
||||
#define MANUFACTURER You
|
||||
#define PRODUCT %KEYBOARD%
|
||||
|
||||
#define RGBLED_NUM 16
|
||||
|
||||
#define MATRIX_ROWS 2
|
||||
#define MATRIX_COLS 3
|
||||
|
||||
#define MATRIX_ROW_PINS { D0, D5 }
|
||||
#define MATRIX_COL_PINS { F1, F0, B0 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
#define NO_BACKLIGHT_CLOCK
|
||||
#define BACKLIGHT_LEVELS 1
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
|
||||
#define NO_UART 1
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
#endif
|
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
// Please do not modify this file
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||
if (bitrate_div >= 16) {
|
||||
bitrate_div = (bitrate_div - 16) / 2;
|
||||
}
|
||||
TWBR = bitrate_div;
|
||||
}
|
||||
|
||||
void i2c_init(void) {
|
||||
// set pull-up resistors on I2C bus pins
|
||||
PORTC |= 0b11;
|
||||
|
||||
i2c_set_bitrate(400);
|
||||
|
||||
// enable TWI (two-wire interface)
|
||||
TWCR |= (1 << TWEN);
|
||||
|
||||
// enable TWI interrupt and slave address ACK
|
||||
TWCR |= (1 << TWIE);
|
||||
TWCR |= (1 << TWEA);
|
||||
}
|
||||
|
||||
uint8_t i2c_start(uint8_t address) {
|
||||
// reset TWI control register
|
||||
TWCR = 0;
|
||||
|
||||
// begin transmission and wait for it to end
|
||||
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the start condition was successfully transmitted
|
||||
if ((TWSR & 0xF8) != TW_START) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// transmit address and wait
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
// check if the device has acknowledged the READ / WRITE mode
|
||||
uint8_t twst = TW_STATUS & 0xF8;
|
||||
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
}
|
||||
|
||||
uint8_t i2c_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
|
||||
// transmit data and wait
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
while (!(TWCR & (1<<TWINT)));
|
||||
|
||||
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||
if (i2c_start(address)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < length; i++) {
|
||||
if (i2c_write(data[i])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_stop();
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||
*/
|
||||
|
||||
// Please do not modify this file
|
||||
|
||||
#ifndef __I2C_H__
|
||||
#define __I2C_H__
|
||||
|
||||
void i2c_init(void);
|
||||
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||
|
||||
#endif
|
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright 2017 Luiz Ribeiro <luizribeiro@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 <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
#define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
void matrix_init(void) {
|
||||
// all outputs for rows high
|
||||
DDRB = 0xFF;
|
||||
PORTB = 0xFF;
|
||||
// all inputs for columns
|
||||
DDRA = 0x00;
|
||||
DDRC &= ~(0x111111<<2);
|
||||
DDRD &= ~(1<<PIND7);
|
||||
// all columns are pulled-up
|
||||
PORTA = 0xFF;
|
||||
PORTC |= (0b111111<<2);
|
||||
PORTD |= (1<<PIND7);
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix[row] = 0x00;
|
||||
matrix_debouncing[row] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_set_row_status(uint8_t row) {
|
||||
DDRB = (1 << row);
|
||||
PORTB = ~(1 << row);
|
||||
}
|
||||
|
||||
uint8_t bit_reverse(uint8_t x) {
|
||||
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix_set_row_status(row);
|
||||
_delay_us(5);
|
||||
|
||||
matrix_row_t cols = (
|
||||
// cols 0..7, PORTA 0 -> 7
|
||||
(~PINA) & 0xFF
|
||||
) | (
|
||||
// cols 8..13, PORTC 7 -> 0
|
||||
bit_reverse((~PINC) & 0xFF) << 8
|
||||
) | (
|
||||
// col 14, PORTD 7
|
||||
((~PIND) & (1 << PIND7)) << 7
|
||||
);
|
||||
|
||||
if (matrix_debouncing[row] != cols) {
|
||||
matrix_debouncing[row] = cols;
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
_delay_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
matrix_scan_user();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32a
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# unsupported features for now
|
||||
NO_UART = yes
|
||||
NO_SUSPEND_POWER_DOWN = yes
|
||||
|
||||
# processor frequency
|
||||
F_CPU = 12000000
|
||||
|
||||
# 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 = bootloadHID
|
||||
|
||||
# build options
|
||||
BOOTMAGIC_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
COMMAND_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||
|
||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
# custom matrix setup
|
||||
CUSTOM_MATRIX = yes
|
||||
SRC = matrix.c i2c.c
|
||||
|
||||
# programming options
|
||||
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
@ -0,0 +1,25 @@
|
||||
/* Copyright 2018 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/>.
|
||||
*/
|
||||
#include "%KEYBOARD%.h"
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "action_layer.h"
|
||||
#include "i2c.h"
|
||||
#include "quantum.h"
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/* Copyright 2018 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 %KEYBOARD_UPPERCASE%_H
|
||||
#define %KEYBOARD_UPPERCASE%_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
// This a shortcut to help you visually see your layout.
|
||||
// The following is an example using the Planck MIT layout
|
||||
// The first section contains all of the arguments
|
||||
// The second converts the arguments into a two-dimensional array
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, \
|
||||
k10, k11 \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02 }, \
|
||||
{ k10, KC_NO, k11 }, \
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,396 @@
|
||||
/* Name: usbconfig.h
|
||||
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||
* Author: Christian Starkjohann
|
||||
* Creation Date: 2005-04-01
|
||||
* Tabsize: 4
|
||||
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||
*/
|
||||
|
||||
#ifndef __usbconfig_h_included__
|
||||
#define __usbconfig_h_included__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
General Description:
|
||||
This file is an example configuration (with inline documentation) for the USB
|
||||
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||
section at the end of this file).
|
||||
*/
|
||||
|
||||
/* ---------------------------- Hardware Config ---------------------------- */
|
||||
|
||||
#define USB_CFG_IOPORTNAME D
|
||||
/* This is the port where the USB bus is connected. When you configure it to
|
||||
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||
*/
|
||||
#define USB_CFG_DMINUS_BIT 3
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||
* This may be any bit in the port.
|
||||
*/
|
||||
#define USB_CFG_DPLUS_BIT 2
|
||||
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||
* This may be any bit in the port. Please note that D+ must also be connected
|
||||
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||
* markers every millisecond.]
|
||||
*/
|
||||
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||
* crystal!
|
||||
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||
* not need to modify this setting.
|
||||
*/
|
||||
#define USB_CFG_CHECK_CRC 0
|
||||
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||
* currently only available for 18 MHz crystal clock. You must choose
|
||||
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||
|
||||
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||
* V+, you can connect and disconnect the device from firmware by calling
|
||||
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||
* This constant defines the port on which the pullup resistor is connected.
|
||||
*/
|
||||
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||
* above) where the 1.5k pullup resistor is connected. See description
|
||||
* above for details.
|
||||
*/
|
||||
|
||||
/* --------------------------- Functional Range ---------------------------- */
|
||||
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||
* number).
|
||||
*/
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||
*/
|
||||
#define USB_CFG_EP3_NUMBER 3
|
||||
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||
*/
|
||||
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||
/* The above macro defines the startup condition for data toggling on the
|
||||
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||
* sent with the oposite value of this configuration!
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_HALT 0
|
||||
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||
* it is required by the standard. We have made it a config option because it
|
||||
* bloats the code considerably.
|
||||
*/
|
||||
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||
* want to send any data over them. If this macro is defined to 1, functions
|
||||
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||
* you need the interrupt-in endpoints in order to comply to an interface
|
||||
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||
* of bytes in flash memory and the transmit buffers in RAM.
|
||||
*/
|
||||
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||
* low speed devices.
|
||||
*/
|
||||
#define USB_CFG_IS_SELF_POWERED 0
|
||||
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||
* device is powered from the USB bus.
|
||||
*/
|
||||
#define USB_CFG_MAX_BUS_POWER 500
|
||||
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||
* The value is in milliamperes. [It will be divided by two since USB
|
||||
* communicates power requirements in units of 2 mA.]
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||
* bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||
/* Set this to 1 if you need to send control replies which are generated
|
||||
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||
* data from a static buffer, set it to 0 and return the data from
|
||||
* usbFunctionSetup(). This saves a couple of bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||
* You must implement the function usbFunctionWriteOut() which receives all
|
||||
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||
* can be found in 'usbRxToken'.
|
||||
*/
|
||||
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||
* usbdrv.h.
|
||||
*/
|
||||
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||
* where the driver's constants (descriptors) are located. Or in other words:
|
||||
* Define this to 1 for boot loaders on the ATMega128.
|
||||
*/
|
||||
#define USB_CFG_LONG_TRANSFERS 0
|
||||
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||
* in a single control-in or control-out transfer. Note that the capability
|
||||
* for long transfers increases the driver size.
|
||||
*/
|
||||
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||
/* This macro is a hook if you want to do unconventional things. If it is
|
||||
* defined, it's inserted at the beginning of received message processing.
|
||||
* If you eat the received message and don't want default processing to
|
||||
* proceed, do a return after doing your things. One possible application
|
||||
* (besides debugging) is to flash a status LED on each packet.
|
||||
*/
|
||||
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||
* one parameter which distinguishes between the start of RESET state and its
|
||||
* end.
|
||||
*/
|
||||
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||
* received.
|
||||
*/
|
||||
#define USB_COUNT_SOF 1
|
||||
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||
* connected to D- instead of D+.
|
||||
*/
|
||||
/* #ifdef __ASSEMBLER__
|
||||
* macro myAssemblerMacro
|
||||
* in YL, TCNT0
|
||||
* sts timer0Snapshot, YL
|
||||
* endm
|
||||
* #endif
|
||||
* #define USB_SOF_HOOK myAssemblerMacro
|
||||
* This macro (if defined) is executed in the assembler module when a
|
||||
* Start Of Frame condition is detected. It is recommended to define it to
|
||||
* the name of an assembler macro which is defined here as well so that more
|
||||
* than one assembler instruction can be used. The macro may use the register
|
||||
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||
* designs running on the internal RC oscillator.
|
||||
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||
*/
|
||||
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||
* sent by the host. Duplicates occur only as a consequence of communication
|
||||
* errors, when the host does not receive an ACK. Please note that you need to
|
||||
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||
* for each control- and out-endpoint to check for duplicate packets.
|
||||
*/
|
||||
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||
*/
|
||||
#define USB_USE_FAST_CRC 0
|
||||
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||
* run the AVR close to its limit.
|
||||
*/
|
||||
|
||||
/* -------------------------- Device Description --------------------------- */
|
||||
|
||||
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||
* USB-IDs-for-free.txt for details!
|
||||
* *** IMPORTANT NOTE ***
|
||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||
* the implications!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||
/* Version number of the device: Minor number first, then major number.
|
||||
*/
|
||||
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
|
||||
#define USB_CFG_VENDOR_NAME_LEN 13
|
||||
/* These two values define the vendor name returned by the USB device. The name
|
||||
* must be given as a list of characters under single quotes. The characters
|
||||
* are interpreted as Unicode (UTF-16) entities.
|
||||
* If you don't want a vendor name string, undefine these macros.
|
||||
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||
* details.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
|
||||
#define USB_CFG_DEVICE_NAME_LEN 8
|
||||
/* Same as above for the device name. If you don't want a device name, undefine
|
||||
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||
* you use a shared VID/PID.
|
||||
*/
|
||||
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||
/* Same as above for the serial number. If you don't want a serial number,
|
||||
* undefine the macros.
|
||||
* It may be useful to provide the serial number through other means than at
|
||||
* compile time. See the section about descriptor properties below for how
|
||||
* to fine tune control over USB descriptors such as the string descriptor
|
||||
* for the serial number.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_CLASS 0
|
||||
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||
/* See USB specification if you want to conform to an existing device class.
|
||||
* Class 0xff is "vendor specific".
|
||||
*/
|
||||
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||
/* See USB specification if you want to conform to an existing device class or
|
||||
* protocol. The following classes must be set at interface level:
|
||||
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||
*/
|
||||
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||
/* Define this to the length of the HID report descriptor, if you implement
|
||||
* an HID device. Otherwise don't define it or define it to 0.
|
||||
* If you use this define, you must add a PROGMEM character array named
|
||||
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||
* Don't forget to keep the array and this define in sync!
|
||||
*/
|
||||
|
||||
/* #define USB_PUBLIC static */
|
||||
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||
* This technique saves a couple of bytes in flash memory.
|
||||
*/
|
||||
|
||||
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||
/* If you don't want to use the driver's default USB descriptors, you can
|
||||
* provide our own. These can be provided as (1) fixed length static data in
|
||||
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||
* information about this function.
|
||||
* Descriptor handling is configured through the descriptor's properties. If
|
||||
* no properties are defined or if they are 0, the default descriptor is used.
|
||||
* Possible properties are:
|
||||
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||
* you want RAM pointers.
|
||||
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||
* in static memory is in RAM, not in flash memory.
|
||||
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||
* the driver must know the descriptor's length. The descriptor itself is
|
||||
* found at the address of a well known identifier (see below).
|
||||
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||
* char usbDescriptorDevice[];
|
||||
* char usbDescriptorConfiguration[];
|
||||
* char usbDescriptorHidReport[];
|
||||
* char usbDescriptorString0[];
|
||||
* int usbDescriptorStringVendor[];
|
||||
* int usbDescriptorStringDevice[];
|
||||
* int usbDescriptorStringSerialNumber[];
|
||||
* Other descriptors can't be provided statically, they must be provided
|
||||
* dynamically at runtime.
|
||||
*
|
||||
* Descriptor properties are or-ed or added together, e.g.:
|
||||
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||
*
|
||||
* The following descriptors are defined:
|
||||
* USB_CFG_DESCR_PROPS_DEVICE
|
||||
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||
* USB_CFG_DESCR_PROPS_STRINGS
|
||||
* USB_CFG_DESCR_PROPS_STRING_0
|
||||
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||
* USB_CFG_DESCR_PROPS_HID
|
||||
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||
*
|
||||
* Note about string descriptors: String descriptors are not just strings, they
|
||||
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||
* int serialNumberDescriptor[] = {
|
||||
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||
* };
|
||||
*/
|
||||
|
||||
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||
|
||||
#define usbMsgPtr_t unsigned short
|
||||
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||
*/
|
||||
|
||||
/* ----------------------- Optional MCU Description ------------------------ */
|
||||
|
||||
/* The following configurations have working defaults in usbdrv.h. You
|
||||
* usually don't need to set them explicitly. Only if you want to run
|
||||
* the driver on a device which is not yet supported or with a compiler
|
||||
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||
* interrupt than INT0, you may have to define some of these.
|
||||
*/
|
||||
/* #define USB_INTR_CFG MCUCR */
|
||||
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE GIMSK */
|
||||
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||
/* #define USB_INTR_PENDING GIFR */
|
||||
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||
/* #define USB_INTR_VECTOR INT0_vect */
|
||||
|
||||
/* Set INT1 for D- falling edge to count SOF */
|
||||
/* #define USB_INTR_CFG EICRA */
|
||||
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||
/* #define USB_INTR_CFG_CLR 0 */
|
||||
/* #define USB_INTR_ENABLE EIMSK */
|
||||
#define USB_INTR_ENABLE_BIT INT1
|
||||
/* #define USB_INTR_PENDING EIFR */
|
||||
#define USB_INTR_PENDING_BIT INTF1
|
||||
#define USB_INTR_VECTOR INT1_vect
|
||||
|
||||
#endif /* __usbconfig_h_included__ */
|
@ -1,3 +1,7 @@
|
||||
SRC += talljoe.c
|
||||
SRC += talljoe.c tapdance.c
|
||||
|
||||
EXTRAFLAGS+=-flto
|
||||
|
||||
TAP_DANCE_ENABLE=yes
|
||||
CONSOLE_ENABLE=no
|
||||
COMMAND_ENABLE=no
|
||||
|
@ -0,0 +1,34 @@
|
||||
//Tap Dance
|
||||
#include "talljoe.h"
|
||||
|
||||
// Send semin-colon + enter on two taps
|
||||
void tap_dance_semicolon(qk_tap_dance_state_t *state, void *user_data) {
|
||||
switch(state->count) {
|
||||
case 1:
|
||||
register_code(KC_SCLN);
|
||||
unregister_code(KC_SCLN);
|
||||
break;
|
||||
case 2:
|
||||
register_code(KC_SCLN);
|
||||
unregister_code(KC_SCLN);
|
||||
|
||||
uint8_t mods = get_mods();
|
||||
if (mods) {
|
||||
clear_mods();
|
||||
}
|
||||
|
||||
register_code(KC_ENT);
|
||||
unregister_code(KC_ENT);
|
||||
|
||||
if (mods) {
|
||||
set_mods(mods);
|
||||
}
|
||||
|
||||
reset_tap_dance(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_SEMICOLON] = ACTION_TAP_DANCE_FN(tap_dance_semicolon),
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
|
||||
# Xton has Vim!
|
||||
|
||||
Contains common code for Xton's vim emulation (vimulation?) layer.
|
||||
|
||||
Inspired/stolen from the `ergodox_ez/vim` keymap. Rewritten to be a more straightforward state machine and support more macros. Vim layers `_CMD` and `_EDIT` are designed to lay on top of an otherwise fully-functional layout. `_CMD` runs the entire vim state machine while `_EDIT` should lay across your base layer and mask off just the escape key.
|
||||
|
||||
Works via OSX text editing shortcuts, mainly MOD+arrow combinations. This has some limitations and only works on OSX.
|
||||
|
||||
The `_CMD` layer will temporarily disable itself while *CMD* or *ALT* are held down so that typical OSX shortcuts can be used without switching out of vim mode.
|
@ -0,0 +1 @@
|
||||
SRC += xtonhasvim.c
|
@ -0,0 +1,615 @@
|
||||
/* Copyright 2015-2017 Christon DeWan
|
||||
*
|
||||
* 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 "xtonhasvim.h"
|
||||
|
||||
/************************************
|
||||
* helper foo
|
||||
************************************/
|
||||
|
||||
#define PRESS(kc) register_code(kc)
|
||||
#define RELEASE(kc) unregister_code(kc)
|
||||
|
||||
static void TAP(uint16_t keycode) {
|
||||
PRESS(keycode);
|
||||
RELEASE(keycode);
|
||||
}
|
||||
|
||||
static void CMD(uint16_t keycode) {
|
||||
PRESS(KC_LGUI);
|
||||
TAP(keycode);
|
||||
RELEASE(KC_LGUI);
|
||||
}
|
||||
|
||||
static void CTRL(uint16_t keycode) {
|
||||
PRESS(KC_LCTRL);
|
||||
TAP(keycode);
|
||||
RELEASE(KC_LCTRL);
|
||||
}
|
||||
|
||||
static void SHIFT(uint16_t keycode) {
|
||||
PRESS(KC_LSHIFT);
|
||||
TAP(keycode);
|
||||
RELEASE(KC_LSHIFT);
|
||||
}
|
||||
|
||||
static void ALT(uint16_t keycode) {
|
||||
PRESS(KC_LALT);
|
||||
TAP(keycode);
|
||||
RELEASE(KC_LALT);
|
||||
}
|
||||
|
||||
|
||||
static uint16_t vstate = VIM_START;
|
||||
static bool yank_was_lines = false;
|
||||
static bool SHIFTED = false;
|
||||
static uint32_t mod_override_layer_state = 0;
|
||||
static uint16_t mod_override_triggering_key = 0;
|
||||
|
||||
static void edit(void) { vstate = VIM_START; layer_on(_EDIT); layer_off(_CMD); }
|
||||
#define EDIT edit()
|
||||
|
||||
|
||||
static void simple_movement(uint16_t keycode) {
|
||||
switch(keycode) {
|
||||
case VIM_B:
|
||||
PRESS(KC_LALT);
|
||||
SHIFT(KC_LEFT); // select to start of this word
|
||||
RELEASE(KC_LALT);
|
||||
break;
|
||||
case VIM_E:
|
||||
PRESS(KC_LALT);
|
||||
SHIFT(KC_RIGHT); // select to end of this word
|
||||
RELEASE(KC_LALT);
|
||||
break;
|
||||
case VIM_H:
|
||||
SHIFT(KC_LEFT);
|
||||
break;
|
||||
case VIM_J:
|
||||
CMD(KC_LEFT);
|
||||
SHIFT(KC_DOWN);
|
||||
SHIFT(KC_DOWN);
|
||||
break;
|
||||
case VIM_K:
|
||||
CMD(KC_LEFT);
|
||||
TAP(KC_DOWN);
|
||||
SHIFT(KC_UP);
|
||||
SHIFT(KC_UP);
|
||||
break;
|
||||
case VIM_L:
|
||||
SHIFT(KC_RIGHT);
|
||||
break;
|
||||
case VIM_W:
|
||||
PRESS(KC_LALT);
|
||||
SHIFT(KC_RIGHT); // select to end of this word
|
||||
SHIFT(KC_RIGHT); // select to end of next word
|
||||
SHIFT(KC_LEFT); // select to start of next word
|
||||
RELEASE(KC_LALT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#define PASS_THRU process_record_keymap(keycode, record)
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if(record->event.pressed && layer_state_is(_CMD) && IS_MOD(keycode)) {
|
||||
mod_override_layer_state = layer_state;
|
||||
mod_override_triggering_key = keycode;
|
||||
layer_clear();
|
||||
return PASS_THRU; // let the event fall through...
|
||||
}
|
||||
if(mod_override_layer_state && !record->event.pressed && keycode == mod_override_triggering_key) {
|
||||
layer_state_set(mod_override_layer_state);
|
||||
mod_override_layer_state = 0;
|
||||
mod_override_triggering_key = 0;
|
||||
return PASS_THRU;
|
||||
}
|
||||
|
||||
if (VIM_START <= keycode && keycode <= VIM_ESC) {
|
||||
if(keycode == VIM_SHIFT) {
|
||||
SHIFTED = record->event.pressed;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (record->event.pressed) {
|
||||
if(keycode == VIM_START) {
|
||||
// entry from anywhere
|
||||
layer_on(_CMD);
|
||||
vstate = VIM_START;
|
||||
|
||||
// reset state
|
||||
yank_was_lines = false;
|
||||
SHIFTED = false;
|
||||
mod_override_layer_state = 0;
|
||||
mod_override_triggering_key = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
switch(vstate) {
|
||||
case VIM_START:
|
||||
switch(keycode){
|
||||
/*****************************
|
||||
* ground state
|
||||
*****************************/
|
||||
case VIM_A:
|
||||
if(SHIFTED) {
|
||||
// CMD(KC_RIGHT);
|
||||
CTRL(KC_E);
|
||||
} else {
|
||||
TAP(KC_RIGHT);
|
||||
}
|
||||
EDIT;
|
||||
break;
|
||||
case VIM_B:
|
||||
PRESS(KC_LALT);
|
||||
PRESS(KC_LEFT);
|
||||
break;
|
||||
case VIM_C:
|
||||
if(SHIFTED) {
|
||||
PRESS(KC_LSHIFT);
|
||||
CMD(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
} else {
|
||||
vstate = VIM_C;
|
||||
}
|
||||
break;
|
||||
case VIM_D:
|
||||
if(SHIFTED) {
|
||||
TAP(KC_K);
|
||||
} else {
|
||||
vstate = VIM_D;
|
||||
}
|
||||
break;
|
||||
case VIM_E:
|
||||
PRESS(KC_LALT);
|
||||
PRESS(KC_RIGHT);
|
||||
break;
|
||||
case VIM_G:
|
||||
if(SHIFTED) {
|
||||
TAP(KC_END);
|
||||
} else {
|
||||
vstate = VIM_G;
|
||||
}
|
||||
break;
|
||||
case VIM_H:
|
||||
PRESS(KC_LEFT);
|
||||
break;
|
||||
case VIM_I:
|
||||
if(SHIFTED){
|
||||
CTRL(KC_A);
|
||||
}
|
||||
EDIT;
|
||||
break;
|
||||
case VIM_J:
|
||||
if(SHIFTED) {
|
||||
CMD(KC_RIGHT);
|
||||
TAP(KC_DEL);
|
||||
} else {
|
||||
PRESS(KC_DOWN);
|
||||
}
|
||||
break;
|
||||
case VIM_K:
|
||||
PRESS(KC_UP);
|
||||
break;
|
||||
case VIM_L:
|
||||
PRESS(KC_RIGHT);
|
||||
break;
|
||||
case VIM_O:
|
||||
if(SHIFTED) {
|
||||
CMD(KC_LEFT);
|
||||
TAP(KC_ENTER);
|
||||
TAP(KC_UP);
|
||||
EDIT;
|
||||
} else {
|
||||
CMD(KC_RIGHT);
|
||||
TAP(KC_ENTER);
|
||||
EDIT;
|
||||
}
|
||||
break;
|
||||
case VIM_P:
|
||||
if(SHIFTED) {
|
||||
CMD(KC_LEFT);
|
||||
CMD(KC_V);
|
||||
} else {
|
||||
if(yank_was_lines) {
|
||||
CMD(KC_RIGHT);
|
||||
TAP(KC_RIGHT);
|
||||
CMD(KC_V);
|
||||
} else {
|
||||
CMD(KC_V);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VIM_S:
|
||||
// s for substitute?
|
||||
if(SHIFTED) {
|
||||
CMD(KC_LEFT);
|
||||
PRESS(KC_LSHIFT);
|
||||
CMD(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
} else {
|
||||
SHIFT(KC_RIGHT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
}
|
||||
break;
|
||||
case VIM_U:
|
||||
if(SHIFTED) {
|
||||
PRESS(KC_LSFT);
|
||||
CMD(KC_Z);
|
||||
RELEASE(KC_LSHIFT);
|
||||
} else {
|
||||
CMD(KC_Z);
|
||||
}
|
||||
break;
|
||||
case VIM_V:
|
||||
if(SHIFTED) {
|
||||
CMD(KC_LEFT);
|
||||
SHIFT(KC_DOWN);
|
||||
vstate = VIM_VS;
|
||||
} else {
|
||||
vstate = VIM_V;
|
||||
}
|
||||
break;
|
||||
case VIM_W:
|
||||
PRESS(KC_LALT);
|
||||
TAP(KC_RIGHT);
|
||||
TAP(KC_RIGHT);
|
||||
TAP(KC_LEFT);
|
||||
RELEASE(KC_LALT);
|
||||
break;
|
||||
case VIM_X:
|
||||
// SHIFT(KC_RIGHT);
|
||||
// CMD(KC_X);
|
||||
PRESS(KC_DEL);
|
||||
break;
|
||||
case VIM_Y:
|
||||
if(SHIFTED) {
|
||||
CMD(KC_LEFT);
|
||||
SHIFT(KC_DOWN);
|
||||
CMD(KC_C);
|
||||
TAP(KC_RIGHT);
|
||||
yank_was_lines = true;
|
||||
} else {
|
||||
vstate = VIM_Y;
|
||||
}
|
||||
break;
|
||||
case VIM_COMMA:
|
||||
if(SHIFTED) {
|
||||
// indent
|
||||
CMD(KC_LBRACKET);
|
||||
} else {
|
||||
// toggle comment
|
||||
CMD(KC_SLASH);
|
||||
}
|
||||
break;
|
||||
case VIM_PERIOD:
|
||||
if(SHIFTED) {
|
||||
// outdent
|
||||
CMD(KC_RBRACKET);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_C:
|
||||
/*****************************
|
||||
* c- ...for change. I never use this...
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_B:
|
||||
case VIM_E:
|
||||
case VIM_H:
|
||||
case VIM_J:
|
||||
case VIM_K:
|
||||
case VIM_L:
|
||||
case VIM_W:
|
||||
simple_movement(keycode);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
break;
|
||||
|
||||
case VIM_C:
|
||||
CMD(KC_LEFT);
|
||||
PRESS(KC_LSHIFT);
|
||||
CMD(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
break;
|
||||
case VIM_I:
|
||||
vstate = VIM_CI;
|
||||
break;
|
||||
default:
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_CI:
|
||||
/*****************************
|
||||
* ci- ...change inner word
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_W:
|
||||
ALT(KC_LEFT);
|
||||
PRESS(KC_LSHIFT);
|
||||
ALT(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
EDIT;
|
||||
default:
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_D:
|
||||
/*****************************
|
||||
* d- ...delete stuff
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_B:
|
||||
case VIM_E:
|
||||
case VIM_H:
|
||||
case VIM_J:
|
||||
case VIM_K:
|
||||
case VIM_L:
|
||||
case VIM_W:
|
||||
simple_movement(keycode);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_D:
|
||||
CMD(KC_LEFT);
|
||||
SHIFT(KC_DOWN);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = true;
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_I:
|
||||
vstate = VIM_DI;
|
||||
break;
|
||||
default:
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_DI:
|
||||
/*****************************
|
||||
* ci- ...delete a word... FROM THE INSIDE!
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_W:
|
||||
ALT(KC_LEFT);
|
||||
PRESS(KC_LSHIFT);
|
||||
ALT(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
vstate = VIM_START;
|
||||
default:
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_V:
|
||||
/*****************************
|
||||
* visual!
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_D:
|
||||
case VIM_X:
|
||||
CMD(KC_X);
|
||||
yank_was_lines = false;
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_B:
|
||||
PRESS(KC_LALT);
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_LEFT);
|
||||
// leave open for key repeat
|
||||
break;
|
||||
case VIM_E:
|
||||
PRESS(KC_LALT);
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_RIGHT);
|
||||
// leave open for key repeat
|
||||
break;
|
||||
case VIM_H:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_LEFT);
|
||||
break;
|
||||
case VIM_I:
|
||||
vstate = VIM_VI;
|
||||
break;
|
||||
case VIM_J:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_DOWN);
|
||||
break;
|
||||
case VIM_K:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_UP);
|
||||
break;
|
||||
case VIM_L:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_RIGHT);
|
||||
break;
|
||||
case VIM_W:
|
||||
PRESS(KC_LALT);
|
||||
SHIFT(KC_RIGHT); // select to end of this word
|
||||
SHIFT(KC_RIGHT); // select to end of next word
|
||||
SHIFT(KC_LEFT); // select to start of next word
|
||||
RELEASE(KC_LALT);
|
||||
break;
|
||||
case VIM_P:
|
||||
CMD(KC_V);
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_Y:
|
||||
CMD(KC_C);
|
||||
TAP(KC_RIGHT);
|
||||
yank_was_lines = false;
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_V:
|
||||
case VIM_ESC:
|
||||
TAP(KC_RIGHT);
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_VI:
|
||||
/*****************************
|
||||
* vi- ...select a word... FROM THE INSIDE!
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_W:
|
||||
ALT(KC_LEFT);
|
||||
PRESS(KC_LSHIFT);
|
||||
ALT(KC_RIGHT);
|
||||
RELEASE(KC_LSHIFT);
|
||||
vstate = VIM_V;
|
||||
default:
|
||||
// ignore
|
||||
vstate = VIM_V;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_VS:
|
||||
/*****************************
|
||||
* visual line
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_D:
|
||||
case VIM_X:
|
||||
CMD(KC_X);
|
||||
yank_was_lines = true;
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_J:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_DOWN);
|
||||
break;
|
||||
case VIM_K:
|
||||
PRESS(KC_LSHIFT);
|
||||
PRESS(KC_UP);
|
||||
break;
|
||||
case VIM_Y:
|
||||
CMD(KC_C);
|
||||
yank_was_lines = true;
|
||||
TAP(KC_RIGHT);
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_P:
|
||||
CMD(KC_V);
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_V:
|
||||
case VIM_ESC:
|
||||
TAP(KC_RIGHT);
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VIM_G:
|
||||
/*****************************
|
||||
* gg, and a grab-bag of other macros i find useful
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_G:
|
||||
TAP(KC_HOME);
|
||||
break;
|
||||
// codes b
|
||||
case VIM_H:
|
||||
CTRL(KC_A);
|
||||
break;
|
||||
case VIM_J:
|
||||
PRESS(KC_PGDN);
|
||||
break;
|
||||
case VIM_K:
|
||||
PRESS(KC_PGUP);
|
||||
break;
|
||||
case VIM_L:
|
||||
CTRL(KC_E);
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
case VIM_Y:
|
||||
/*****************************
|
||||
* yoink!
|
||||
*****************************/
|
||||
switch(keycode) {
|
||||
case VIM_B:
|
||||
case VIM_E:
|
||||
case VIM_H:
|
||||
case VIM_J:
|
||||
case VIM_K:
|
||||
case VIM_L:
|
||||
case VIM_W:
|
||||
simple_movement(keycode);
|
||||
CMD(KC_C);
|
||||
TAP(KC_RIGHT);
|
||||
yank_was_lines = false;
|
||||
break;
|
||||
case VIM_Y:
|
||||
CMD(KC_LEFT);
|
||||
SHIFT(KC_DOWN);
|
||||
CMD(KC_C);
|
||||
TAP(KC_RIGHT);
|
||||
yank_was_lines = true;
|
||||
break;
|
||||
default:
|
||||
// NOTHING
|
||||
break;
|
||||
}
|
||||
vstate = VIM_START;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/************************
|
||||
* key release events
|
||||
************************/
|
||||
clear_keyboard();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return PASS_THRU;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/* Copyright 2015-2017 Christon DeWan
|
||||
*
|
||||
* 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 USERSPACE
|
||||
#define USERSPACE
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "action_layer.h"
|
||||
|
||||
#define X_____X KC_NO
|
||||
|
||||
bool process_record_xtonhasvim(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
enum xtonhasvim_keycodes {
|
||||
DUMMY = SAFE_RANGE,
|
||||
VIM_START, // bookend for vim states
|
||||
VIM_A,
|
||||
VIM_B,
|
||||
VIM_C,
|
||||
VIM_CI,
|
||||
VIM_D,
|
||||
VIM_DI,
|
||||
VIM_E,
|
||||
VIM_H,
|
||||
VIM_G,
|
||||
VIM_I,
|
||||
VIM_J,
|
||||
VIM_K,
|
||||
VIM_L,
|
||||
VIM_O,
|
||||
VIM_P,
|
||||
VIM_S,
|
||||
VIM_U,
|
||||
VIM_V,
|
||||
VIM_VS, // visual-line
|
||||
VIM_VI,
|
||||
VIM_W,
|
||||
VIM_X,
|
||||
VIM_Y,
|
||||
VIM_PERIOD, // to support indent/outdent
|
||||
VIM_COMMA, // and toggle comments
|
||||
VIM_SHIFT, // avoid side-effect of supporting real shift.
|
||||
VIM_ESC, // bookend
|
||||
VIM_SAFE_RANGE // start other keycodes here.
|
||||
};
|
||||
|
||||
enum xtonhasvim_layers {
|
||||
_EDIT = 12,
|
||||
_CMD
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in new issue