[Keyboard] Update Gergo to use newer Ergodox Matrix code (#5703)
* [Keyboard] Update Gergo to use newer Ergodox Matrix code And update layout macros to be correct * Almost forgot the json file * Remove board specific defines for i2c timeoutplanck-ez-a5-high
parent
ffd10d4116
commit
8faee5c9f6
@ -1,178 +0,0 @@ |
|||||||
#ifndef _I2CMASTER_H |
|
||||||
#define _I2CMASTER_H 1 |
|
||||||
/*************************************************************************
|
|
||||||
* Title: C include file for the I2C master interface
|
|
||||||
* (i2cmaster.S or twimaster.c) |
|
||||||
* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
|
||||||
* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $ |
|
||||||
* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3 |
|
||||||
* Target: any AVR device |
|
||||||
* Usage: see Doxygen manual |
|
||||||
**************************************************************************/ |
|
||||||
|
|
||||||
#ifdef DOXYGEN |
|
||||||
/**
|
|
||||||
@defgroup pfleury_ic2master I2C Master library |
|
||||||
@code #include <i2cmaster.h> @endcode |
|
||||||
|
|
||||||
@brief I2C (TWI) Master Software Library |
|
||||||
|
|
||||||
Basic routines for communicating with I2C slave devices. This single master
|
|
||||||
implementation is limited to one bus master on the I2C bus.
|
|
||||||
|
|
||||||
This I2c library is implemented as a compact assembler software implementation of the I2C protocol
|
|
||||||
which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). |
|
||||||
Since the API for these two implementations is exactly the same, an application can be linked either against the |
|
||||||
software I2C implementation or the hardware I2C implementation. |
|
||||||
|
|
||||||
Use 4.7k pull-up resistor on the SDA and SCL pin. |
|
||||||
|
|
||||||
Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module
|
|
||||||
i2cmaster.S to your target when using the software I2C implementation !
|
|
||||||
|
|
||||||
Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion. |
|
||||||
|
|
||||||
@note
|
|
||||||
The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted
|
|
||||||
to GNU assembler and AVR-GCC C call interface. |
|
||||||
Replaced the incorrect quarter period delays found in AVR300 with
|
|
||||||
half period delays.
|
|
||||||
|
|
||||||
@author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
|
||||||
|
|
||||||
@par API Usage Example |
|
||||||
The following code shows typical usage of this library, see example test_i2cmaster.c |
|
||||||
|
|
||||||
@code |
|
||||||
|
|
||||||
#include <i2cmaster.h> |
|
||||||
|
|
||||||
|
|
||||||
#define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet
|
|
||||||
|
|
||||||
int main(void) |
|
||||||
{ |
|
||||||
unsigned char ret; |
|
||||||
|
|
||||||
i2c_init(); // initialize I2C library
|
|
||||||
|
|
||||||
// write 0x75 to EEPROM address 5 (Byte Write)
|
|
||||||
i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
|
|
||||||
i2c_write(0x05); // write address = 5
|
|
||||||
i2c_write(0x75); // write value 0x75 to EEPROM
|
|
||||||
i2c_stop(); // set stop conditon = release bus
|
|
||||||
|
|
||||||
|
|
||||||
// read previously written value back from EEPROM address 5
|
|
||||||
i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
|
|
||||||
|
|
||||||
i2c_write(0x05); // write address = 5
|
|
||||||
i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode
|
|
||||||
|
|
||||||
ret = i2c_readNak(); // read one byte from EEPROM
|
|
||||||
i2c_stop(); |
|
||||||
|
|
||||||
for(;;); |
|
||||||
} |
|
||||||
@endcode |
|
||||||
|
|
||||||
*/ |
|
||||||
#endif /* DOXYGEN */ |
|
||||||
|
|
||||||
/**@{*/ |
|
||||||
|
|
||||||
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 |
|
||||||
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" |
|
||||||
#endif |
|
||||||
|
|
||||||
#include <avr/io.h> |
|
||||||
|
|
||||||
/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */ |
|
||||||
#define I2C_READ 1 |
|
||||||
|
|
||||||
/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */ |
|
||||||
#define I2C_WRITE 0 |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief initialize the I2C master interace. Need to be called only once
|
|
||||||
@param void |
|
||||||
@return none |
|
||||||
*/ |
|
||||||
void i2c_init(void); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Terminates the data transfer and releases the I2C bus
|
|
||||||
@param void |
|
||||||
@return none |
|
||||||
*/ |
|
||||||
void i2c_stop(void); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Issues a start condition and sends address and transfer direction
|
|
||||||
|
|
||||||
@param addr address and transfer direction of I2C device |
|
||||||
@retval 0 device accessible
|
|
||||||
@retval 1 failed to access device
|
|
||||||
*/ |
|
||||||
unsigned char i2c_start(unsigned char addr); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Issues a repeated start condition and sends address and transfer direction
|
|
||||||
|
|
||||||
@param addr address and transfer direction of I2C device |
|
||||||
@retval 0 device accessible |
|
||||||
@retval 1 failed to access device |
|
||||||
*/ |
|
||||||
unsigned char i2c_rep_start(unsigned char addr); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Issues a start condition and sends address and transfer direction
|
|
||||||
|
|
||||||
If device is busy, use ack polling to wait until device ready
|
|
||||||
@param addr address and transfer direction of I2C device |
|
||||||
@return none |
|
||||||
*/ |
|
||||||
void i2c_start_wait(unsigned char addr); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Send one byte to I2C device |
|
||||||
@param data byte to be transfered |
|
||||||
@retval 0 write successful |
|
||||||
@retval 1 write failed |
|
||||||
*/ |
|
||||||
unsigned char i2c_write(unsigned char data); |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief read one byte from the I2C device, request more data from device
|
|
||||||
@return byte read from I2C device |
|
||||||
*/ |
|
||||||
unsigned char i2c_readAck(void); |
|
||||||
|
|
||||||
/**
|
|
||||||
@brief read one byte from the I2C device, read is followed by a stop condition
|
|
||||||
@return byte read from I2C device |
|
||||||
*/ |
|
||||||
unsigned char i2c_readNak(void); |
|
||||||
|
|
||||||
/**
|
|
||||||
@brief read one byte from the I2C device |
|
||||||
|
|
||||||
Implemented as a macro, which calls either i2c_readAck or i2c_readNak |
|
||||||
|
|
||||||
@param ack 1 send ack, request more data from device<br> |
|
||||||
0 send nak, read is followed by a stop condition
|
|
||||||
@return byte read from I2C device |
|
||||||
*/ |
|
||||||
unsigned char i2c_read(unsigned char ack); |
|
||||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); |
|
||||||
|
|
||||||
|
|
||||||
/**@}*/ |
|
||||||
#endif |
|
@ -0,0 +1,3 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#define IGNORE_MOD_TAP_INTERRUPT |
@ -0,0 +1,119 @@ |
|||||||
|
/* Good on you for modifying your layout! if you don't have
|
||||||
|
* time to read the QMK docs, a list of keycodes can be found at |
||||||
|
* |
||||||
|
* https://github.com/qmk/qmk_firmware/blob/master/docs/keycodes.md
|
||||||
|
* |
||||||
|
* There's also a template for adding new layers at the bottom of this file! |
||||||
|
*/ |
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H |
||||||
|
#include "drashna.h" |
||||||
|
|
||||||
|
// Blank template at the bottom
|
||||||
|
|
||||||
|
enum customKeycodes { |
||||||
|
URL = 1 |
||||||
|
}; |
||||||
|
|
||||||
|
#define LAYOUT_gergo_wrapper(...) LAYOUT_gergo(__VA_ARGS__) |
||||||
|
#define LAYOUT_gergo_base( \ |
||||||
|
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
||||||
|
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
|
||||||
|
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
|
||||||
|
) \
|
||||||
|
LAYOUT_gergo_wrapper( \
|
||||||
|
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_PIPE, \
|
||||||
|
KC_TAB, ALT_T(K11), K12, K13, K14, K15, _______, _______, K16, K17, K18, K19, K1A, RGUI_T(KC_QUOT), \
|
||||||
|
OS_LSFT, CTL_T(K21), K22, K23, K24, K25, _______, _______, _______, _______, K26, K27, K28, K29, CTL_T(K2A), OS_RSFT, \
|
||||||
|
_______, _______, KC_SPC, LT(_LOWER, KC_BSPC), LT(_RAISE, KC_DEL), KC_ENT, _______, _______ \
|
||||||
|
) |
||||||
|
|
||||||
|
#define LAYOUT_gergo_base_wrapper(...) LAYOUT_gergo_base(__VA_ARGS__) |
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||||
|
[_QWERTY] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________QWERTY_L1_________________, _________________QWERTY_R1_________________, |
||||||
|
_________________QWERTY_L2_________________, _________________QWERTY_R2_________________, |
||||||
|
_________________QWERTY_L3_________________, _________________QWERTY_R3_________________ |
||||||
|
), |
||||||
|
[_COLEMAK] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________COLEMAK_L1________________, _________________COLEMAK_R1________________, |
||||||
|
_________________COLEMAK_L2________________, _________________COLEMAK_R2________________, |
||||||
|
_________________COLEMAK_L3________________, _________________COLEMAK_R3________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_DVORAK] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________DVORAK_L1_________________, _________________DVORAK_R1_________________, |
||||||
|
_________________DVORAK_L2_________________, _________________DVORAK_R2_________________, |
||||||
|
_________________DVORAK_L3_________________, _________________DVORAK_R3_________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_WORKMAN] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________WORKMAN_L1________________, _________________WORKMAN_R1________________, |
||||||
|
_________________WORKMAN_L2________________, _________________WORKMAN_R2________________, |
||||||
|
_________________WORKMAN_L3________________, _________________WORKMAN_R3________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_NORMAN] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________NORMAN_L1_________________, _________________NORMAN_L1_________________, |
||||||
|
_________________NORMAN_L2_________________, _________________NORMAN_R2_________________, |
||||||
|
_________________NORMAN_L3_________________, _________________NORMAN_R3_________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_MALTRON] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________MALTRON_L1________________, _________________MALTRON_R1________________, |
||||||
|
_________________MALTRON_L2________________, _________________MALTRON_R2________________, |
||||||
|
_________________MALTRON_L3________________, _________________MALTRON_R3________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_EUCALYN] = LAYOUT_gergo_base_wrapper( |
||||||
|
_________________EUCALYN_L1________________, _________________EUCALYN_R1________________, |
||||||
|
_________________EUCALYN_L2________________, _________________EUCALYN_R2________________, |
||||||
|
_________________EUCALYN_L3________________, _________________EUCALYN_R3________________ |
||||||
|
), |
||||||
|
|
||||||
|
[_CARPLAX] = LAYOUT_gergo_base_wrapper( |
||||||
|
_____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________, |
||||||
|
_____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________, |
||||||
|
_____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________ |
||||||
|
), |
||||||
|
|
||||||
|
[_MODS] = LAYOUT_gergo_wrapper( |
||||||
|
_______, ___________________BLANK___________________, ___________________BLANK___________________, _______, |
||||||
|
_______, ___________________BLANK___________________, _______, _______, ___________________BLANK___________________, _______, |
||||||
|
KC_LSFT, ___________________BLANK___________________, _______, _______, _______, _______, ___________________BLANK___________________, KC_RSFT, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
[_LOWER] = LAYOUT_gergo_wrapper( |
||||||
|
KC_F12, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11, |
||||||
|
_______, _________________LOWER_L2__________________, _______, _______, _________________LOWER_R2__________________, KC_PIPE, |
||||||
|
_______, _________________LOWER_L3__________________, _______, _______, _______, _______, _________________LOWER_R3__________________, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
|
||||||
|
[_RAISE] = LAYOUT_gergo_wrapper( |
||||||
|
_______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, |
||||||
|
_______, _________________RAISE_L2__________________, _______, _______, _________________RAISE_R2__________________, KC_BSLS, |
||||||
|
_______, _________________RAISE_L3__________________, _______, _______, _______, _______, _________________RAISE_R3__________________, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
|
||||||
|
[_ADJUST] = LAYOUT_gergo_wrapper( |
||||||
|
KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, |
||||||
|
VRSN, _________________ADJUST_L2_________________, _______, KC_NUKE, _________________ADJUST_R2_________________, EEP_RST, |
||||||
|
_______, _________________ADJUST_L3_________________, _______, _______, _______, _______, _________________ADJUST_R3_________________, TG_MODS, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
/* Keymap template
|
||||||
|
|
||||||
|
[SYMB] = LAYOUT_gergo_wrapper( |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
|
||||||
|
*/ |
@ -0,0 +1,3 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#define IGNORE_MOD_TAP_INTERRUPT |
Loading…
Reference in new issue