-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSE321_audio_transducer.h
62 lines (52 loc) · 1.18 KB
/
CSE321_audio_transducer.h
1
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @author Caroline Hart, cmhart2@buffalo.edu
* @date December 10, 2021
* @brief This file contains the headers needed for audio_transducer.cpp
* @functions:
* void setup()
* void setState(int state)
* int getState()
* @variable:
* private int _state
**/
#ifndef MBED_H
#include "mbed.h"
#endif
#ifndef PINNAMES_H
#include "PinNames.h"
#endif
#define Vcc PC_3
#define OUT PC_4
#ifndef ON
#define ON 1
#define OFF 0
#endif
class CSE321_AudioTransducer {
public:
/**
* Constructor
*
* @param v_cc Pin to use for the Vcc connection
* @param out Pin to use for the audio transducer output connection
*/
CSE321_AudioTransducer(PinName v_cc = Vcc, PinName out = OUT);
/** setup
*
* @brief enables the clock and port mode registers
*/
void setup();
/** setState
*
* @brief set the state of the vibration motor
* @param state 0 for off, 1 for on
*/
void setState(int state);
/** getState
*
* @brief fetch the current state of the audio transducer
* @return 1 if audio transducer is on, 0 otherwise
*/
int getState();
private:
int _state;
};