void LCD_PulseEnable ( void ) { GPIO->P[COM_PORT].DOUTSET = 1 << LCD_EN ;//LCD_EN = 1; usdelay(220); // was 10 GPIO->P[COM_PORT].DOUTCLR = 1 << LCD_EN ;//LCD_EN =0; usdelay(220); }
static inline void enc_reset(void) { enc_select(); spi_put( ENC_SPI_OP_SC ); enc_deselect(); // errata #2: wait for at least 300 us usdelay( 1000 ); }
void spi_init(void) { // configure pins MOSI, SCK as output SPI_DDR |= (1<<SPI_MOSI) | (1<<SPI_SCK); // pull SCK high SPI_PORT |= (1<<SPI_SCK); // configure pin MISO as input SPI_DDR &= ~(1<<SPI_MISO); SPI_DDR |= (1<<SPI_SS); //SPI: enable, master, positive clock phase, msb first, SPI speed fosc/2 SPCR = (1<<SPE) | (1<<MSTR); SPSR = (1<<SPI2X); usdelay(10000); }