2019-12-12 20:46:29 +00:00
|
|
|
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
|
|
|
//
|
2019-12-15 08:38:04 +00:00
|
|
|
// Universal Keyboard Project
|
2019-12-12 20:46:29 +00:00
|
|
|
// ASDF keyboard firmware
|
|
|
|
//
|
|
|
|
// asdf.h
|
|
|
|
//
|
|
|
|
// Copyright 2019 David Fenyes
|
|
|
|
//
|
|
|
|
// 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 3 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 <https://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
#if !defined(ASDF_H)
|
|
|
|
#define ASDF_H
|
|
|
|
|
|
|
|
#define ASDF_ACTION 0x80
|
2019-12-13 02:19:45 +00:00
|
|
|
#define ASDF_INVALID_CODE ASDF_ACTION
|
2019-12-12 20:46:29 +00:00
|
|
|
// an action code is not a valid keycode.
|
|
|
|
|
|
|
|
// for efficiency on 8-bit machines, use 8 columns per row. For 16 columns per
|
|
|
|
// row, change cols_t to uint16_t and increase ASDF_NUM_COLS.
|
|
|
|
typedef uint8_t asdf_cols_t;
|
|
|
|
|
|
|
|
// ASCII keycodes are 7 bits. An 8-bit datatype encodes ASCII, plus a flag for a
|
|
|
|
// key function. For longer codes, such as extended ASCII or unicode, change
|
|
|
|
// keycode_t appropriately, and also change ASDF_ACTION so that the action key
|
|
|
|
// codes (enumerated in action_t) do not conflict with the encoding scheme.
|
|
|
|
typedef uint8_t asdf_keycode_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ACTION_NOTHING = ASDF_ACTION,
|
2019-12-15 08:38:04 +00:00
|
|
|
ACTION_SHIFT,
|
|
|
|
ACTION_SHIFT_LOCK,
|
|
|
|
ACTION_CAPS,
|
|
|
|
ACTION_CTRL,
|
|
|
|
ACTION_REPEAT,
|
|
|
|
ACTION_LOCAL,
|
|
|
|
ACTION_BREAK,
|
|
|
|
ACTION_HERE_IS,
|
|
|
|
ACTION_CLEAR,
|
|
|
|
ACTION_RESET,
|
2020-02-20 05:28:14 +00:00
|
|
|
ACTION_MAPSEL_0,
|
|
|
|
ACTION_MAPSEL_1,
|
|
|
|
ACTION_MAPSEL_2,
|
|
|
|
ACTION_MAPSEL_3,
|
2020-03-08 19:45:40 +00:00
|
|
|
ACTION_VLED1,
|
|
|
|
ACTION_VLED2,
|
|
|
|
ACTION_VLED3,
|
|
|
|
ACTION_VOUT1,
|
|
|
|
ACTION_VOUT2,
|
|
|
|
ACTION_VOUT3,
|
|
|
|
ACTION_VOUT4,
|
|
|
|
ACTION_VOUT5,
|
|
|
|
ACTION_VOUT6,
|
2019-12-15 08:38:04 +00:00
|
|
|
ACTION_FN_1,
|
|
|
|
ACTION_FN_2,
|
|
|
|
ACTION_FN_3,
|
|
|
|
ACTION_FN_4,
|
|
|
|
ACTION_FN_5,
|
|
|
|
ACTION_FN_6,
|
|
|
|
ACTION_FN_7,
|
|
|
|
ACTION_FN_8,
|
|
|
|
ACTION_FN_9,
|
2020-02-20 05:28:14 +00:00
|
|
|
ACTION_FN_10,
|
|
|
|
RESERVED_1,
|
|
|
|
RESERVED_2,
|
|
|
|
RESERVED_3,
|
|
|
|
RESERVED_4,
|
|
|
|
RESERVED_5,
|
|
|
|
RESERVED_6,
|
|
|
|
RESERVED_7,
|
|
|
|
RESERVED_8,
|
|
|
|
RESERVED_9,
|
|
|
|
RESERVED_10,
|
|
|
|
RESERVED_11,
|
|
|
|
RESERVED_12,
|
|
|
|
RESERVED_13,
|
|
|
|
RESERVED_14,
|
|
|
|
RESERVED_15,
|
2020-03-08 19:45:40 +00:00
|
|
|
RESERVED_16,
|
2019-12-12 20:46:29 +00:00
|
|
|
} action_t;
|
|
|
|
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_init
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: initialize the keyboard state and debounce counters
|
|
|
|
void asdf_init(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_keyscan
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Scans the key matrix. For each row, read the columns and compare
|
|
|
|
// with last stable state. For each changed key, call a key-change handler
|
|
|
|
// function. For each stable pressed key, call a "continued press" handler
|
|
|
|
// function.
|
|
|
|
void asdf_keyscan(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_put_code
|
|
|
|
// INPUTS: (asdf_keycode_t) code: code to be buffered for output
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Takes a keycode argument and buffers for output.
|
|
|
|
// NOTES: If buffer is full, silently drop the code.
|
|
|
|
void asdf_put_code(asdf_keycode_t code);
|
|
|
|
|
2020-02-20 05:28:14 +00:00
|
|
|
// PROCEDURE: asdf_next_code
|
2019-12-12 20:46:29 +00:00
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: (asdf_keycode_t) returns next value in buffer.
|
|
|
|
// DESCRIPTION: Takes a keycode argument and buffers for output.
|
2020-02-20 05:28:14 +00:00
|
|
|
asdf_keycode_t asdf_next_code(void);
|
2019-12-12 20:46:29 +00:00
|
|
|
|
|
|
|
#endif // !defined (ASDF_H)
|
|
|
|
|
|
|
|
|
|
|
|
//-------|---------|---------+---------+---------+---------+---------+---------+
|
|
|
|
// Above line is 80 columns, and should display completely in the editor.
|