commit
c0c69a1a7c
9 changed files with 22 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "ergodox.h"
|
#include "ergodox.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
#include "mousekey.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
#include "action_util.h"
|
#include "action_util.h"
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case RGB_FF0000:
|
case RGB_FF0000:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
EZ_RGB(0xff0000);
|
EZ_RGB(0xff0000UL);
|
||||||
register_code(KC_1); unregister_code(KC_1);
|
register_code(KC_1); unregister_code(KC_1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case RGB_00FF00:
|
case RGB_00FF00:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
EZ_RGB(0x00ff00);
|
EZ_RGB(0x00ff00UL);
|
||||||
register_code(KC_2); unregister_code(KC_2);
|
register_code(KC_2); unregister_code(KC_2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case RGB_0000FF:
|
case RGB_0000FF:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
EZ_RGB(0x0000ff);
|
EZ_RGB(0x0000ffUL);
|
||||||
register_code(KC_3); unregister_code(KC_3);
|
register_code(KC_3); unregister_code(KC_3);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case RGB_FFFFFF:
|
case RGB_FFFFFF:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
EZ_RGB(0xffffff);
|
EZ_RGB(0xffffffUL);
|
||||||
register_code(KC_4); unregister_code(KC_4);
|
register_code(KC_4); unregister_code(KC_4);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
#define CONFIG_DEFINITIONS_H
|
#define CONFIG_DEFINITIONS_H
|
||||||
|
|
||||||
/* diode directions */
|
/* diode directions */
|
||||||
#define COL2ROW 0
|
#define COL2ROW 0
|
||||||
#define ROW2COL 1
|
#define ROW2COL 1
|
||||||
|
#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
|
||||||
|
|
||||||
/* I/O pins */
|
/* I/O pins */
|
||||||
#ifndef F0
|
#ifndef F0
|
||||||
#define B0 0x30
|
#define B0 0x30
|
||||||
|
|
|
@ -70,7 +70,7 @@ void I2C_WriteBit(unsigned char c)
|
||||||
|
|
||||||
// Inits bitbanging port, must be called before using the functions below
|
// Inits bitbanging port, must be called before using the functions below
|
||||||
//
|
//
|
||||||
void I2C_Init()
|
void I2C_Init(void)
|
||||||
{
|
{
|
||||||
I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void I2C_Init()
|
||||||
|
|
||||||
// Send a START Condition
|
// Send a START Condition
|
||||||
//
|
//
|
||||||
void I2C_Start()
|
void I2C_Start(void)
|
||||||
{
|
{
|
||||||
// set both to high at the same time
|
// set both to high at the same time
|
||||||
I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
||||||
|
@ -97,7 +97,7 @@ void I2C_Start()
|
||||||
|
|
||||||
// Send a STOP Condition
|
// Send a STOP Condition
|
||||||
//
|
//
|
||||||
void I2C_Stop()
|
void I2C_Stop(void)
|
||||||
{
|
{
|
||||||
I2C_CLOCK_HI();
|
I2C_CLOCK_HI();
|
||||||
_delay_us(I2C_DELAY);
|
_delay_us(I2C_DELAY);
|
||||||
|
|
|
@ -60,13 +60,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern const matrix_row_t matrix_mask[];
|
extern const matrix_row_t matrix_mask[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
||||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* matrix state(1:on, 0:off) */
|
/* matrix state(1:on, 0:off) */
|
||||||
static matrix_row_t matrix[MATRIX_ROWS];
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
|
||||||
static matrix_row_t matrix_raw[MATRIX_ROWS];
|
|
||||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
static void unselect_rows(void);
|
static void unselect_rows(void);
|
||||||
static void select_row(uint8_t row);
|
static void select_row(uint8_t row);
|
||||||
static void unselect_row(uint8_t row);
|
static void unselect_row(uint8_t row);
|
||||||
#else // ROW2COL
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
static void init_rows(void);
|
static void init_rows(void);
|
||||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
||||||
static void unselect_cols(void);
|
static void unselect_cols(void);
|
||||||
|
@ -133,7 +134,7 @@ uint8_t matrix_cols(void) {
|
||||||
// /* PORTxn */
|
// /* PORTxn */
|
||||||
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
|
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
|
||||||
// }
|
// }
|
||||||
// #else
|
// #elif (DIODE_DIRECTION == ROW2COL)
|
||||||
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
||||||
// /* DDRxn */
|
// /* DDRxn */
|
||||||
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
|
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
|
||||||
|
@ -158,7 +159,7 @@ void matrix_init(void) {
|
||||||
#if (DIODE_DIRECTION == COL2ROW)
|
#if (DIODE_DIRECTION == COL2ROW)
|
||||||
unselect_rows();
|
unselect_rows();
|
||||||
init_cols();
|
init_cols();
|
||||||
#else // ROW2COL
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
unselect_cols();
|
unselect_cols();
|
||||||
init_rows();
|
init_rows();
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,7 +167,6 @@ void matrix_init(void) {
|
||||||
// initialize matrix state: all keys off
|
// initialize matrix state: all keys off
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||||
matrix[i] = 0;
|
matrix[i] = 0;
|
||||||
matrix_raw[i] = 0;
|
|
||||||
matrix_debouncing[i] = 0;
|
matrix_debouncing[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ uint8_t matrix_scan(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // ROW2COL
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
|
|
||||||
// Set col, read rows
|
// Set col, read rows
|
||||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||||
|
@ -336,7 +336,7 @@ static void unselect_rows(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // ROW2COL
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
|
|
||||||
static void init_rows(void)
|
static void init_rows(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MATRIX_COL_PINS { F1, F0, B0 }
|
#define MATRIX_COL_PINS { F1, F0, B0 }
|
||||||
#define UNUSED_PINS
|
#define UNUSED_PINS
|
||||||
|
|
||||||
/* COL2ROW or ROW2COL */
|
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
|
||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
// #define BACKLIGHT_PIN B7
|
// #define BACKLIGHT_PIN B7
|
||||||
|
|
|
@ -14,6 +14,7 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
|
@ -50,7 +50,7 @@ void matrix_init(void);
|
||||||
uint8_t matrix_scan(void);
|
uint8_t matrix_scan(void);
|
||||||
/* whether modified from previous scan. used after matrix_scan. */
|
/* whether modified from previous scan. used after matrix_scan. */
|
||||||
bool matrix_is_modified(void) __attribute__ ((deprecated));
|
bool matrix_is_modified(void) __attribute__ ((deprecated));
|
||||||
/* whether a swtich is on */
|
/* whether a switch is on */
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col);
|
bool matrix_is_on(uint8_t row, uint8_t col);
|
||||||
/* matrix state on row */
|
/* matrix state on row */
|
||||||
matrix_row_t matrix_get_row(uint8_t row);
|
matrix_row_t matrix_get_row(uint8_t row);
|
||||||
|
|
|
@ -134,13 +134,6 @@ typedef union {
|
||||||
} nkro;
|
} nkro;
|
||||||
#endif
|
#endif
|
||||||
} __attribute__ ((packed)) report_keyboard_t;
|
} __attribute__ ((packed)) report_keyboard_t;
|
||||||
/*
|
|
||||||
typedef struct {
|
|
||||||
uint8_t mods;
|
|
||||||
uint8_t reserved;
|
|
||||||
uint8_t keys[REPORT_KEYS];
|
|
||||||
} __attribute__ ((packed)) report_keyboard_t;
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t buttons;
|
uint8_t buttons;
|
||||||
|
|
Loading…
Reference in a new issue