void change_direction_LCD(int direction) { //RS Low GPIOPinWrite(port_C, GPIO_PIN_5, 0x0); //Next Display Line writeDataPins(1,1,0,0,0,0,0,0); writeDataPins(0,0,0,0,0,0,0,0); // GPIOPinWrite(port_C, GPIO_PIN_5, pin_5); // write_string(" "); if(current_direction == 1) { GPIOPinWrite(port_C, GPIO_PIN_5, pin_5); write_string("CWise "); } if(current_direction == -1) { GPIOPinWrite(port_C, GPIO_PIN_5, pin_5); write_string("CCWise "); } GPIOPinWrite(port_C, GPIO_PIN_5, 0x0); }
//Display Initialization void initializeDisplay() { //RS low GPIOPinWrite(port_C, GPIO_PIN_5, 0x0); //Function Set writeDataPins(0,0,1,1,1,0,0,0); //Clear the screen clear_screen(); //Display on/off control set_cursor(); //Entry mode set writeDataPins(0,0,0,0,0,1,1,0); }
//Clear the screen void clear_screen() { //Clear Display writeDataPins(0,0,0,0,0,0,0,1); }
void taco_display(void) { //Write to LCD if (flag == 1) { if(direction_change) { direction_change = 0; SysCtlDelay(160000); direction_change = 0; change_direction_LCD(direction); } if(speed_change && (current_rpm > 0.0)) { speed_change = 0; SysCtlDelay(160000); writeDataPins(1,0,0,0,1,0,0,0); sprintf(rpm, "%f", current_rpm); GPIOPinWrite(port_C, GPIO_PIN_5, pin_5); if(rpm[0] != '0'){ write_RPM(rpm); } } } GPIOPinWrite(port_C, GPIO_PIN_5, 0x0); flag = 0; }
void WPCLampMatrix::setColumn(byte column) { #ifdef _DEBUG_ Serial << "COL "; #endif writeDataPins(~(1 << column)); digitalWrite(colSelectPin, LOW); delayJustATad(); digitalWrite(colSelectPin, HIGH); delayJustATad(); }
void WPCLampMatrix::setColumn(byte column, byte values) { writeDataPins(-1); //turn off all columns digitalWrite(colSelectPin, LOW); delayJustATad(); digitalWrite(colSelectPin, HIGH); delayJustATad(); // write the row data writeDataPins(~values); digitalWrite(rowSelectPin, LOW); delayJustATad(); digitalWrite(rowSelectPin, HIGH); delayJustATad(); // turn the proper column on writeDataPins(~(1 << column)); digitalWrite(colSelectPin, LOW); delayJustATad(); digitalWrite(colSelectPin, HIGH); delayJustATad(); }
void WPCLampMatrix::setRows(byte values) { #ifdef _DEBUG_ Serial << " ROWs "; #endif writeDataPins(~values); digitalWrite(rowSelectPin, LOW); delayJustATad(); digitalWrite(rowSelectPin, HIGH); delayJustATad(); #ifdef _DEBUG_ Serial << endl; #endif }
//Convert a char and output into data pins void write_char_to_pins(char letter) { //Convert the letter into binary int char_index = (letter- 'A') + 65; int binary[8]; int i = 0; for(i = 0; i < 8; i ++) { binary[i] = char_index %2; char_index = char_index/2; } //Write corresponding data to the pins with respect to the letters writeDataPins(binary[7], binary[6], binary[5], binary[4], binary[3], binary[2], binary[1], binary[0]); }
void set_cursor() { //Display on/off control writeDataPins(0,0,0,0,1,1,1,0); }
//Write the phrases to the LCD void write_phrases() { while(1){ //GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, pin_data); if(flag_check == 1){ if(UP_FLAG) { UP_FLAG = 0; current_list_position += 1; } if(DOWN_FLAG) { DOWN_FLAG = 0; current_list_position -= 1; } flag_check = 0; clear_screen(); //Modulo for circular list, used to print the phrases in a circular fashion current_list_position += SIZE; current_list_position %= SIZE; int i, j, index; for(i = current_list_position; i < current_list_position + 2 ; i ++) { GPIOPinWrite(port_C, GPIO_PIN_5, pin_5); index = i % SIZE; for(j = 0; j < strlen(phrases[index]); j++) { write_char_to_pins(phrases[index][j]); } //RS Low GPIOPinWrite(port_C, GPIO_PIN_5, 0x0); //Next Display Line writeDataPins(1,1,0,0,0,0,0,0); } } ROM_SysCtlSleep(); } }
//Write the phrases to the LCD void write_phrases() { int flag_check = 1; while(1){ //Move List Up if(!GPIOPinRead(port_F, GPIO_PIN_2)) { current_list_position += 1; flag_check = 1; } //Move list down else if(!GPIOPinRead(port_F, GPIO_PIN_3)) { current_list_position -= 1; flag_check = 1; } if(flag_check == 1){ //RS High clear_screen(); //Modulo for circular list, used to print the phrases in a circular fashion current_list_position += SIZE; current_list_position %= SIZE; int i, j, index; for(i = current_list_position; i < current_list_position + 2 ; i ++) { GPIOPinWrite(port_A, GPIO_PIN_5, pin_5); index = i % SIZE; for(j = 0; j < strlen(phrases[index]); j++) { write_char_to_pins(phrases[index][j]); } //RS Low GPIOPinWrite(port_A, GPIO_PIN_5, 0x0); //Next Display Line writeDataPins(1,1,0,0,0,0,0,0); } flag_check = 0; } } }