Adafruit Library
Adafruit_CPlay_Speaker.h
1 // Adafruit Circuit Playground speaker library
2 // by Phil Burgess / Paint Your Dragon.
3 
4 #ifndef ADAFRUIT_CPLAY_SPEAKER_H
5 #define ADAFRUIT_CPLAY_SPEAKER_H
6 
7 #include <Arduino.h>
8 
9 #if !defined(__AVR__) // circuit playground express has nicer amp w/shutdown
10  #define CPLAY_SPEAKER_SHUTDOWN 11
11 #endif
12 
13 /**************************************************************************/
17 /**************************************************************************/
19  public:
20  Adafruit_CPlay_Speaker(void) { started = false; };
21  void begin(void),
22  end(void),
23  set(uint8_t value),
24  playSound(const uint8_t *data, uint32_t length, uint16_t sampleRate,
25  bool tenBit=false),
26  say(const uint8_t *addr);
27 
28  void enable(bool e);
29 
30  /**************************************************************************/
35  /**************************************************************************/
36  void off(void) { enable(false); };
37 
38  /**************************************************************************/
43  /**************************************************************************/
44  void on(void) { enable(true); };
45 
46  private:
47  bool started;
48 };
49 
50 #endif // ADAFRUIT_CPLAY_SPEAKER_H
void playSound(const uint8_t *data, uint32_t length, uint16_t sampleRate, bool tenBit=false)
Plays digitized 8-bit audio (optionally 10 bits on Express board) from a PROGMEM (flash memory) buffe...
Definition: Adafruit_CPlay_Speaker.cpp:103
void off(void)
disable the speaker.
Definition: Adafruit_CPlay_Speaker.h:36
void say(const uint8_t *addr)
speak the data at the passed location
Definition: talkie.cpp:86
void enable(bool e)
enable or disable the speaker. This function only works on &#39;Express&#39; boards.
Definition: Adafruit_CPlay_Speaker.cpp:50
void begin(void)
Sets up Circuit Playground speaker for PWM audio output: enables 48 KHz high-speed PWM mode...
Definition: Adafruit_CPlay_Speaker.cpp:14
void end(void)
Turns off PWM output to the speaker.
Definition: Adafruit_CPlay_Speaker.cpp:61
Class that stores state and functions for the speaker on CircuitPlayground boards.
Definition: Adafruit_CPlay_Speaker.h:18
void on(void)
enable the speaker.
Definition: Adafruit_CPlay_Speaker.h:44