M5Unit-KEYBOARD 0.1.0 git rev:b58d024
Loading...
Searching...
No Matches
m5::unit::tab5_keyboard::Event Struct Reference

Unified event payload for all 3 operation modes (tagged union, POD) More...

#include <unit_Tab5Keyboard.hpp>

Public Member Functions

bool isCtrl () const
 True if the Ctrl modifier is held (modifier bit 0x01 or 0x10)
 
bool isShift () const
 True if a Shift modifier is held (modifier bit 0x02 or 0x20)
 
bool isAlt () const
 True if the Alt modifier is held (modifier bit 0x04 or 0x40)
 

Public Attributes

EventType type {EventType::None}
 
uint8_t modifier {}
 
bool repeat {false}
 True when this event was synthesized by software auto-repeat.
 
union { 
 
   struct { 
 
      uint8_t   length 
 Number of valid bytes in chars (0..CHAR_EVENT_MAX_CHARS)
 
      char   chars [CHAR_EVENT_MAX_CHARS+1] 
 Always NUL-terminated; printf("%s") safe.
 
   }   chr 
 Character mode payload.
 
   struct { 
 
      uint8_t   row 
 
      uint8_t   col 
 
      bool   pressed 
 
   }   key 
 Normal mode payload.
 
   struct { 
 
      uint8_t   keycode 
 
   }   hid 
 HID mode payload.
 
};  
 

Detailed Description

Unified event payload for all 3 operation modes (tagged union, POD)

Note
Always check type before accessing union members.

Member Function Documentation

◆ isAlt()

bool m5::unit::tab5_keyboard::Event::isAlt ( ) const
inline

True if the Alt modifier is held (modifier bit 0x04 or 0x40)

Note
Applies to both HID and Character modes (firmware uses bit 2 in both).

◆ isCtrl()

bool m5::unit::tab5_keyboard::Event::isCtrl ( ) const
inline

True if the Ctrl modifier is held (modifier bit 0x01 or 0x10)

Note
Applies to both HID and Character modes (firmware uses bit 0 in both).

◆ isShift()

bool m5::unit::tab5_keyboard::Event::isShift ( ) const
inline

True if a Shift modifier is held (modifier bit 0x02 or 0x20)

Note
HID mode only. In Character mode, Sym/Aa shifting is applied at firmware level and the modifier byte is 0x00 for those events.

Member Data Documentation

◆ modifier

uint8_t m5::unit::tab5_keyboard::Event::modifier {}

Shared by HID + Character (unused for Key)

◆ repeat

bool m5::unit::tab5_keyboard::Event::repeat {false}

True when this event was synthesized by software auto-repeat.

Note
Only ever true in Normal mode and only when config_t::software_repeat is enabled. Hardware-originated events (the initial press as well as the release) always have repeat == false.