/** \brief Send the display a command byte

    Send a command via SPI, I2C or parallel	to SSD1306 controller.
	For SPI we set the DC and CS pins here, and call spiTransfer(byte)
	to send the data. For I2C and Parallel we use the write functions
	defined in hardware.cpp to send the data.
*/
void MicroOLED::command(uint8_t c) {

	if (interface == MODE_SPI)
	{
		digitalWrite(dcPin, LOW);;	// DC pin LOW for a command
		spiTransfer(c);			// Transfer the command byte
	}
	else if (interface == MODE_I2C)
	{
		// Write to our address, make sure it knows we're sending a
		// command:
		i2cWrite(i2c_address, I2C_COMMAND, c);
	}
	else if (interface == MODE_PARALLEL)
	{
		// Write the byte to our parallel interface. Set DC LOW.
		parallelWrite(c, LOW);
	}
}
/** \brief Send the display a data byte

    Send a data byte via SPI, I2C or parallel to SSD1306 controller.
	For SPI we set the DC and CS pins here, and call spiTransfer(byte)
	to send the data. For I2C and Parallel we use the write functions
	defined in hardware.cpp to send the data.
*/
void MicroOLED::data(uint8_t c) {

	if (interface == MODE_SPI)
	{
		digitalWrite(dcPin, HIGH);	// DC HIGH for a data byte

		spiTransfer(c); 		// Transfer the data byte
	}
	else if (interface == MODE_I2C)
	{
		// Write to our address, make sure it knows we're sending a
		// data byte:
		i2cWrite(i2c_address, I2C_DATA, c);
	}
	else if (interface == MODE_PARALLEL)
	{
		// Write the byte to our parallel interface. Set DC HIGH.
		parallelWrite(c, HIGH);
	}
}
Example #3
0
/** \brief Send the display a command byte

    Send a command via SPI, I2C or parallel	to SSD1306 controller.
	For SPI we set the DC and CS pins here, and call spiTransfer(byte)
	to send the data. For I2C and Parallel we use the write functions
	defined in hardware.cpp to send the data.
*/
void MicroOLED::command(uint8_t c) {

	if (interface == MODE_SPI)
	{
		*dcport &= ~dcpinmask;	// DC pin LOW for a command
		*ssport &= ~sspinmask;	// SS LOW to initialize transfer
		spiTransfer(c);			// Transfer the command byte
		*ssport |= sspinmask;	// SS HIGH to end transfer
	}
	else if (interface == MODE_I2C)
	{
		// Write to our address, make sure it knows we're sending a
		// command:
		i2cWrite(i2c_address, I2C_COMMAND, c);
	}
	else if (interface == MODE_PARALLEL)
	{
		// Write the byte to our parallel interface. Set DC LOW.
		parallelWrite(c, LOW);
	}
}
Example #4
0
/** \brief Send the display a data byte

    Send a data byte via SPI, I2C or parallel to SSD1306 controller.
	For SPI we set the DC and CS pins here, and call spiTransfer(byte)
	to send the data. For I2C and Parallel we use the write functions
	defined in hardware.cpp to send the data.
*/
void MicroOLED::data(uint8_t c) {

	if (interface == MODE_SPI)
	{
		*dcport |= dcpinmask;	// DC HIGH for a data byte

		*ssport &= ~sspinmask;	// SS LOW to initialize SPI transfer
		spiTransfer(c); 		// Transfer the data byte
		*ssport |= sspinmask;	// SS HIGH to end SPI transfer
	}
	else if (interface == MODE_I2C)
	{
		// Write to our address, make sure it knows we're sending a
		// data byte:
		i2cWrite(i2c_address, I2C_DATA, c);
	}
	else if (interface == MODE_PARALLEL)
	{
		// Write the byte to our parallel interface. Set DC HIGH.
		parallelWrite(c, HIGH);
	}
}