The Pedigree Project 0.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
HidInputManager Class Reference

#include <HidInputManager.h>

+ Inheritance diagram for HidInputManager:
+ Collaboration diagram for HidInputManager:

Classes

struct  KeyState
 

Public Member Functions

 HidInputManager ()
 Default constructor.
 
virtual ~HidInputManager ()
 Default destructor.
 
void keyDown (uint8_t keyCode, const void *source=nullptr)
 Called when a key transitions to the "down" state.
 
void keyUp (uint8_t keyCode, const void *source=nullptr)
 Called when a key transitions to the "up" state.
 
void updateKeys ()
 Apply modifier or keymap changes to all keys in down state.
 
void timer (uint64_t delta)
 

Static Public Member Functions

static HidInputManager & instance ()
 Singleton design.
 

Private Member Functions

void armNextRepeatLocked ()
 
void updateKeysLocked ()
 

Private Attributes

Tree< uint8_t, KeyState * > m_KeyStates
 Current key states (for periodic callbacks while a key is down)
 
Spinlock m_KeyLock
 
Timer * m_pTimer
 
uint64_t m_NextArmed
 

Static Private Attributes

static HidInputManager m_Instance
 Static instance.
 

Detailed Description

Global manager for all input from HID devices.

Definition at line 36 of file HidInputManager.h.

Constructor & Destructor Documentation

◆ HidInputManager()

HidInputManager::HidInputManager ( )

Default constructor.

Definition at line 32 of file HidInputManager.cc.

◆ ~HidInputManager()

HidInputManager::~HidInputManager ( )
virtual

Default destructor.

Definition at line 34 of file HidInputManager.cc.

References m_KeyLock, m_pTimer, and timer().

Member Function Documentation

◆ armNextRepeatLocked()

void HidInputManager::armNextRepeatLocked ( )
private

Definition at line 145 of file HidInputManager.cc.

◆ instance()

static HidInputManager & HidInputManager::instance ( )
inlinestatic

Singleton design.

Definition at line 45 of file HidInputManager.h.

Referenced by HidUtils::sendInputToManager(), KeymapManager::useCompiledKeymap(), and KeymapManager::useKeymap().

+ Here is the caller graph for this function:

◆ keyDown()

void HidInputManager::keyDown ( uint8_t  keyCode,
const void *  source = nullptr 
)

◆ keyUp()

void HidInputManager::keyUp ( uint8_t  keyCode,
const void *  source = nullptr 
)

Called when a key transitions to the "up" state.

Definition at line 92 of file HidInputManager.cc.

References Vector< T >::count(), Vector< T >::erase(), InputManager::instance(), KeymapManager::instance(), m_KeyLock, m_KeyStates, InputManager::rawKeyUpdate(), and HidInputManager::KeyState::sources.

Referenced by HidUtils::sendInputToManager().

+ Here is the caller graph for this function:

◆ timer()

void HidInputManager::timer ( uint64_t  delta)
virtual

Timer callback to handle repeating key press states when a key is held in the down state.

Implements TimerHandler.

Definition at line 118 of file HidInputManager.cc.

References InputManager::instance(), HidInputManager::KeyState::key, InputManager::keyPressed(), m_KeyLock, m_KeyStates, m_pTimer, HidInputManager::KeyState::nextRepeat, Timer::supportsDeadlines(), and timer().

Referenced by keyDown(), timer(), and ~HidInputManager().

+ Here is the caller graph for this function:

◆ updateKeys()

void HidInputManager::updateKeys ( )

Apply modifier or keymap changes to all keys in down state.

Definition at line 166 of file HidInputManager.cc.

References m_KeyLock.

Referenced by KeymapManager::useCompiledKeymap(), and KeymapManager::useKeymap().

+ Here is the caller graph for this function:

◆ updateKeysLocked()

void HidInputManager::updateKeysLocked ( )
private

Definition at line 171 of file HidInputManager.cc.

Member Data Documentation

◆ m_Instance

HidInputManager HidInputManager::m_Instance
staticprivate

Static instance.

Definition at line 64 of file HidInputManager.h.

◆ m_KeyLock

Spinlock HidInputManager::m_KeyLock
private

Spinlock for work on keys.

Note
Using a Spinlock here because a lot of our work will happen in the middle of an IRQ where it's potentially dangerous to reschedule (which may happen with a Mutex or Semaphore).

Definition at line 89 of file HidInputManager.h.

Referenced by keyDown(), keyUp(), timer(), updateKeys(), and ~HidInputManager().

◆ m_KeyStates

Tree<uint8_t, KeyState*> HidInputManager::m_KeyStates
private

Current key states (for periodic callbacks while a key is down)

Definition at line 83 of file HidInputManager.h.

Referenced by keyDown(), keyUp(), and timer().

◆ m_NextArmed

uint64_t HidInputManager::m_NextArmed
private

Definition at line 93 of file HidInputManager.h.

◆ m_pTimer

Timer* HidInputManager::m_pTimer
private

Non-null only while key-repeat callbacks are admitted.

Definition at line 92 of file HidInputManager.h.

Referenced by keyDown(), timer(), and ~HidInputManager().


The documentation for this class was generated from the following files: