/*********************************************************************
* 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;
}
예제 #3
0
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);
}
예제 #6
0
/*********************************************************************
* 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
}
예제 #7
0
void WriteData(unsigned int _data)
{
  DisplayEnable();
  DisplaySetData();
  PMDIN = _data;
  PMPWaitBusy();
  DisplayDisable();
}
예제 #8
0
void WriteCommand(int cmd)
{
  DisplayEnable();
  DisplaySetCommand();
  PMDIN = cmd;
  PMPWaitBusy();
  DisplayDisable();
}
예제 #9
0
/*
#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;
}
예제 #10
0
 void DeviceWrite(BYTE data)
{


	PMDIN1=data;

	PMPWaitBusy();

}
예제 #11
0
lldHx8347Write(UINT16 pData)
{
    PMDIN1 = pData;
    PMPWaitBusy();
}
예제 #12
0
void Write_Data(unsigned int _data) {
  TFT_RS = 1;
  PMDIN = _data;
  PMPWaitBusy();
}
예제 #13
0
void Write_Command( unsigned short cmd ) {
  TFT_RS = 1;
  PMDIN = cmd;
  PMPWaitBusy();
}
예제 #14
0
void Set_Index(unsigned short index) {
  TFT_RS = 0;
  PMDIN = index;
  PMPWaitBusy();
}
예제 #15
0
lldFpgaGpuWrite(UINT16 pData)
{
    PMDIN1 = pData;
    PMPWaitBusy();
}
예제 #16
0
inline BYTE SingleDeviceRead(){
BYTE value;
	value = PMDIN1;
	PMPWaitBusy();
	return value;
}
예제 #17
0
inline void DeviceWrite(WORD data) 
{ 
	PMDIN1 = data;
	PMPWaitBusy();
}