Skip to content

Commit d82df4c

Browse files
committed
correctly using enum for registers
1 parent c2a18ab commit d82df4c

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

examples/Example_08_Sound_Effects/Example_08_Sound_Effects.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#include <SparkFun_Qwiic_Buzzer_Arduino_Library.h>
7777
QwiicBuzzer buzzer;
7878

79-
#define BUZZER_VOLUME 4 // loudest!!
79+
#define BUZZER_VOLUME 4 // loudest!!
8080
//#define BUZZER_VOLUME 3 // pretty good volume for most things
8181
sfeTkError_t err; // used for checking for errors
8282

src/sfeQwiicBuzzer.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class sfeQwiicBuzzer
109109
/// @param soundEffectNumber The sound effect you with to play
110110
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
111111
/// @return 0 for succuss, negative for errors, positive for warnings
112-
sfeTkError_t playSoundEffect(const uint8_t &soundEffectNumber, const uint8_t &volume);
112+
sfeTkError_t playSoundEffect(const uint8_t soundEffectNumber, const uint8_t volume);
113113

114114
private:
115115
/// @brief Plays sound effect 0 (aka "Siren")
@@ -118,15 +118,15 @@ class sfeQwiicBuzzer
118118
/// single "up and down" cycle.
119119
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
120120
/// @return 0 for succuss, negative for errors, positive for warnings
121-
sfeTkError_t soundEffect0(const uint8_t &volume);
121+
sfeTkError_t soundEffect0(const uint8_t volume);
122122

123123
/// @brief Plays sound effect 1 (aka "3 Fast Sirens")
124124
/// Intended to sound like a siren, starting at a low frequency, and then
125125
/// increasing rapidly up and then back down. This sound effect does this
126126
/// cycle of "up and down" three times rapidly.
127127
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
128128
/// @return 0 for succuss, negative for errors, positive for warnings
129-
sfeTkError_t soundEffect1(const uint8_t &volume);
129+
sfeTkError_t soundEffect1(const uint8_t volume);
130130

131131
/// @brief Plays sound effect 2 (aka "robot saying 'Yes'")
132132
/// Intended to sound like a robot saying the word "yes".
@@ -135,7 +135,7 @@ class sfeQwiicBuzzer
135135
/// sound to any question you may ask your buzzing robot.
136136
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
137137
/// @return 0 for succuss, negative for errors, positive for warnings
138-
sfeTkError_t soundEffect2(const uint8_t &volume);
138+
sfeTkError_t soundEffect2(const uint8_t volume);
139139

140140
/// @brief Plays sound effect 3 (aka "robot yelling 'YES!'" - faster)
141141
/// Intended to sound like a robot saying the word "yes".
@@ -145,7 +145,7 @@ class sfeQwiicBuzzer
145145
/// is done more quickly, it can add enthusiasm to the buzzing sound.
146146
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
147147
/// @return 0 for succuss, negative for errors, positive for warnings
148-
sfeTkError_t soundEffect3(const uint8_t &volume);
148+
sfeTkError_t soundEffect3(const uint8_t volume);
149149

150150
/// @brief Plays sound effect 4 (aka "robot saying 'No'")
151151
/// Intended to sound like a robot saying the word "no".
@@ -154,7 +154,7 @@ class sfeQwiicBuzzer
154154
/// sound to any question you may ask your buzzing robot.
155155
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
156156
/// @return 0 for succuss, negative for errors, positive for warnings
157-
sfeTkError_t soundEffect4(const uint8_t &volume);
157+
sfeTkError_t soundEffect4(const uint8_t volume);
158158

159159
/// @brief Plays sound effect 5 (aka "robot yelling 'NO!'" - faster)
160160
/// Intended to sound like a robot saying the word "no".
@@ -164,33 +164,33 @@ class sfeQwiicBuzzer
164164
/// is done more quickly, it can add enthusiasm to the buzzing sound.
165165
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
166166
/// @return 0 for succuss, negative for errors, positive for warnings
167-
sfeTkError_t soundEffect5(const uint8_t &volume);
167+
sfeTkError_t soundEffect5(const uint8_t volume);
168168

169169
/// @brief Plays sound effect 6 (aka "Laughing Robot")
170170
/// Intended to sound like your robot is laughing at you.
171171
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
172172
/// @return 0 for succuss, negative for errors, positive for warnings
173-
sfeTkError_t soundEffect6(const uint8_t &volume);
173+
sfeTkError_t soundEffect6(const uint8_t volume);
174174

175175
/// @brief Plays sound effect 7 (aka "Laughing Robot Faster")
176176
/// Intended to sound like your robot is laughing at you. As this sound
177177
/// is done more quickly, it can add enthusiasm to the buzzing sound.
178178
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
179179
/// @return 0 for succuss, negative for errors, positive for warnings
180-
sfeTkError_t soundEffect7(const uint8_t &volume);
180+
sfeTkError_t soundEffect7(const uint8_t volume);
181181

182182
/// @brief Plays sound effect 8 (aka "Crying Robot")
183183
/// Intended to sound like a robot is crying and sad.
184184
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
185185
/// @return 0 for succuss, negative for errors, positive for warnings
186-
sfeTkError_t soundEffect8(const uint8_t &volume);
186+
sfeTkError_t soundEffect8(const uint8_t volume);
187187

188188
/// @brief Plays sound effect 9 (aka "Crying Robot Faster")
189189
/// Intended to sound like a robot is crying and sad. As this sound
190190
/// is done more quickly, it can add enthusiasm to the buzzing sound.
191191
/// @param volume Volume (4 settings; 0=off, 1=quiet... 4=loudest)
192192
/// @return 0 for succuss, negative for errors, positive for warnings
193-
sfeTkError_t soundEffect9(const uint8_t &volume);
193+
sfeTkError_t soundEffect9(const uint8_t volume);
194194

195195
protected:
196196
sfeTkII2C *_theBus;

src/sfeQwiicBuzzerRegisters.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
enum Qwiic_Buzzer_Register : uint8_t
3333
{
3434
kSfeQwiicBuzzerRegId = 0x00,
35-
kSfeQwiicBuzzerRegFirmwareMinor = 0x01,
36-
kSfeQwiicBuzzerRegFirmwareMajor = 0x02,
37-
kSfeQwiicBuzzerRegToneFrequencyMsb = 0x03,
38-
kSfeQwiicBuzzerRegToneFrequencyLsb = 0x04,
39-
kSfeQwiicBuzzerRegVolume = 0x05,
40-
kSfeQwiicBuzzerRegDurationMsb = 0x06,
41-
kSfeQwiicBuzzerRegDurationLsb = 0x07,
42-
kSfeQwiicBuzzerRegActive = 0x08,
43-
kSfeQwiicBuzzerRegSaveSettings = 0x09,
44-
kSfeQwiicBuzzerRegI2cAddress = 0x0A,
35+
kSfeQwiicBuzzerRegFirmwareMinor,
36+
kSfeQwiicBuzzerRegFirmwareMajor,
37+
kSfeQwiicBuzzerRegToneFrequencyMsb,
38+
kSfeQwiicBuzzerRegToneFrequencyLsb,
39+
kSfeQwiicBuzzerRegVolume,
40+
kSfeQwiicBuzzerRegDurationMsb,
41+
kSfeQwiicBuzzerRegDurationLsb,
42+
kSfeQwiicBuzzerRegActive,
43+
kSfeQwiicBuzzerRegSaveSettings,
44+
kSfeQwiicBuzzerRegI2cAddress,
4545
};

0 commit comments

Comments
 (0)