File keyboard.cpp
FileList > keyboard > keyboard.cpp
Go to the source code of this file
Implementation of keyboard functions and keymaps. More...
#include "keyboard.hpp"
#include "keys.hpp"
Public Attributes
Type | Name |
---|---|
bool | altLock = false |
bool | backlightState = true |
bool | capsLock = false |
uint8_t | cols = {0, 3, 19, 12, 18, 6, 7} |
bool | ctrlLock = false |
uint8_t | currentBrightness = 119 |
char | defaultKeymap = /* multi line expression */ |
uint8_t | emptyData = {0x00, false, false, false, false, false, false} |
uint8_t | keyInfo = {0x00, false, false, false, false, false, false} |
unsigned long | keyRepeatStart = 0 |
KeyState | keyStates |
uint8_t | keymapIndex = 0 |
bool | lastValue |
uint8_t | rows = {1, 4, 5, 11, 13} |
uint8_t | sendData = {0x00, false, false, false, false, false, false} |
bool | sendDataFlag = false |
char | symbolKeymap1 = /* multi line expression */ |
char | symbolKeymap2 = /* multi line expression */ |
char | symbolKeymap3 = /* multi line expression */ |
char | symbolKeymap4 = /* multi line expression */ |
char | symbolKeymap5 = /* multi line expression */ |
char | symbolKeymap6 = /* multi line expression */ |
char | symbolKeymap7 = /* multi line expression */ |
char | symbolKeymap8 = /* multi line expression */ |
bool | symbolLock = false |
Public Functions
Type | Name |
---|---|
void | autoResetKeymapIndex () Handles resetting the keymap index. |
bool | doesKeyExistInKeymap (int rowIndex, int colIndex, char keymap) Checks if a key exists in the keymap. |
void | handleCharacter (int rowIndex, int colIndex) Handles the character for a specific key. |
bool | keyHeld (int rowIndex, int colIndex) Checks if a key is being held. |
bool | keyNotPressed (int rowIndex, int colIndex) Checks if a key is not pressed. |
bool | keyPressed (int rowIndex, int colIndex) Checks if a key was pressed. |
bool | keyReleased (int rowIndex, int colIndex) Checks if a key was released. |
void | onRequest () Handles I2C requests. |
void | printKeyInfo (uint8_t data) Prints the key information. |
void | readKeyMatrix () Reads the key matrix and updates the key states. |
void | sendKeyInfo () Sends the key information over I2C. |
void | setDefaultCharacter (int rowIndex, int colIndex) Sets the default character for a key. |
void | setKeyboardBrightness (uint8_t command) Sets the keyboard backlight brightness. |
void | setSymbolCharacter (int rowIndex, int colIndex) Sets the symbol character for a key. |
Detailed Description
Author:
hreikin (hreikin@gmail.com) @license MIT
Copyright:
Copyright (c) 2025 hreikin (hreikin@gmail.com)
Date:
2025-03-07
Public Attributes Documentation
variable altLock
variable backlightState
variable capsLock
variable cols
variable ctrlLock
variable currentBrightness
variable defaultKeymap
variable emptyData
variable keyInfo
variable keyRepeatStart
variable keyStates
variable keymapIndex
variable lastValue
variable rows
variable sendData
variable sendDataFlag
variable symbolKeymap1
variable symbolKeymap2
variable symbolKeymap3
variable symbolKeymap4
variable symbolKeymap5
variable symbolKeymap6
variable symbolKeymap7
variable symbolKeymap8
variable symbolLock
Public Functions Documentation
function autoResetKeymapIndex
Handles resetting the keymap index.
function doesKeyExistInKeymap
Checks if a key exists in the keymap.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.keymap
The keymap to check.
Returns:
true if the key exists in the keymap, false otherwise.
function handleCharacter
Handles the character for a specific key.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
function keyHeld
Checks if a key is being held.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
Returns:
true if the key is being held, false otherwise.
function keyNotPressed
Checks if a key is not pressed.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
Returns:
true if the key is not pressed, false otherwise.
function keyPressed
Checks if a key was pressed.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
Returns:
true if the key was pressed, false otherwise.
function keyReleased
Checks if a key was released.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
Returns:
true if the key was released, false otherwise.
function onRequest
Handles I2C requests.
Sends the key data over I2C when requested.
function printKeyInfo
Prints the key information.
Parameters:
data
The key data array.
function readKeyMatrix
Reads the key matrix and updates the key states.
function sendKeyInfo
Sends the key information over I2C.
function setDefaultCharacter
Sets the default character for a key.
Sets keyInfo to the correct character for a specific key, from the default keymap only.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
function setKeyboardBrightness
Sets the keyboard backlight brightness.
Parameters:
command
The command to set the brightness (toggle, up, down).
function setSymbolCharacter
Sets the symbol character for a key.
Sets keyInfo to the correct character for a specific key, from the symbol keymaps only.
Parameters:
rowIndex
The row index of the key.colIndex
The column index of the key.
The documentation for this class was generated from the following file keyboard/keyboard.cpp