void buffer_window_print(string_buffer *buffer) { if(buffer->size == 0) { } else if(buffer->size == 1) { lcd_erase( ); puts(buffer->row0_current); write_command_lcd(0x0e); write_command_lcd(0x87); if(!buffer->row_select) lcd_goto_xy(0, 7); else lcd_goto_xy(1, 7); } else { lcd_erase( ); puts(buffer->row0_current); write_command_lcd(0xc0); puts(buffer->row1_current); write_command_lcd(0x0e); write_command_lcd(0x87); if(!buffer->row_select) lcd_goto_xy(0, 7); else lcd_goto_xy(1, 7); } }
int main() { sei(); char *rotat_cnt_str; char *trans_cnt_str; uint16_t rotat_cnt = 0; uint16_t trans_cnt = 0; initialize_LCD_driver(); init_encoders(); clear_rotat_encoder_cnt(); //Read the current rotational encoder count while(rotat_cnt < ROTAT_MAX) { rotat_cnt = get_rotat_encoder_cnt(); } lcd_erase(); lcd_puts("RE_DONE"); clear_trans_encoder_cnt(); //Read the current translational encoder count while(trans_cnt < TRANS_MAX) { trans_cnt = get_trans_encoder_cnt(); } lcd_erase(); lcd_puts("TE_DONE"); stop_encoders(); return 0; }
bool password_check( ) { bool pw1; bool pw2; bool pw3; bool pw4; /////////////////// /* PASSWORD LOCK */ // BBAC // /////////////////// lcd_erase( ); puts("Enter password"); lcd_goto_xy(0, 7); while(1) { if( get_button_A_state() ) { pw1 = false; break; } if( get_button_B_state() ) { pw1 = true; break; } if( get_button_C_state() ) { pw1 = false; break; } } lcd_erase( ); lcd_goto_xy(0, 2); putc('*'); _delay_ms(250); while(1) { if( get_button_A_state() ) { pw2 = false; break; } if( get_button_B_state() ) { pw2 = true; break; } if( get_button_C_state() ) { pw2 = false; break; } } putc('*'); _delay_ms(250); while(1) { if( get_button_A_state() ) { pw3 = true; break; } if( get_button_B_state() ) { pw3 = false; break; } if( get_button_C_state() ) { pw3 = false; break; } } putc('*'); _delay_ms(250); while(1) { if( get_button_A_state() ) { pw4 = false; break; } if( get_button_B_state() ) { pw4 = false; break; } if( get_button_C_state() ) { pw4 = true; break; } } putc('*'); _delay_ms(250); if(pw1 && pw2 && pw3 && pw4) { _delay_ms(250); lcd_erase( ); puts("SUCCESS!"); lcd_goto_xy(1, 7); return true; } else { _delay_ms(250); lcd_erase( ); puts("FAILURE RESET"); lcd_goto_xy(0, 7); return false; } }