void LCD_SendDAT8(u8 Data) { LCD_RS_DISABLE(); //data LCD_CS_ENABLE(); LCD_SPISendByte(Data); LCD_SPISendByte(0x00); LCD_CS_DISABLE(); }
void LCD_SendCMD(u8 Data) { LCD_RS_ENABLE(); //cmd LCD_CS_ENABLE(); LCD_SPISendByte(Data); LCD_SPISendByte(0x00); LCD_CS_DISABLE(); }
// Send a byte to LCD void LCD_SendByte(u8 DataType, u8 DataToSend) { LCD_ChipSelect(ENABLE); /* Enable access to LCD */ LCD_SPISendByte(DataType); /* Send Synchro/Mode byte */ LCD_SPISendByte((u8)(DataToSend & (u8)0xF0)); /* Send byte high nibble */ LCD_SPISendByte((u8)((u8)(DataToSend << 4) & (u8)0xF0)); /* Send byte low nibble */ LCD_ChipSelect(DISABLE); /* Disable access to LCD */ }
/** * @brief Send a byte to LCD * @param DataType Type of Data to be sent * @param DataToSend Data to be sent * @retval None */ void LCD_SendByte(uint8_t DataType, uint8_t DataToSend) { /* Enable access to LCD */ LCD_NCS_HIGH(); /* Send Synchro/Mode byte */ LCD_SPISendByte(DataType); /* Send byte high nibble */ LCD_SPISendByte((uint8_t)(DataToSend & (uint8_t)0xF0)); /* Send byte low nibble */ LCD_SPISendByte((uint8_t)((uint8_t)(DataToSend << 4) & (uint8_t)0xF0)); _delay_(80); /* Disable access to LCD */ LCD_NCS_LOW(); }
void LCD_SendDAT16(u16 Data) { LCD_RS_DISABLE(); //data LCD_CS_ENABLE(); LCD_SPISendByte(Data >> 8); LCD_SPISendByte(Data); LCD_CS_DISABLE(); }
// Send a buffer to LCD void LCD_SendBuffer(u8 *pTxBuffer, u8 *pRxBuffer, u8 NumByte) { LCD_ChipSelect(ENABLE); while (NumByte--) /* while there is data to be read */ { *pRxBuffer = LCD_SPISendByte(*pTxBuffer); pTxBuffer++; pRxBuffer++; } LCD_ChipSelect(DISABLE); }