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>
11
extern
"C"
{
12
#include <spike/hub/speaker.h>
13
}
14
15
namespace
spikeapi {
19
class
Speaker
20
{
21
public
:
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_
spikeapi::Speaker::setVolume
void setVolume(uint8_t volume) const
Definition
Speaker.h:34
spikeapi::Speaker::Speaker
Speaker(void)=default
spikeapi::Speaker::playTone
void playTone(uint16_t frequency, int32_t duration) const
Definition
Speaker.h:43
spikeapi::Speaker::stop
void stop() const
Definition
Speaker.h:50
spikeapi::Speaker::hasError
bool hasError()
Definition
Speaker.h:58
libcpp-spike
include
Speaker.h
Generated by
1.14.0