Trammell Hudson avatar Trammell Hudson committed 6435a06 Draft

scrolling works, but painfully

Comments (0)

Files changed (2)

 
 	out(LCD_DI, di);
 	out(LCD_RW, !write_dir); // write
-	out(LCD_EN, 1);
 	if (write_dir)
 	{
+		out(LCD_EN, 1);
 		LCD_DATA_DDR = 0xFF;
 	} else {
 		LCD_DATA_DDR = 0x00; // inputs
 		LCD_DATA_PORT = 0x00; // no pull ups
+		out(LCD_EN, 1);
 	}
 
-	_delay_us(2);
-
 	if (write_dir)
 	{
+		_delay_us(2);
 		LCD_DATA_PORT = byte;
 	} else {
+		_delay_us(2);
 		rc = LCD_DATA_PIN;
 	}
 
 	_delay_us(2);
 	out(LCD_EN, 0);
 
-	if (!write_dir)
-		return rc;
-
 	// value has been sent, go into read mode
 	_delay_us(2);
 	LCD_DATA_PORT = 0x00; // no pull ups
 
 	out(LCD_EN, 1);
 	_delay_us(10);
-	rc = LCD_DATA_PIN;
+	if (write_dir)
+		rc = LCD_DATA_PIN;
 	out(LCD_EN, 0);
 
 	// Everything looks good.
 	uint8_t write_dir
 )
 {
+	uint8_t rc = 0;
+
 	out(pin, 1);
 	lcd_command((y >> 3) << 6 | x, 0, 1);
-	uint8_t rc = lcd_command(val, 1, write_dir);
+	lcd_command(val, 1, write_dir);
+	if (!write_dir)
+		rc = lcd_command(val, 1, 0); // get the data
 	out(pin, 0);
 
 	return rc;
 	uint8_t y
 )
 {
-	_lcd_select(x, y, 0, 0);
+	return _lcd_select(x, y, 0, 0);
 }
 
 	// We are scrolling.  Omg.  How do we do this.
 	cur_col = 0;
-	for (int i = 0 ; i < MAX_ROWS-1 ; i++)
+	for (int j = 0 ; j < 240 ; j++)
 	{
-		for (int j = 0 ; j < 240 ; j++)
+		for (int i = 0 ; i < MAX_ROWS-1 ; i++)
 		{
 			uint8_t bits = lcd_read(j, (i+1)*8);
 			lcd_display(j, i*8, bits);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.