Interface: moteiv.tos.sensorboards.invent.Speaker
interface Speaker
Interface for sending sound through a speaker.
- Author:
-
Joe Polastre, Moteiv Corporation <info@moteiv.com>
Commands
command result_t start(void *addr, uint16_t length, bool word, uint16_t freq, bool repeat)
command result_t stop()
Events
event void done(void *addr, uint16_t length, bool repeat)
event void repeat(void *addr, uint16_t length)
event void started(void *addr, uint16_t length, result_t result)
Commands - Details
start
command result_t start(void *addr, uint16_t length, bool word, uint16_t freq, bool repeat)
- Parameters:
-
addr
- Memory address of first sample
-
length
- The length of the audio sample
-
word
- TRUE if 12-bit data, FALSE for 8-bit data
-
freq
- Frequency that the audio sample was recorded
-
repeat
- TRUE to repeat the sample infinitely, FALSE to play once
- Returns:
-
SUCCESS if the playback can begin immediately
stop
command result_t stop()
- Returns:
-
SUCCESS if playback is halted (a done() event will be signalled),
FAIL if no sample is playing or if it cannot be halted.
Events - Details
done
event void done(void *addr, uint16_t length, bool repeat)
- Parameters:
-
addr
- Address of the audio sample
-
length
- Length of the audio sample
-
freq
- Frequency of the recorded audio sample
-
repeat
- Notification of a repeat-play or single-play sample
repeat
event void repeat(void *addr, uint16_t length)
started
event void started(void *addr, uint16_t length, result_t result)
- Parameters:
-
addr
- Address of the audio sample
-
length
- Length of the audio sample