brings alps64 up-to-date (needs testing)
This commit is contained in:
parent
209ee3cd05
commit
de57799530
9 changed files with 44 additions and 42 deletions
|
@ -42,14 +42,14 @@
|
||||||
TARGET = alps64
|
TARGET = alps64
|
||||||
|
|
||||||
# Directory common source filess exist
|
# Directory common source filess exist
|
||||||
|
TOP_DIR = ../..
|
||||||
TMK_DIR = ../../tmk_core
|
TMK_DIR = ../../tmk_core
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
# Directory keyboard dependent files exist
|
||||||
TARGET_DIR = .
|
TARGET_DIR = .
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC = keymap_common.c \
|
SRC = alps64.c \
|
||||||
matrix.c \
|
|
||||||
led.c
|
led.c
|
||||||
|
|
||||||
ifdef KEYMAP
|
ifdef KEYMAP
|
||||||
|
@ -127,8 +127,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
|
||||||
# Search Path
|
# Search Path
|
||||||
VPATH += $(TARGET_DIR)
|
VPATH += $(TARGET_DIR)
|
||||||
|
VPATH += $(TOP_DIR)
|
||||||
VPATH += $(TMK_DIR)
|
VPATH += $(TMK_DIR)
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
include $(TOP_DIR)/quantum/quantum.mk
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
||||||
|
|
|
@ -14,17 +14,30 @@ 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 "keymap_common.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
|
#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0)
|
||||||
|
#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0)
|
||||||
|
#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0)
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
__attribute__ ((weak))
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
void matrix_scan_user(void) {
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
}
|
||||||
|
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
LED_ON();
|
||||||
|
_delay_ms(500);
|
||||||
|
LED_OFF();
|
||||||
|
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
matrix_scan_user();
|
||||||
}
|
}
|
|
@ -14,25 +14,10 @@ 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/>.
|
||||||
*/
|
*/
|
||||||
#ifndef KEYMAP_COMMON_H
|
#ifndef ALPS64_H
|
||||||
#define KEYMAP_COMMON_H
|
#define ALPS64_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
/* Alps64 keymap definition macro */
|
/* Alps64 keymap definition macro */
|
||||||
#define KEYMAP( \
|
#define KEYMAP( \
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
/* USB Device descriptor parameter */
|
/* USB Device descriptor parameter */
|
||||||
#define VENDOR_ID 0xFEED
|
#define VENDOR_ID 0xFEED
|
||||||
|
@ -31,6 +32,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MATRIX_ROWS 8
|
#define MATRIX_ROWS 8
|
||||||
#define MATRIX_COLS 8
|
#define MATRIX_COLS 8
|
||||||
|
|
||||||
|
#define MATRIX_COL_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
|
||||||
|
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5, D6, C2 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
/* define if matrix has ghost */
|
/* define if matrix has ghost */
|
||||||
//#define MATRIX_HAS_GHOST
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "keymap_common.h"
|
#include "alps64.h"
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* 0: qwerty */
|
/* 0: qwerty */
|
||||||
KEYMAP( \
|
KEYMAP( \
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \
|
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "keymap_common.h"
|
#include "alps64.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hasu
|
* Hasu
|
||||||
*/
|
*/
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* Default Layer
|
/* Default Layer
|
||||||
* ,-----------------------------------------------------------.
|
* ,-----------------------------------------------------------.
|
||||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ |
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ |
|
||||||
|
|
|
@ -55,10 +55,6 @@ uint8_t matrix_cols(void)
|
||||||
return MATRIX_COLS;
|
return MATRIX_COLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0)
|
|
||||||
#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0)
|
|
||||||
#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0)
|
|
||||||
|
|
||||||
void matrix_init(void)
|
void matrix_init(void)
|
||||||
{
|
{
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
|
@ -160,6 +156,7 @@ static void unselect_rows(void)
|
||||||
PORTC &= ~0b00000100;
|
PORTC &= ~0b00000100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void select_row(uint8_t row)
|
static void select_row(uint8_t row)
|
||||||
{
|
{
|
||||||
// Output low(DDR:1, PORT:0) to select
|
// Output low(DDR:1, PORT:0) to select
|
||||||
|
|
|
@ -68,8 +68,10 @@ uint8_t matrix_cols(void) {
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
/* frees PORTF by setting the JTD bit twice within four cycles */
|
/* frees PORTF by setting the JTD bit twice within four cycles */
|
||||||
MCUCR |= _BV(JTD);
|
#ifdef __AVR_ATmega32U4__
|
||||||
MCUCR |= _BV(JTD);
|
MCUCR |= _BV(JTD);
|
||||||
|
MCUCR |= _BV(JTD);
|
||||||
|
#endif
|
||||||
/* initializes the I/O pins */
|
/* initializes the I/O pins */
|
||||||
#if DIODE_DIRECTION == COL2ROW
|
#if DIODE_DIRECTION == COL2ROW
|
||||||
for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
extern uint32_t default_layer_state;
|
extern uint32_t default_layer_state;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue