Skip to content

MiP_Clap

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

Class MiP_Clap

MiP_Clap manages MiP's clap detection system, from enabling to disabling, configuring, and reporting on detected clap events.

Public Elements

MIP_CMD_ENABLE_CLAP

Signature: constexpr uint8_t MIP_CMD_ENABLE_CLAP

Summary: The MiP protocol command to enable MiP's clap detection system.


MIP_CMD_CLAP_RESPONSE

Signature: constexpr uint8_t MIP_CMD_CLAP_RESPONSE

Summary: The MiP protocol response reporting the number of claps detected.


MIP_CMD_SET_CLAP_DELAY

Signature: constexpr uint8_t MIP_CMD_SET_CLAP_DELAY

Summary: The MiP protocol command to set the minimum delay time between claps.


MIP_CMD_GET_CLAP_SETTINGS

Signature: constexpr uint8_t MIP_CMD_GET_CLAP_SETTINGS

Summary: The MiP protocol command to read MiP's clap detection settings.


MiP_Clap

Signature: MiP_Clap(MiP &mip)

Summary: Constructs the clap system manager.

Parameters:

Parameter Description
mip A reference to the main MiP object to access core services.

enableEvents

Signature: void enableEvents()

Summary: Enables MiP's clap event reporting. This verified method sends the enable command and reads back settings to confirm success. It retries on failure.


disableEvents

Signature: void disableEvents()

Summary: Disables clap event reporting from MiP. This verified method sends the disable command and reads back settings to confirm success. It retries 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. Processes any pending serial data first to update the queue.

Returns: Number of available clap events.


readEvent

Signature: uint8_t readEvent()

Summary: Reads the next available clap event from the queue. Processes pending serial data first. If no event is available, sets last error to MIP_ERROR_NO_EVENT.

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


readDelay

Signature: uint16_t readDelay()

Summary: Reads the current clap delay setting.

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


writeDelay

Signature: void writeDelay(uint16_t delay)

Summary: Sets the minimum delay between clap events. Verified method: sends the new delay and confirms by reading back the settings. Retries automatically on mismatch or error.

Parameters:

Parameter Description
delay Delay in milliseconds between allowed clap reports.

Clone this wiki locally