Neil Thiessen
/
MAX9723_HelloWorld
A simple serial test program for the MAX9723 library.
main.cpp@0:b141b0729a1b, 2014-05-30 (annotated)
- Committer:
- neilt6
- Date:
- Fri May 30 19:47:53 2014 +0000
- Revision:
- 0:b141b0729a1b
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
neilt6 | 0:b141b0729a1b | 1 | #include "mbed.h" |
neilt6 | 0:b141b0729a1b | 2 | #include "MAX9723.h" |
neilt6 | 0:b141b0729a1b | 3 | |
neilt6 | 0:b141b0729a1b | 4 | //Create a MAX9723 object at the default address (ADDRESS_0) |
neilt6 | 0:b141b0729a1b | 5 | MAX9723 amp(p28, p27); |
neilt6 | 0:b141b0729a1b | 6 | |
neilt6 | 0:b141b0729a1b | 7 | int main() |
neilt6 | 0:b141b0729a1b | 8 | { |
neilt6 | 0:b141b0729a1b | 9 | //Try to open the MAX9723 |
neilt6 | 0:b141b0729a1b | 10 | if (amp.open()) { |
neilt6 | 0:b141b0729a1b | 11 | printf("Device detected!\n"); |
neilt6 | 0:b141b0729a1b | 12 | |
neilt6 | 0:b141b0729a1b | 13 | //Configure the MAX9723 for no BassMax, and low gain |
neilt6 | 0:b141b0729a1b | 14 | amp.enabled(true); |
neilt6 | 0:b141b0729a1b | 15 | amp.bassMax(false); |
neilt6 | 0:b141b0729a1b | 16 | amp.maxGain(false); |
neilt6 | 0:b141b0729a1b | 17 | |
neilt6 | 0:b141b0729a1b | 18 | //Set the volume for 50% |
neilt6 | 0:b141b0729a1b | 19 | amp = 0.50; |
neilt6 | 0:b141b0729a1b | 20 | } else { |
neilt6 | 0:b141b0729a1b | 21 | error("Device not detected!\n"); |
neilt6 | 0:b141b0729a1b | 22 | } |
neilt6 | 0:b141b0729a1b | 23 | } |