source: trunk/Arduino/libraries/Adafruit_Circuit_Playground/utility/Adafruit_CPlay_Speaker.h

Last change on this file was 3, checked in by markus, 7 years ago

Setup project structure

File size: 1.6 KB
Line 
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 ///< shutdown pin (Express boards only)
11#endif
12
13/**************************************************************************/
14/*!
15    @brief  Class that stores state and functions for the speaker on CircuitPlayground boards
16*/
17/**************************************************************************/
18class Adafruit_CPlay_Speaker {
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  /**************************************************************************/
31  /*!
32      @brief  disable the speaker.
33      @note this function only has an effect on 'Express' boards
34  */
35  /**************************************************************************/
36  void off(void) { enable(false); };
37
38  /**************************************************************************/
39  /*!
40      @brief  enable the speaker.
41      @note this function only has an effect on 'Express' boards
42  */
43  /**************************************************************************/
44  void on(void) { enable(true); };
45
46 private:
47  bool started;
48};
49
50#endif // ADAFRUIT_CPLAY_SPEAKER_H
Note: See TracBrowser for help on using the repository browser.