The Pedigree Project  0.1
Classes | Public Member Functions | Static Public 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)
 Called when a key transitions to the "down" state.
 
void keyUp (uint8_t keyCode)
 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, InterruptState &state)
 

Static Public Member Functions

static HidInputManagerinstance ()
 Singleton design.
 

Private Attributes

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

Static Private Attributes

static HidInputManager m_Instance
 Static instance.
 

Detailed Description

Global manager for all input from HID devices.

Definition at line 33 of file HidInputManager.h.

Member Function Documentation

void HidInputManager::timer ( uint64_t  delta,
InterruptState &  state 
)
virtual

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

Implements TimerHandler.

Definition at line 105 of file HidInputManager.cc.

References Machine::getTimer(), InputManager::instance(), HidInputManager::KeyState::key, InputManager::keyPressed(), m_KeyLock, m_KeyStates, and HidInputManager::KeyState::nLeftTicks.

Member Data Documentation

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 83 of file HidInputManager.h.

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


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