SatCat5
satcat5::cfg::Piezo Class Reference

Detailed Description

ConfigBus-controlled piezoelectric buzzer.

This class controls the HDL block defined in "cfgbus_piezo.vhd". It plays back a queue of musical notes, where each note is defined by a paired duration and frequency.

See also
io::RtttlDecoder

Definition at line 24 of file cfgbus_piezo.h.

#include <cfgbus_piezo.h>

Inheritance diagram for satcat5::cfg::Piezo:
[legend]
Collaboration diagram for satcat5::cfg::Piezo:
[legend]

Public Member Functions

 Piezo (satcat5::cfg::ConfigBus *cfg, unsigned devaddr, unsigned regaddr=0)
 Link this object to the "cfgbus_piezo" control register.
 
void flush ()
 Silence playback and flush internal queue.
 
satcat5::io::Writeablequeue ()
 Access the internal playback buffer for writing commands. More...
 
virtual void data_unlink (satcat5::io::Readable *src)
 Unlink this EventListener from the designated source, because the designated Readable object is being destroyed. More...
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 

Static Public Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Protected Member Functions

void data_rcvd (satcat5::io::Readable *src) override
 The data_rcvd() callback is polled whenever data is available. More...
 
void timer_event () override
 Child class MUST override this method.
 
void wait ()
 

Protected Attributes

satcat5::cfg::Register m_reg
 Base control register.
 
satcat5::io::PacketBuffer m_queue
 Playback queue.
 
u8 m_raw [SATCAT5_PIEZO_BUFFER]
 Raw working buffer.
 

Private Member Functions

void query (unsigned elapsed_msec)
 

Private Attributes

satcat5::poll::Timerm_next
 
unsigned m_trem
 
unsigned m_tnext
 

Member Function Documentation

◆ data_rcvd()

void Piezo::data_rcvd ( satcat5::io::Readable src)
overrideprotectedvirtual

The data_rcvd() callback is polled whenever data is available.

A pointer is provided to assist handlers with multiple sources. Child objects of io::EventListener MUST override this method.

Implements satcat5::io::EventListener.

Definition at line 26 of file cfgbus_piezo.cc.

◆ data_unlink()

virtual void satcat5::io::EventListener::data_unlink ( satcat5::io::Readable src)
inlinevirtualinherited

Unlink this EventListener from the designated source, because the designated Readable object is being destroyed.

Child objects of io::EventListener MAY override this method if action is required.

Reimplemented in satcat5::io::Override, satcat5::io::MuxUp, satcat5::io::MuxDown, satcat5::io::BufferedPackets, satcat5::io::BufferedStream, satcat5::io::BufferedCopy, satcat5::eth::SwitchLogReader, satcat5::eth::Dispatch, satcat5::ccsds_spp::Dispatch, satcat5::ccsds_aos::Dispatch, satcat5::ccsds_aos::Channel, satcat5::test::MockOffload::Port, and satcat5::freertos::MessageCopy.

Definition at line 54 of file io_readable.h.

◆ queue()

satcat5::io::Writeable* satcat5::cfg::Piezo::queue ( )
inline

Access the internal playback buffer for writing commands.

Each single-note command is a duration (u16, milliseconds) followed by a frequency (u32, see "cfgbus_piezo.vhd").

Definition at line 39 of file cfgbus_piezo.h.


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