Skip to content

MiP_Clap

github-actions[bot] edited this page Aug 11, 2026 · 10 revisions

Class MiP_Clap

Manages MiP's clap detection system, from enabling/disabling to delay configuration and event reading.

Table of Contents


Public Functions

enableEvents

Signature: void enableEvents()

Summary: Enables MiP's clap event reporting.

Details:

Verified method: sends the enable command and reads back settings to confirm success. Retries automatically on failure.


disableEvents

Signature: void disableEvents()

Summary: Disables clap event reporting from MiP.

Details:

Verified method: sends the disable command and reads back settings to confirm success. Retries automatically on failure.


areEventsEnabled

Signature: bool areEventsEnabled()

Summary: Checks if clap event reporting is currently enabled.

Returns: true if enabled, false otherwise.


availableEvents

Signature: uint8_t availableEvents()

Summary: Returns the number of unread clap events in the queue.

Details:

Processes any pending serial data first to update the queue.

Returns: uint8_t Number of available clap events.


readEvent

Signature: uint8_t readEvent()

Summary: Reads the next available clap event from the queue.

Details:

Processes pending serial data first. If no event is available, sets last error to MIP_ERROR_NO_EVENT.

Returns: uint8_t The clap event code, or 0 if none available.


readDelay

Signature: uint16_t readDelay()

Summary: Reads the current clap delay setting.

Returns: uint16_t The delay in milliseconds between clap events, or 0 on error.


writeDelay

Signature: void writeDelay(uint16_t delay)

Summary: Sets the minimum delay between clap events.

Details:

Verified method: sends the new delay and confirms by reading back settings. Retries automatically on mismatch or error.

Parameters:

Parameter Description
delay Delay in milliseconds between allowed clap reports.

Clone this wiki locally