![]() |
MD_SN76489 Library
1.1
Library for SN76489 sound generator
|
#include <MD_SN76489.h>
Public Member Functions | |
MD_SN76489_Direct (const uint8_t *D, 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 direct I/O control of the SN76489 IC
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.
D | pointer to array of 8 pins number used to interface to SN76489 IC pins D0 to D7 in that order. |
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 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.
data | the data byte to transmit |
Reimplemented from MD_SN76489.