2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
33#include "../types/evmu_peripheral.h"
34#include <gimbal/meta/signals/gimbal_signal.h>
37
38
39
40#define EVMU_BUZZER_TYPE (GBL_TYPEID
(EvmuBuzzer))
41#define EVMU_BUZZER(self) (GBL_CAST(EvmuBuzzer, self))
43#define EVMU_BUZZER_GET_CLASS(self) (GBL_CLASSOF(EvmuBuzzer, self))
46#define EVMU_BUZZER_NAME "buzzer"
47#define EVMU_BUZZER_PCM_BUFFER_SIZE 256
49#define GBL_SELF_TYPE EvmuBuzzer
53GBL_FORWARD_DECLARE_STRUCT(EvmuBuzzer);
56
57
58
59
60
61
62
63
64
65
66
67
68GBL_CLASS_DERIVE(EvmuBuzzer, EvmuPeripheral)
69 EVMU_RESULT (*pFnPlayPcm) (GBL_SELF);
70 EVMU_RESULT (*pFnStopPcm) (GBL_SELF);
71 EVMU_RESULT (*pFnBufferPcm)(GBL_SELF);
75
76
77
78
79
80
81
82
83
100GBL_SIGNALS(EvmuBuzzer,
101 (toneStart, (GBL_INSTANCE_TYPE, pReceiver)),
102 (toneStop, (GBL_INSTANCE_TYPE, pReceiver)),
103 (toneUpdate, (GBL_INSTANCE_TYPE, pReceiver),
104 (GBL_UINT16_TYPE, period),
105 (GBL_UINT8_TYPE, invPulseLength))
113
114
115
116
129
130
131
132
136 uint8_t* pInvPulseLen) GBL_NOEXCEPT;
140 uint8_t invPulseLen) GBL_NOEXCEPT;
148
149
150
151
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
GblType EvmuBuzzer_type(void)
EvmuBuzzer's type ID.
#define GBL_PROPERTIES(object,...)
Instance structure for Buzzer Peripheral.
float EvmuBuzzer_pcmGain(const EvmuBuzzer *pSelf)
Returns the PCM buffer's gain to the audio driver.
EVMU_RESULT EvmuBuzzer_stopTone(EvmuBuzzer *pSelf)
Stops playback of the current tone.
EVMU_RESULT EvmuBuzzer_playTone(EvmuBuzzer *pSelf)
Plays the current tone's square wave.
GblBool EvmuBuzzer_isEnabled(const EvmuBuzzer *pSelf)
Returns whether software has enabled or disabled the buzzer.
GblBool EvmuBuzzer_isConfigured(const EvmuBuzzer *pSelf)
Returns whether the buzzer has been configured for playback.
GblBool pcmChanged
User-toggle for polling updates.
EVMU_RESULT EvmuBuzzer_setTone(EvmuBuzzer *pSelf, uint16_t period, uint8_t invPulseLen)
Sets the square wave of the current tone without impacting playback.
GblBool EvmuBuzzer_isActive(const EvmuBuzzer *pSelf)
Returns whether playback is active or not.
void EvmuBuzzer_setEnabled(EvmuBuzzer *pSelf, GblBool en)
Allows software to enable or disable buzzer emulation.
size_t EvmuBuzzer_pcmFrequency(const EvmuBuzzer *pSelf)
Returns the PCM buffer's sample frequency to the audio driver.
void EvmuBuzzer_tone(const EvmuBuzzer *pSelf, uint16_t *pPeriod, uint8_t *pInvPulseLen)
Returns the current tone's square wave.
GblBool enableFreqResp
Enables per-tone gain/volume emulation.
const void * EvmuBuzzer_pcmBuffer(const EvmuBuzzer *pSelf)
Returns the current PCM buffer to the audio driver.
size_t EvmuBuzzer_pcmSamples(const EvmuBuzzer *pSelf)
Returns the PCM buffer's sample size to the audio driver.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)