MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ parse_button()

double MayaFlux::Nodes::Input::HIDNode::parse_button ( std::span< const uint8_t >  bytes) const
private

Parse button value from HID report bytes.

Parameters
bytesHID report bytes
Returns
Button state (0.0 or 1.0)

Definition at line 71 of file HIDNode.cpp.

72{
73 if (bytes.size() <= m_config.byte_offset) {
75 }
76
77 bool pressed = (bytes[m_config.byte_offset] & m_config.bit_mask) != 0;
78
79 if (m_config.invert) {
80 pressed = !pressed;
81 }
82
83 return pressed ? 1.0 : 0.0;
84}
uint8_t bit_mask
Bit mask (for BUTTON)
Definition HIDNode.hpp:27
double default_value
Initial output value.
Definition InputNode.hpp:83

References MayaFlux::Nodes::Input::HIDConfig::bit_mask, MayaFlux::Nodes::Input::HIDConfig::byte_offset, MayaFlux::Nodes::Input::InputConfig::default_value, MayaFlux::Nodes::Input::HIDConfig::invert, and m_config.

Referenced by extract_value().

+ Here is the caller graph for this function: