arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
audio_tools::PWMAudioStreamMBED Class Reference

Audio output to PWM pins for MBED based Arduino implementations. More...

#include <PWMAudioMBED.h>

Inheritance diagram for audio_tools::PWMAudioStreamMBED:
audio_tools::PWMAudioStreamBase audio_tools::AudioPrint audio_tools::Print audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource

Public Member Functions

virtual void end () override
 
- Public Member Functions inherited from audio_tools::PWMAudioStreamBase
virtual int availableForWrite ()
 
bool begin ()
 
bool begin (PWMConfig config)
 starts the processing using Streams
 
bool begin (uint16_t sampleRate, uint8_t channels, PWMCallbackType cb)
 
PWMConfig config ()
 
virtual PWMConfig defaultConfig ()
 
virtual void end ()
 
uint32_t framesPerSecond ()
 
virtual void pwmWrite (int channel, int value)=0
 
virtual void setAudioInfo (AudioBaseInfo info)
 updates the sample rate dynamically More...
 
uint32_t underflowsPerSecond ()
 
virtual size_t write (const uint8_t *wrt_buffer, size_t size)
 
- Public Member Functions inherited from audio_tools::AudioPrint
virtual AudioBaseInfo audioInfo () override
 
virtual int availableForWrite () override
 
virtual bool doRelease ()
 If true we need to release the related memory. More...
 
virtual void flush ()
 
virtual void setAudioInfo (AudioBaseInfo info) override
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
 
virtual size_t write (const uint8_t *buffer, size_t size) override=0
 
virtual size_t write (uint8_t ch) override
 
- Public Member Functions inherited from audio_tools::Print
virtual int availableForWrite ()
 
virtual void flush ()
 
virtual int print (char c, PrintCharFmt spec)
 
virtual int print (const char *msg)
 
virtual int print (int number)
 
virtual int println (const char *msg="")
 
virtual size_t write (const char *buffer, size_t size)
 
virtual size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t ch)
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
 
virtual void setAudioInfo (AudioBaseInfo info)=0
 
virtual bool validate (AudioBaseInfo &info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Member Functions

virtual int maxChannels ()
 
virtual int maxOutputValue ()
 provides the max value for the configured resulution More...
 
virtual void pwmWrite (int channel, int value)
 write a pwm value to the indicated channel. The max value depends on the resolution More...
 
virtual void setupPWM ()
 Setup PWM Pins. More...
 
virtual void setupTimer ()
 not used -> see startTimer(); More...
 
virtual void startTimer () override
 when we get the first write -> we activate the timer to start with the output of data More...
 
- Protected Member Functions inherited from audio_tools::PWMAudioStreamBase
virtual int maxChannels ()=0
 
virtual int maxOutputValue ()=0
 
virtual int nextValue ()
 determines the next scaled value
 
void playNextFrame ()
 
void playNextFrameCallback ()
 
void playNextFrameStream ()
 writes the next frame to the output pins
 
virtual void setupPWM ()=0
 
virtual void setupTimer ()=0
 
virtual void startTimer ()
 when we get the first write -> we activate the timer to start with the output of data More...
 
void updateStatistics ()
 

Static Protected Member Functions

static void defaultPWMAudioOutputCallback (void *obj)
 timer callback: write the next frame to the pins
 

Protected Attributes

Vector< mbed::PwmOut * > pins
 
TimerAlarmRepeating ticker
 
- Protected Attributes inherited from audio_tools::PWMAudioStreamBase
PWMConfig audio_config
 
NBuffer< uint8_t > * buffer = nullptr
 
uint32_t frame_count = 0
 
uint32_t frames_per_second = 0
 
bool is_timer_started = false
 
uint32_t time_1_sec
 
uint32_t underflow_count = 0
 
uint32_t underflow_per_second = 0
 
PWMCallbackType user_callback = nullptr
 
- Protected Attributes inherited from audio_tools::AudioPrint
AudioBaseInfo cfg
 
AudioBaseInfoDependentp_notify =nullptr
 
uint8_t tmp [MAX_SINGLE_CHARS]
 
int tmpPos =0
 

Detailed Description

Audio output to PWM pins for MBED based Arduino implementations.

Author
Phil Schatzmann

Member Function Documentation

◆ end()

virtual void audio_tools::PWMAudioStreamMBED::end ( )
inlineoverridevirtual

Reimplemented from audio_tools::PWMAudioStreamBase.

◆ maxChannels()

virtual int audio_tools::PWMAudioStreamMBED::maxChannels ( )
inlineprotectedvirtual

◆ maxOutputValue()

virtual int audio_tools::PWMAudioStreamMBED::maxOutputValue ( )
inlineprotectedvirtual

provides the max value for the configured resulution

Implements audio_tools::PWMAudioStreamBase.

◆ pwmWrite()

virtual void audio_tools::PWMAudioStreamMBED::pwmWrite ( int  channel,
int  value 
)
inlineprotectedvirtual

write a pwm value to the indicated channel. The max value depends on the resolution

Implements audio_tools::PWMAudioStreamBase.

◆ setupPWM()

virtual void audio_tools::PWMAudioStreamMBED::setupPWM ( )
inlineprotectedvirtual

Setup PWM Pins.

Implements audio_tools::PWMAudioStreamBase.

◆ setupTimer()

virtual void audio_tools::PWMAudioStreamMBED::setupTimer ( )
inlineprotectedvirtual

not used -> see startTimer();

Implements audio_tools::PWMAudioStreamBase.

◆ startTimer()

virtual void audio_tools::PWMAudioStreamMBED::startTimer ( )
inlineoverrideprotectedvirtual

when we get the first write -> we activate the timer to start with the output of data

Reimplemented from audio_tools::PWMAudioStreamBase.


The documentation for this class was generated from the following file: