SPIKE-RT C++ API Reference
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 <stdint.h>
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 {
35 hub_speaker_set_volume(volume);
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 {
51 hub_speaker_stop();
52 }
53
58 bool hasError() { return false; }
59
60
61
62}; // class Speaker
63} // namespace spikeapi
64
65#endif // !SPIKE_CPP_API_SPEAKER_H_
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