2019-12-12 20:46:29 +00:00
|
|
|
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
|
|
|
//
|
2019-12-15 08:09:15 +00:00
|
|
|
// Unfified Keyboard Project
|
2019-12-12 20:46:29 +00:00
|
|
|
// ASDF keyboard firmware
|
|
|
|
//
|
|
|
|
// asdf_modifiers.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_MODIFIERS_H)
|
|
|
|
#define ASDF_MODIFIERS_H
|
|
|
|
|
2019-12-25 04:27:24 +00:00
|
|
|
#define ASDF_MODIFIERS_SHIFT_POS 0
|
|
|
|
#define ASDF_MODIFIERS_CAPS_POS 1
|
|
|
|
#define ASDF_MODIFIERS_CTRL_POS 2
|
|
|
|
|
|
|
|
#define ASDF_MODIFIERS_SHIFT_MASK (1 << ASDF_MODIFIERS_SHIFT_POS)
|
|
|
|
#define ASDF_MODIFIERS_CAPS_MASK (1 << ASDF_MODIFIERS_CAPS_POS)
|
|
|
|
#define ASDF_MODIFIERS_CTRL_MASK (1 << ASDF_MODIFIERS_CTRL_POS)
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SHIFT_OFF_ST = 0,
|
|
|
|
SHIFT_ON_ST = 1,
|
|
|
|
SHIFT_LOCKED_ST = 2,
|
|
|
|
SHIFT_BOTH_ST = 3 // Never explicitly set. SHIFT and SHIFTLOCK together.
|
|
|
|
|
|
|
|
} shift_state_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CAPS_OFF_ST = 0,
|
|
|
|
CAPS_ON_ST = 1,
|
|
|
|
CAPS_LOCKED_ST = 2,
|
|
|
|
CAPS_BOTH_ST = 3 // Never explicitly set. CAPS and CAPSLOCK together.
|
|
|
|
} caps_state_t;
|
|
|
|
|
|
|
|
typedef enum { CTRL_OFF_ST = 0, CTRL_ON_ST = 1 } ctrl_state_t;
|
|
|
|
|
2019-12-12 20:46:29 +00:00
|
|
|
typedef enum {
|
|
|
|
MOD_PLAIN_MAP = 0,
|
|
|
|
MOD_SHIFT_MAP,
|
|
|
|
MOD_CAPS_MAP,
|
|
|
|
MOD_CTRL_MAP,
|
2020-02-20 05:22:23 +00:00
|
|
|
ASDF_MOD_NUM_MODIFIERS
|
2019-12-12 20:46:29 +00:00
|
|
|
} modifier_index_t;
|
|
|
|
|
|
|
|
typedef enum { TOGGLE_SHIFTLOCK = 0, HOLD_SHIFTLOCK = 1 } shiftlock_mode_t;
|
|
|
|
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_shift_activate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: sets SHIFT state to ON
|
|
|
|
//
|
|
|
|
void asdf_modifier_shift_activate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_shiftlock_activate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: sets SHIFTLOCK state if in NORMAL mode, and toggle shiftlock if in TOGGLE mode.
|
|
|
|
//
|
|
|
|
void asdf_modifier_shiftlock_activate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_capslock_activate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Turns on Capslock state
|
|
|
|
//
|
|
|
|
void asdf_modifier_capslock_activate(void);
|
|
|
|
|
2019-12-25 04:27:24 +00:00
|
|
|
// PROCEDURE: asdf_modifier_caps_activate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: sets CAPS state to ON (without disturbing the caps lock state)
|
|
|
|
void asdf_modifier_caps_activate(void);
|
|
|
|
|
2019-12-12 20:46:29 +00:00
|
|
|
// PROCEDURE: asdf_modifier_ctrl_activate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Turns on CTRL mode
|
|
|
|
//
|
|
|
|
void asdf_modifier_ctrl_activate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_shift_deactivate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Turns off shift mode.
|
|
|
|
//
|
|
|
|
void asdf_modifier_shift_deactivate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_ctrl_deactivate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Turns off CTRL mode
|
|
|
|
//
|
|
|
|
void asdf_modifier_ctrl_deactivate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_shiftlock_deactivate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: No action. This is called when releasing the SHIFT LOCK key,
|
|
|
|
//
|
|
|
|
void asdf_modifier_shiftlock_deactivate(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_capslock_deactivate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: No action. Called when releasing the CAPS LOCK key.
|
|
|
|
//
|
|
|
|
void asdf_modifier_capslock_deactivate(void);
|
|
|
|
|
2019-12-25 04:27:24 +00:00
|
|
|
// PROCEDURE: asdf_modifier_caps_deactivate
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: sets CAPS state to OFF (without disturbing the caps lock state)
|
|
|
|
void asdf_modifier_caps_deactivate(void);
|
|
|
|
|
2019-12-12 20:46:29 +00:00
|
|
|
// PROCEDURE: asdf_modifiers_init
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: none
|
|
|
|
// DESCRIPTION: Initialize the modifier key state variables to OFF state
|
|
|
|
//
|
|
|
|
void asdf_modifiers_init(void);
|
|
|
|
|
|
|
|
// PROCEDURE: asdf_modifier_index
|
|
|
|
// INPUTS: none
|
|
|
|
// OUTPUTS: returns uint8_t index into key map, based on modifier key status
|
|
|
|
// DESCRIPTION: See OUTPUTS
|
|
|
|
//
|
|
|
|
modifier_index_t asdf_modifier_index(void);
|
|
|
|
|
|
|
|
#endif // !defined (ASDF_MODIFIERS_H)
|
|
|
|
|
|
|
|
//-------|---------|---------+---------+---------+---------+---------+---------+
|
|
|
|
// Above line is 80 columns, and should display completely in the editor.
|