Exemple #1
0
void lcdWrite(int writeMode, unsigned char data) {
	int i;
	unsigned char lowNibble;
	unsigned char highNibble;
	unsigned char myData[1];

	lowNibble = data & 0x0F;
	highNibble = data >> 4;


	if (writeMode == COMMAND){
		myData[0] = reverseByte(0x1F);
		wiringPiSPIDataRW(0,myData,1);
	}else{
		myData[0] = reverseByte(0x5F);
		wiringPiSPIDataRW(0,myData,1);
	}

	delay(1);
	
	myData[0] = reverseByte(lowNibble);
	wiringPiSPIDataRW(0,myData,1);

	delay(1);

	myData[0] = reverseByte(highNibble);
	wiringPiSPIDataRW(0,myData,1);
}
Exemple #2
0
void MarkProtocol::readData()
{
    if(m_port->openMode() != QSerialPort::WriteOnly) {
        if(m_port->bytesAvailable() > 0) {
#ifdef DEBUG0
            qDebug() << "MarkProtocol received:" << m_port->peek(1).toHex().toUpper();
            qDebug() << "MarkProtocol reversed:" << reverseByte(m_port->peek(1)).toHex().toUpper();
#endif
            m_packetsSplitter->addReadedBytes(reverseByte(m_port->read(1)));
        }
    }
}