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

Experimental: Audio output to PWM pins for the AVR. The AVR supports only up to 2 channels. More...

#include <PWMAudioAVR.h>

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

Public Member Functions

virtual void end ()
 
void logConfig ()
 
virtual int maxChannels ()
 
virtual void pwmWrite (int channel, int value)
 
void setupPin (int pin)
 
void setupPWM ()
 Setup LED PWM. More...
 
void setupTimer ()
 Setup AVR timer with callback. More...
 
- 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 ()
 
virtual bool doRelease ()
 If true we need to release the related memory. More...
 
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 Print
virtual int availableForWrite ()
 
void clearWriteError ()
 
virtual void flush ()
 
int getWriteError ()
 
size_t print (char)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char[])
 
size_t print (const Printable &)
 
size_t print (const String &)
 
size_t print (double, int=2)
 
size_t print (int, int=DEC)
 
size_t print (long long, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned char, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (unsigned long long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t println (char)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char[])
 
size_t println (const Printable &)
 
size_t println (const String &s)
 
size_t println (double, int=2)
 
size_t println (int, int=DEC)
 
size_t println (long long, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned char, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (unsigned long long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (void)
 
size_t write (const char *buffer, size_t size)
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t)=0
 
- 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 maxOutputValue ()
 
- 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 ()
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Protected Attributes

int pins [2] = {3, 11}
 
- 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
 

Friends

void defaultPWMAudioOutputCallback ()
 separate method that can be defined as friend so that we can access protected information More...
 

Detailed Description

Experimental: Audio output to PWM pins for the AVR. The AVR supports only up to 2 channels.

Author
Phil Schatzmann

Member Function Documentation

◆ end()

virtual void audio_tools::PWMAudioStreamAVR::end ( )
inlinevirtual

Reimplemented from audio_tools::PWMAudioStreamBase.

◆ maxChannels()

virtual int audio_tools::PWMAudioStreamAVR::maxChannels ( )
inlinevirtual

◆ maxOutputValue()

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

◆ pwmWrite()

virtual void audio_tools::PWMAudioStreamAVR::pwmWrite ( int  channel,
int  value 
)
inlinevirtual

◆ setupPWM()

void audio_tools::PWMAudioStreamAVR::setupPWM ( )
inlinevirtual

Setup LED PWM.

Implements audio_tools::PWMAudioStreamBase.

◆ setupTimer()

void audio_tools::PWMAudioStreamAVR::setupTimer ( )
inlinevirtual

Setup AVR timer with callback.

Implements audio_tools::PWMAudioStreamBase.

Friends And Related Function Documentation

◆ defaultPWMAudioOutputCallback

void defaultPWMAudioOutputCallback ( )
friend

separate method that can be defined as friend so that we can access protected information

timer callback: write the next frame to the pins


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