ISF15ACP4 Driver 1.0.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
isf15acp4::ButtonUI Class Reference

Debounced switch handling with visual feedback on the OLED. More...

#include <isf15acp4_button_ui.hpp>

Public Member Functions

 ButtonUI (uint32_t debounce_ms=25, uint32_t long_press_ms=800) noexcept
 
ButtonEvent Update (bool pressed, uint32_t elapsed_ms) noexcept
 Poll raw pressed state and return edge/event classification.
 
void DrawStatus (GraphicsContext &gfx, const char *label, bool active) const noexcept
 Draw idle/active visual using graphics context.
 
uint32_t PressCount () const noexcept
 
bool IsDown () const noexcept
 

Static Public Member Functions

static void DrawGauge (GraphicsContext &gfx, uint8_t cx, uint8_t cy, uint8_t radius, float value_0_to_1, Color565 fg, Color565 bg) noexcept
 Draw a compact gauge arc and numeric value.
 

Private Attributes

uint32_t debounce_ms_
 
uint32_t long_press_ms_
 
uint32_t stable_ms_ {0}
 
uint32_t hold_ms_ {0}
 
uint32_t press_count_ {0}
 
bool is_down_ {false}
 
bool long_fired_ {false}
 

Detailed Description

Debounced switch handling with visual feedback on the OLED.

Constructor & Destructor Documentation

◆ ButtonUI()

isf15acp4::ButtonUI::ButtonUI ( uint32_t  debounce_ms = 25,
uint32_t  long_press_ms = 800 
)
inlinenoexcept

Member Function Documentation

◆ DrawGauge()

void isf15acp4::ButtonUI::DrawGauge ( GraphicsContext &  gfx,
uint8_t  cx,
uint8_t  cy,
uint8_t  radius,
float  value_0_to_1,
Color565  fg,
Color565  bg 
)
inlinestaticnoexcept

Draw a compact gauge arc and numeric value.

◆ DrawStatus()

void isf15acp4::ButtonUI::DrawStatus ( GraphicsContext &  gfx,
const char *  label,
bool  active 
) const
inlinenoexcept

Draw idle/active visual using graphics context.

◆ IsDown()

bool isf15acp4::ButtonUI::IsDown ( ) const
inlinenoexcept

◆ PressCount()

uint32_t isf15acp4::ButtonUI::PressCount ( ) const
inlinenoexcept

◆ Update()

ButtonEvent isf15acp4::ButtonUI::Update ( bool  pressed,
uint32_t  elapsed_ms 
)
inlinenoexcept

Poll raw pressed state and return edge/event classification.

Parameters
pressedCurrent momentary switch state.
elapsed_msMilliseconds since last poll.

Member Data Documentation

◆ debounce_ms_

uint32_t isf15acp4::ButtonUI::debounce_ms_
private

◆ hold_ms_

uint32_t isf15acp4::ButtonUI::hold_ms_ {0}
private

◆ is_down_

bool isf15acp4::ButtonUI::is_down_ {false}
private

◆ long_fired_

bool isf15acp4::ButtonUI::long_fired_ {false}
private

◆ long_press_ms_

uint32_t isf15acp4::ButtonUI::long_press_ms_
private

◆ press_count_

uint32_t isf15acp4::ButtonUI::press_count_ {0}
private

◆ stable_ms_

uint32_t isf15acp4::ButtonUI::stable_ms_ {0}
private

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