/******************************************************************************* * Transfer 1 byte over the serial communication * * Parameter: byte: byte to be sent * * mode: OUT = transmit byte, IN = receive byte * * Return: byte read while sending * *******************************************************************************/ static unsigned char spi_tran_man (unsigned char byte, unsigned int mode) { unsigned char val = 0; int i; if (mode == OUT) { DAT_MODE (OUT); } else { DAT_MODE (IN); } for (i = 7; i >= 0; i--) { LCD_CLK(0); delay(1); if (mode == OUT) { LCD_DAT((byte & (1 << i)) != 0); } else { val |= (BUS_VAL() << i); } LCD_CLK(1); delay(1); } return (val); }
void LCD_enviar_msg(char *msg) { while(*msg) LCD_DAT(*msg++); }
void LCD_enviar_msg(unsigned char *msg) { while(*msg) LCD_DAT(*msg++); }
void LcdDat(u8 cmd) { LCD_DAT(); LCD_CS_L(); spi_xfer(SPI1, cmd); LCD_CS_H(); }