Daiki Kato / PwmOutSpeaker
Embed: (wiki syntax)

« Back to documentation index

PwmOutSpeaker Class Reference

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 
)

Create a PwmOutSpeaker.

Parameters:
pwm_l
pwm_r

Definition at line 26 of file PwmOutSpeaker.cpp.


Member Function Documentation

bool format ( char  length ) [virtual]

Set I2S interface bit length and mode.

Parameters:
lengthSet 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:
frequencySample 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:
volumeSpeaker 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_dataLocation of the data
data_sizeNumber of bytes to write
Returns:
Number of bytes written on success. negative number on error.

Definition at line 80 of file PwmOutSpeaker.cpp.