src/OPL2.cpp
/**
 * Send the given byte of data to the given register of the OPL2 chip.
 */
Send the given byte of data to the given register of the OPL2 chip.
Send the given byte of data to the given register of the OPL2 chip .
void OPL2::write(byte reg, byte data) {
	digitalWrite(pinAddress, LOW);
	#if BOARD_TYPE == OPL2_BOARD_TYPE_ARDUINO
		SPI.transfer(reg);
	#else
		wiringPiSPIDataRW(SPI_CHANNEL, &reg, 1);
	#endif
	digitalWrite(pinLatch, LOW);
	delayMicroseconds(1);
	digitalWrite(pinLatch, HIGH);
	delayMicroseconds(4);
	digitalWrite(pinAddress, HIGH);
	#if BOARD_TYPE == OPL2_BOARD_TYPE_ARDUINO
		SPI.transfer(data);
	#else
		wiringPiSPIDataRW(SPI_CHANNEL, &data, 1);
	#endif
	digitalWrite(pinLatch, LOW);
	delayMicroseconds(1);
	digitalWrite(pinLatch, HIGH);
	delayMicroseconds(23);
}
void OPL2 :: write ( byte reg , byte data ) { digitalWrite ( pinAddress , LOW ) ; #if BOARD_TYPE == OPL2_BOARD_TYPE_ARDUINO SPI . transfer ( reg ) ; #else wiringPiSPIDataRW ( SPI_CHANNEL , & reg , 1 ) ; #endif digitalWrite ( pinLatch , LOW ) ; delayMicroseconds ( 1 ) ; digitalWrite ( pinLatch , HIGH ) ; delayMicroseconds ( 4 ) ; digitalWrite ( pinAddress , HIGH ) ; #if BOARD_TYPE == OPL2_BOARD_TYPE_ARDUINO SPI . transfer ( data ) ; #else wiringPiSPIDataRW ( SPI_CHANNEL , & data , 1 ) ; #endif digitalWrite ( pinLatch , LOW ) ; delayMicroseconds ( 1 ) ; digitalWrite ( pinLatch , HIGH ) ; delayMicroseconds ( 23 ) ; }
Send the given byte of data to the given register of the OPL2 chip.
Send the given byte of data to the given register of the OPL2 chip .