Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PwmOutSpeaker Class Reference
PwmOutSpeaker class. More...
#include <PwmOutSpeaker.h>
Public Member Functions | |
| PwmOutSpeaker (PinName pwm_l, PinName pwm_r) | |
| Create a PwmOutSpeaker. | |
| virtual bool | format (char length) |
| Set I2S interface bit length and mode. | |
| virtual bool | frequency (int hz) |
| Set sample frequency. | |
| virtual int | write (void *const p_data, uint32_t data_size, const rbsp_data_conf_t *const p_data_conf=NULL) |
| Enqueue asynchronous write request. | |
| virtual bool | outputVolume (float leftVolumeOut, float rightVolumeOut) |
| Volume control. | |
Detailed Description
PwmOutSpeaker class.
Definition at line 26 of file PwmOutSpeaker.h.
Constructor & Destructor Documentation
| PwmOutSpeaker | ( | PinName | pwm_l, |
| PinName | pwm_r | ||
| ) |
Member Function Documentation
| bool format | ( | char | length ) | [virtual] |
Set I2S interface bit length and mode.
- Parameters:
-
length Set bit length to 8 or 16 bits
- Returns:
- true = success, false = failure
Definition at line 35 of file PwmOutSpeaker.cpp.
| bool frequency | ( | int | hz ) | [virtual] |
Set sample frequency.
- Parameters:
-
frequency Sample frequency of data in Hz
- Returns:
- true = success, false = failure
Supports the following frequencies: 8kHz, 8.021kHz, 32kHz, 44.1kHz, 48kHz Default is 44.1kHz
Definition at line 48 of file PwmOutSpeaker.cpp.
| bool outputVolume | ( | float | leftVolumeOut, |
| float | rightVolumeOut | ||
| ) | [virtual] |
Volume control.
- Parameters:
-
volume Speaker volume
- Returns:
- Returns "true" for success, "false" if parameters are out of range Parameters accept a value, where 0.0 <= parameter <= 1.0 (1.0 = default)
Definition at line 128 of file PwmOutSpeaker.cpp.
| int write | ( | void *const | p_data, |
| uint32_t | data_size, | ||
| const rbsp_data_conf_t *const | p_data_conf = NULL |
||
| ) | [virtual] |
Enqueue asynchronous write request.
- Parameters:
-
p_data Location of the data data_size Number of bytes to write
- Returns:
- Number of bytes written on success. negative number on error.
Definition at line 80 of file PwmOutSpeaker.cpp.
Generated on Tue Jul 12 2022 20:33:39 by
1.7.2