MD_SN76489 Library  1.1
Library for SN76489 sound generator
MD_SN76489_Direct Class Reference

#include <MD_SN76489.h>

Inheritance diagram for MD_SN76489_Direct:
Collaboration diagram for MD_SN76489_Direct:

Public Member Functions

 MD_SN76489_Direct (const uint8_t *D, uint8_t we, bool MCUclk)
 
void begin (void)
 
- Public Member Functions inherited from MD_SN76489
 MD_SN76489 (bool clock)
 
 ~MD_SN76489 (void)
 
void setVolume (uint8_t chan, uint8_t v)
 
void setVolume (uint8_t v)
 
void setFrequency (uint8_t chan, uint16_t freq)
 
void setNoise (noiseType_t noise)
 
void tone (uint8_t chan, uint16_t freq, uint8_t volume, uint16_t duration=0)
 
void note (uint8_t chan, uint16_t freq, uint8_t volume, uint16_t duration=0)
 
void noise (noiseType_t noise, uint8_t volume, uint16_t duration=0)
 
bool setADSR (uint8_t chan, adsrEnvelope_t *padsr)
 
bool setADSR (adsrEnvelope_t *padsr)
 
bool isIdle (uint8_t chan)
 
void play (void)
 
void write (uint8_t data)
 

Protected Member Functions

void send (uint8_t data)
 

Additional Inherited Members

- Public Types inherited from MD_SN76489
enum  noiseType_t {
  PERIODIC_0 = 0x0, PERIODIC_1 = 0x1, PERIODIC_2 = 0x2, PERIODIC_3 = 0x3,
  WHITE_0 = 0x4, WHITE_1 = 0x5, WHITE_2 = 0x6, WHITE_3 = 0x7,
  NOISE_OFF = 0xf
}
 
- Static Public Attributes inherited from MD_SN76489
static const uint8_t MAX_CHANNELS = 4
 Number of available sound channels.
 
static const uint8_t NOISE_CHANNEL = 3
 The channel for periodic/white noise.
 
static const uint8_t VOL_OFF = 0x0
 Convenience constant for volume off.
 
static const uint8_t VOL_MAX = 0xf
 Convenience constant for volume on.
 
- Protected Attributes inherited from MD_SN76489
const uint8_t DATA_BITS = 8
 Number of bits in the byte (for loops)
 

Detailed Description

Derived class for direct I/O control of the SN76489 IC

Constructor & Destructor Documentation

◆ MD_SN76489_Direct()

MD_SN76489_Direct::MD_SN76489_Direct ( const uint8_t *  D,
uint8_t  we,
bool  MCUclk 
)

Class Constructor.

Instantiate a new instance of this derived class. The parameters passed are used to connect the software to the hardware. Multiple instances may co-exist.

The D array is arranged to correspond to the IC pins (ie, pin D[0] is connected to IC pin D0, D[1] to D1, etc). D0 is the MSB in the data byte, D7 the LSB.

See also
Hardware Connections
Parameters
Dpointer to array of 8 pins number used to interface to SN76489 IC pins D0 to D7 in that order.
wepin number used as write enable for the SN76489 IC
MCUclkif true the 4MHz clock signal is generated using MCU timers (hardware dependency)

Member Function Documentation

◆ begin()

void MD_SN76489_Direct::begin ( void  )
virtual

Initialize the object.

Initialize the object data. This needs to be called during setup() to initialize new data for the class that cannot be done during the object creation.

Initializes the output pins.

Reimplemented from MD_SN76489.

◆ send()

void MD_SN76489_Direct::send ( uint8_t  data)
protectedvirtual

Send a byte to the SN76489IC.

Send a byte to the SN76489 IC directly connected to the MCU I/O pins. Uses the pin number from the D array to send data D0-D7, where D0 is the MSB.

Parameters
datathe data byte to transmit

Reimplemented from MD_SN76489.


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