#include "systick.h"
#include "string.h"
-
+static U8 *display = (U8 *)0;
void
nxt_lcd_command(U8 cmd)
nxt_lcd_command(0xEE | ((on) ? 1 : 0));
}
-
void
-nxt_lcd_data(const U8 *data)
+nxt_lcd_force_update()
{
+ // Update the screen the slow way. Works with interrupts disabled
int i;
+ U8 *disp = display;
for (i = 0; i < NXT_LCD_DEPTH; i++) {
nxt_lcd_set_col(0);
nxt_lcd_set_page_address(i);
- nxt_spi_write(1, data, NXT_LCD_WIDTH);
- data += NXT_LCD_WIDTH;
+ nxt_spi_write(1, disp, NXT_LCD_WIDTH);
+ disp += NXT_LCD_WIDTH;
}
}
+
+void
+nxt_lcd_update()
+{
+#define DMA_REFRESH
+#ifdef DMA_REFRESH
+ nxt_spi_refresh();
+#else
+ nxt_lcd_force_update();
+#endif
+}
+
void
nxt_lcd_power_up(void)
{
nxt_lcd_set_bias_ratio(3); // 1/9
nxt_lcd_set_pot(0x60); // ?? 9V??
- nxt_lcd_set_ram_address_control(0);
- nxt_lcd_set_map_control(0x02);
+ nxt_lcd_set_ram_address_control(1); // auto wrap
+ nxt_lcd_set_map_control(0x02); // mirror in y
+ nxt_spi_set_display(display);
nxt_lcd_enable(1);
}
void
-nxt_lcd_init(void)
+nxt_lcd_power_down(void)
{
+ nxt_lcd_reset();
+}
+void
+nxt_lcd_init(const U8 *disp)
+{
+ display = disp;
nxt_spi_init();
nxt_lcd_power_up();