SPIKE-RT C API Reference [English]
An RTOS-based software platform for LEGO® Education SPIKE™.
Loading...
Searching...
No Matches
Speaker.h
1//
2// Speaker.h
3//
4// Copyright (c) 2025 Embedded Technology Software Design Robot Contest
5//
6
7#ifndef SPIKE_CPP_API_SPEAKER_H_
8#define SPIKE_CPP_API_SPEAKER_H_
9
10#include <cstdint>
11extern "C" {
12#include <spike/hub/speaker.h>
13}
14
15namespace spikeapi {
20{
21public:
22
28 Speaker(void) = default;
29
34 void setVolume(uint8_t volume) const {
36 }
37
43 void playTone(uint16_t frequency, int32_t duration) const {
44 hub_speaker_play_tone(frequency, duration);
45 }
46
50 void stop() const {
52 }
53
58 bool hasError() { return false; }
59
60
61
62}; // class Speaker
63} // namespace spikeapi
64
65#endif // !SPIKE_CPP_API_SPEAKER_H_
Definition Speaker.h:20
void setVolume(uint8_t volume) const
Definition Speaker.h:34
Speaker(void)=default
void playTone(uint16_t frequency, int32_t duration) const
Definition Speaker.h:43
void stop() const
Definition Speaker.h:50
bool hasError()
Definition Speaker.h:58
void hub_speaker_stop(void)
Stop the sound.
Definition speaker.c:49
void hub_speaker_play_tone(uint16_t frequency, int32_t duration)
Play a tone.
Definition speaker.c:39
void hub_speaker_set_volume(uint8_t volume)
Set the volume level of speaker.
Definition speaker.c:19
API for the hub built-in speaker.