MD_SN76489 Library  1.1
Library for SN76489 sound generator
MD_SN76489_SPI Class Reference

#include <MD_SN76489.h>

Inheritance diagram for MD_SN76489_SPI:
Collaboration diagram for MD_SN76489_SPI:

Public Member Functions

 MD_SN76489_SPI (uint8_t ld, uint8_t dat, uint8_t clk, 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 SPI 74595 buffer control of the SN76489 IC

Constructor & Destructor Documentation

◆ MD_SN76489_SPI()

MD_SN76489_SPI::MD_SN76489_SPI ( uint8_t  ld,
uint8_t  dat,
uint8_t  clk,
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
ldthe SPI pin to toggle to load the data in the 595 buffer
datthe SPI pin to toggle for data transmission to the 595 buffer
clkthe SPI pin to toggle for clocking data into the 595 buffer
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_SPI::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_SPI::send ( uint8_t  data)
protectedvirtual

Send a byte to the SN76489IC.

Send a byte to the SN76489 IC using SPI protocol through a 74595 serial to parallel buffer. Uses the pin numbers passed through the constructor to shift the data out to the buffer IC.

Parameters
datathe data byte to transmit

Reimplemented from MD_SN76489.


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