Ejemplo n.º 1
0
//************************************************************************************++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void TFT_FillBitmap(int XL, int XR, int YU, int YD, unsigned short *Bitmap)
{
	unsigned long  XY=0;
	unsigned long i=0;
	XY = (XR-XL+1);
	XY = XY*(YD-YU+1);

	TFT_SetCol(XL,XR);
	TFT_SetPage(YU, YD);
	TFT_SendCMD(0x2c);                     /* start to write to display ra */

	D_C_Write(1);	// Specify data coming by DMA

	HW_TFT(REG_TFT_FRAMEBUFFER)=Bitmap;
	HW_TFT(REG_TFT_FRAMESIZE)=XY;

#if 0
	for(i=0; i < XY; i++)
	{										 //color[i] =( ~color[i+1]);	
	int Hcolor = (~Bitmap[i])>>8;
	int Lcolor = (~Bitmap[i])&0xff;	
		SPIM_WriteTxData(Hcolor);
		SPIM_WriteTxData(Lcolor);
	}
#endif

}
Ejemplo n.º 2
0
void EEPROM_send_byte(uint8_t data) {
    // Add byte to TX buffer
    SPIM_WriteTxData(data);

    // Wait to be sent from buffer
    while(!(SPIM_ReadStatus() & SPIM_STS_TX_FIFO_EMPTY));
}
Ejemplo n.º 3
0
int main()
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    
    Clock_Start();
    SPIM_Start();
    
    setup_matrix();

    for(;;)
    {
        for(h=0;h<=256;h++)
        {
            for(i=0;i<8;i++)
            {
                dato=(((i+1)<<8)+fuente[h][i]);
                SPIM_WriteTxData(dato);
                CyDelay(1);
            }
            CyDelay(1000);
        }
                
        
    }
}
Ejemplo n.º 4
0
/*******************************************************************************
* Function Name: SPIM_PutArray
********************************************************************************                       
*
* Summary:
*  Write available data from ROM/RAM to the TX buffer while space is available 
*  in the TX buffer. Keep trying until all data is passed to the TX buffer.
*
* Parameters:
*  *buffer: Pointer to the location in RAM containing the data to send
*  byteCount: The number of bytes to move to the transmit buffer.
*
* Return:
*  None.
*
* Side Effects:
*  Will stay in this routine until all data has been sent.  May get locked in
*  this loop if data is not being initiated by the master if there is not
*  enough room in the TX FIFO.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void SPIM_PutArray(uint8 *buffer, uint8 byteCount)
{
    while(byteCount > 0u)
    {
        SPIM_WriteTxData(*buffer++);
        byteCount--;
    }
}
Ejemplo n.º 5
0
/*******************************************************************************
* Function Name: SPIM_PutArray
********************************************************************************
*
* Summary:
*  Write available data from ROM/RAM to the TX buffer while space is available
*  in the TX buffer. Keep trying until all data is passed to the TX buffer.
*
* Parameters:
*  *buffer: Pointer to the location in RAM containing the data to send
*  byteCount: The number of bytes to move to the transmit buffer.
*
* Return:
*  None.
*
* Side Effects:
*  Will stay in this routine until all data has been sent.  May get locked in
*  this loop if data is not being initiated by the master if there is not
*  enough room in the TX FIFO.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void SPIM_PutArray(const uint8 buffer[], uint8 byteCount)
                                                                          
{
    uint8 bufIndex;

    bufIndex = 0u;

    while(byteCount > 0u)
    {
        SPIM_WriteTxData(buffer[bufIndex]);
        bufIndex++;
        byteCount--;
    }
}
Ejemplo n.º 6
0
// Transmit Data only, no Start/Stop condition
int CySPITxData(DEVINTRF *pDev, uint8_t *pData, int DataLen)
{
	CY_SPIDEV *dev = (CY_SPIDEV *)pDev-> pDevData;
	int cnt = 0;

	while (DataLen > 0)
	{
        SPIM_WriteTxData(*pData);
		DataLen--;
		pData++;
		cnt++;
	}

	return cnt;
}
Ejemplo n.º 7
0
//*************************************************************************************
__inline void TFT_WriteData(int Data)
{ D_C_Write(1); SPIM_WriteTxData(Data);} // CyDelayUs(1);}
Ejemplo n.º 8
0
//*************************************************************************************
__inline void TFT_SendCMD(int cmd)
{ D_C_Write(0);   SPIM_WriteTxData(cmd); CyDelayUs(1);}
Ejemplo n.º 9
0
void setup_matrix()
{
    SPIM_WriteTxData(0x0B07);//Display 8 digits
    CyDelay(1);
    SPIM_WriteTxData(0x0900);//using a matrix
    CyDelay(1);
    SPIM_WriteTxData(0x0F00);//No display test
    CyDelay(1);
    SPIM_WriteTxData(0x0C01);//No shutdown
    CyDelay(1);
    SPIM_WriteTxData(0x0A01);//light intensity - up to 15
    CyDelay(1);
    
    SPIM_WriteTxData(0x0100);//Clean column 1
    CyDelay(1);
    SPIM_WriteTxData(0x0200);//Limpiar columna 2
    CyDelay(1);
    SPIM_WriteTxData(0x0300);//Limpiar columna 3
    CyDelay(1);
    SPIM_WriteTxData(0x0400);//Limpiar columna 4
    CyDelay(1);
    SPIM_WriteTxData(0x0500);//Limpiar columna 5
    CyDelay(1);    
    SPIM_WriteTxData(0x0600);//Limpiar columna 6
    CyDelay(1);
    SPIM_WriteTxData(0x0700);//Limpiar columna 7
    CyDelay(1);
    SPIM_WriteTxData(0x0800);//Limpiar columna 8
    CyDelay(1);
    
    
}