![]() |
MD_SN76489 Library
1.1
Library for SN76489 sound generator
|
#include <MD_SN76489.h>
Public Member Functions | |
MD_SN76489_SPI (uint8_t ld, uint8_t dat, uint8_t clk, uint8_t we, bool MCUclk) | |
void | begin (void) |
![]() | |
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 | |
![]() | |
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 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. | |
![]() | |
const uint8_t | DATA_BITS = 8 |
Number of bits in the byte (for loops) | |
Derived class for SPI 74595 buffer control of the SN76489 IC
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.
ld | the SPI pin to toggle to load the data in the 595 buffer |
dat | the SPI pin to toggle for data transmission to the 595 buffer |
clk | the SPI pin to toggle for clocking data into the 595 buffer |
we | pin number used as write enable for the SN76489 IC |
MCUclk | if true the 4MHz clock signal is generated using MCU timers (hardware dependency) |
|
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.
|
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.
data | the data byte to transmit |
Reimplemented from MD_SN76489.