/********************************************************************* * Function: WORD GetPixel(SHORT x, SHORT y) * * PreCondition: none * * Input: x,y - pixel coordinates * * Output: pixel color * * Side Effects: none * * Overview: returns pixel color at x,y position * * Note: none * ********************************************************************/ WORD GetPixel(SHORT x, SHORT y) { DWORD address; WORD value; address = (long)(GetMaxX() + 1) * y + x; SetAddress(address); CS_LAT_BIT = 0; // enable SSD1906 #ifdef __PIC32MX A17_LAT_BIT = 0; // set address[17] if(((DWORD_VAL) _address).w[1] & 0x0001) A17_LAT_BIT = 1; PMADDR = ((DWORD_VAL) _address).w[0]; // set address[16:1] A0_LAT_BIT = 1; // set address[0] ((WORD_VAL) value).v[0] = PMDIN; // start transmission, read dummy value PMPWaitBusy(); // wait for the transmission end A0_LAT_BIT = 0; // set address[0] ((WORD_VAL) value).v[0] = PMDIN; // start transmission, read low byte #else value = PMDIN1; // start transmission, read dummy value #endif PMPWaitBusy(); // wait for the transmission end CS_LAT_BIT = 1; // disable SSD1906 PMCONbits.PMPEN = 0; // suspend PMP #ifdef __PIC32MX ((WORD_VAL) value).v[0] = PMDIN; // read high byte #else value = PMDIN1; // read value #endif PMCONbits.PMPEN = 1; // resume PMP return (value); }
inline WORD DeviceRead() { WORD value; value = PMDIN1; PMPWaitBusy(); PMCONbits.PMPEN = 0; // disable PMP value = PMDIN1; PMPWaitBusy(); PMCONbits.PMPEN = 1; // enable PMP return value; }
lldHx8347Read() { WORD value; lldHx8347SetData(); value = PMDIN1; PMPWaitBusy(); //PMCONbits.PMPEN = 0; // disable PMP value = PMDIN1; PMPWaitBusy(); //PMCONbits.PMPEN = 1; // enable PMP return value; }
/********************************************************************* * Function: void WriteData(WORD value) * * PreCondition: none * * Input: value - value to be written * * Output: none * * Side Effects: none * * Overview: writes 16-bit word into video buffer at current address. * The address pointer is incremented after the operation. * * Note: none * ********************************************************************/ void WriteData(WORD value) { RS_LAT_BIT = 1; // set RS line to low for register space access A17_LAT_BIT = 0; // set address[17] if(((DWORD_VAL) _address).w[1] & 0x0001) A17_LAT_BIT = 1; PMADDR = ((DWORD_VAL) _address).w[0]; // set address[16:1] A0_LAT_BIT = 1; // set address[0] PMDIN1 = ((WORD_VAL) value).v[0]; // write low byte _address++; PMPWaitBusy(); // wait for the transmission end A0_LAT_BIT = 0; // set address[0] PMDIN1 = ((WORD_VAL) value).v[1]; // write high byte PMPWaitBusy(); // wait for the transmission end }
/********************************************************************* * Function: BYTE GetReg(WORD index) * * PreCondition: none * * Input: index - register number * * Output: none * * Side Effects: none * * Overview: returns graphics controller register value (byte access) * * Note: none * ********************************************************************/ BYTE GetReg(WORD index) { BYTE value; #ifndef __PIC32MX PMMODEbits.MODE16 = 0; // turn off 16 bit data mode PMCONbits.PTBEEN = 0; // disable BE line for 16-bit access #endif RS_LAT_BIT = 0; // set RS line to low for register space access CS_LAT_BIT = 0; // enable SSD1906 A17_LAT_BIT = 0; // set address[17] PMADDR = index >> 1; // set address[16:1] A0_LAT_BIT = index & 0x0001; // set address[0] value = PMDIN1; // start transmission, read dummy value PMPWaitBusy(); // wait for the transmission end CS_LAT_BIT = 1; // disable SSD1906 PMCONbits.PMPEN = 0; // suspend PMP value = PMDIN1; // read value PMCONbits.PMPEN = 1; // resume PMP #ifndef __PIC32MX PMCONbits.PTBEEN = 1; // enable BE line for 16-bit access PMMODEbits.MODE16 = 1; // restore 16 bit data mode #endif return (value); }
/********************************************************************* * Function: void SetReg(WORD index, BYTE value) * * PreCondition: none * * Input: index - register number * value - value to be set * * Output: none * * Side Effects: none * * Overview: sets graphics controller register (byte access) * * Note: none * ********************************************************************/ void SetReg(WORD index, BYTE value){ #ifndef __PIC32MX PMMODEbits.MODE16 = 0; // turn off 16 bit data mode PMCONbits.PTBEEN = 0; // disable BE line for 16-bit access #endif RS_LAT_BIT = 0; // set RS line to low for register space access CS_LAT_BIT = 0; // enable SSD1906 A17_LAT_BIT = 0; // set address[17] PMADDR = index>>1; // set address[16:1] A0_LAT_BIT = index&0x0001; // set address[0] PMDIN1 = value; // write value PMPWaitBusy(); // wait for the transmission end CS_LAT_BIT = 1; // disable SSD1906 #ifndef __PIC32MX PMCONbits.PTBEEN = 1; // enable BE line for 16-bit access PMMODEbits.MODE16 = 1; // restore 16 bit data mode #endif }
void WriteData(unsigned int _data) { DisplayEnable(); DisplaySetData(); PMDIN = _data; PMPWaitBusy(); DisplayDisable(); }
void WriteCommand(int cmd) { DisplayEnable(); DisplaySetCommand(); PMDIN = cmd; PMPWaitBusy(); DisplayDisable(); }
/* #ifdef USE_16BIT_PMP inline WORD DeviceRead() { WORD value; value = pmp_data; PMPWaitBusy(); return PMDIN1; } #else inline BYTE DeviceRead(){ BYTE value; value = pmp_data; PMPWaitBusy(); return PMDIN1; } #endif */ BYTE DeviceRead(){ BYTE value; value = PMDIN1; PMPWaitBusy(); PMCONbits.PMPEN = 0; // disable PMP value = PMDIN1; PMCONbits.PMPEN = 1; // enable PMP return value; }
void DeviceWrite(BYTE data) { PMDIN1=data; PMPWaitBusy(); }
lldHx8347Write(UINT16 pData) { PMDIN1 = pData; PMPWaitBusy(); }
void Write_Data(unsigned int _data) { TFT_RS = 1; PMDIN = _data; PMPWaitBusy(); }
void Write_Command( unsigned short cmd ) { TFT_RS = 1; PMDIN = cmd; PMPWaitBusy(); }
void Set_Index(unsigned short index) { TFT_RS = 0; PMDIN = index; PMPWaitBusy(); }
lldFpgaGpuWrite(UINT16 pData) { PMDIN1 = pData; PMPWaitBusy(); }
inline BYTE SingleDeviceRead(){ BYTE value; value = PMDIN1; PMPWaitBusy(); return value; }
inline void DeviceWrite(WORD data) { PMDIN1 = data; PMPWaitBusy(); }