Exemplo n.º 1
0
// Analog SPI
void AspiCmd(u8 Command_Byte)
{
    int i=8; 
    LCD_A0_LOW();

    LCD_CLK_HIGH();
    LCD_CLK_HIGH();
    LCD_NCS_LOW();
 
    while (i--) {
      LCD_CLK_LOW();

      if (Command_Byte&0x80)
        LCD_MOSI_HIGH();
      else
        LCD_MOSI_LOW();

      Command_Byte <<= 1;
      LCD_CLK_LOW(); \
      LCD_CLK_LOW(); \

      LCD_CLK_HIGH();
      LCD_CLK_HIGH();
    }

    LCD_NCS_HIGH();  
    LCD_A0_HIGH();
}
Exemplo n.º 2
0
/***************************************************************************************************
 * @fn      lcd_cmd_write
 *
 * @brief   LCD命令写入
 * @param   NULL
 * @return  0 -- success
 ***************************************************************************************************/  
int lcd_cmd_write(uint8_t cmd)
{
	LCD_A0_LOW();
	LCD_NCS_LOW()
	while ( ( LCD_SPI_MASTER->SR & SPI_SR_TXE ) == 0 ) 
	{};
  	(void)LCD_SPI_MASTER->DR ;		// Clear receive
  	LCD_SPI_MASTER->DR = cmd ;
  	while ( ( LCD_SPI_MASTER->SR & SPI_SR_RXNE ) == 0 ) 
	{};
	LCD_NCS_HIGH();

	return 0;
}
Exemplo n.º 3
0
void AspiCmd(uint8_t Command_Byte)
{
  LCD_A0_LOW() ;
  LCD_NCS_LOW() ;  
  while ( ( SPI3->SR & SPI_SR_TXE ) == 0 ) {
    // wait
  }
  (void)SPI3->DR ;		// Clear receive
  SPI3->DR = Command_Byte ;
  while ( ( SPI3->SR & SPI_SR_RXNE ) == 0 ) {
    // wait
  }
  LCD_NCS_HIGH() ;
}
Exemplo n.º 4
0
void AspiCmd(uint8_t Command_Byte)
{
    int i=8; 
    LCD_A0_LOW();

    LCD_CLK_HIGH();
    LCD_NCS_LOW();  
 
    while (i--) 
    { 
	    LCD_CLK_LOW(); 
	    if(Command_Byte&0x80)
	{
        LCD_MOSI_HIGH();
    }
	else LCD_MOSI_LOW();

	Command_Byte=Command_Byte<<1; 
	LCD_CLK_HIGH();  
    } 
    LCD_NCS_HIGH();  
    LCD_A0_HIGH();
}