/** * \brief Initialize ST7565R controller and LCD display. * It will also write the graphic controller RAM to all zeroes. * * \note This function will clear the contents of the display. */ void gfx_mono_st7565r_init(void) { uint8_t page; uint8_t column; #ifdef CONFIG_ST7565R_FRAMEBUFFER gfx_mono_set_framebuffer(framebuffer); #endif /* Initialize the low-level display controller. */ st7565r_init(); /* Set display to output data from line 0 */ st7565r_set_display_start_line_address(0); /* Clear the contents of the display. * If using a framebuffer (SPI interface) it will both clear the * controller memory and the framebuffer. */ for (page = 0; page < GFX_MONO_LCD_PAGES; page++) { for (column = 0; column < GFX_MONO_LCD_WIDTH; column++) { gfx_mono_put_byte(page, column, 0x00); } } }
void status_init(){ st7565r_init(&PORT_LCD_DATA, PIN_LCD_DATA, &PORT_LCD_CLOCK, PIN_LCD_CLOCK, &PORT_LCD_A0, PIN_LCD_A0, &PORT_LCD_RESET, PIN_LCD_RESET); }
int main(void) { //! the page address to write to uint8_t page_address; //! the column address, or the X pixel. uint8_t column_address; //! store the LCD controller start draw line uint8_t start_line_address = 0; board_init(); sysclk_init(); // initialize the interface (SPI), ST7565R LCD controller and LCD st7565r_init(); // set addresses at beginning of display st7565r_set_page_address(0); st7565r_set_column_address(0); // fill display with lines for (page_address = 0; page_address <= 4; page_address++) { st7565r_set_page_address(page_address); for (column_address = 0; column_address < 128; column_address++) { st7565r_set_column_address(column_address); /* fill every other pixel in the display. This will produce horizontal lines on the display. */ st7565r_write_data(0xAA); } } // scroll the display using hardware support in the LCD controller while (true) { st7565r_set_display_start_line_address(start_line_address++); delay_ms(250); } }
int main (void){ //Do setup here // _delay_ms(500); st7565r_init(&PORTA, PINA3, &PORTA, PINA2, &PORTA, PINA1, &PORTA, PINA0); // _delay_ms(500); // glcd_draw_line(0, 0, 128, 32, OVERLAY_OR); // glcd_draw_line(0, 32, 128, 0, OVERLAY_OR); // glcd_draw_rectangle(10, 10, 20, 20, DRAW_UNFILLED, OVERLAY_OR); // glcd_draw_rectangle(100, 5, 110, 30, DRAW_FILLED, OVERLAY_XOR); // glcd_draw_rectangle(40, 12, 70, 25, DRAW_FILLED, OVERLAY_NAND); // glcd_draw_text(1, 1, " ABCDEFGHIJKLMN", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, font_tiny, codepage_tiny, OVERLAY_OR); // glcd_draw_text(1, 15, "OPQRSTUVWXYZ,.!?", FONT_SMALL_WIDTH, FONT_SMALL_HEIGHT, font_small, codepage_small, OVERLAY_OR); // glcd_draw_text(1, 1, " ABCDEFGHIJKLMN", FONT_MEDIUM_WIDTH, FONT_MEDIUM_HEIGHT, font_medium, codepage_medium, OVERLAY_OR); // glcd_draw_text(1, 15, "OPQRSTUVWXYZ,.!?", FONT_LARGE_WIDTH, FONT_LARGE_HEIGHT, font_large, codepage_large, OVERLAY_OR); // glcd_draw_text(1, 10, "0123456789", FONT_LARGE_WIDTH, FONT_LARGE_HEIGHT, font_large, codepage_large, OVERLAY_OR); // glcd_draw_text(1, 10, "0123", FONT_XLARGE_WIDTH, FONT_XLARGE_HEIGHT, font_xlarge, codepage_xlarge, OVERLAY_OR); // glcd_draw_rectangle(0, 9, 128, 15, 1, OVERLAY_XOR); // glcd_draw_bitmap(100, 15, 5, 9, battery_0, OVERLAY_OR); //Entire buffer is filled glcd_draw_rectangle(0, 0, 127, 31, DRAW_FILLED, OVERLAY_OR); //Draw only segment of buffer glcd_write_buffer_bounds(0, 3, 0, 9); // glcd_set_contrast(0x20); uint8_t counter = 7; //glcd_invert_display(); prog_uchar* battery = battery_6; while(1){ _delay_ms(500); /* counter--; if (counter == 0) battery = battery_0; if (counter == 1) battery = battery_1; if (counter == 2) battery = battery_2; if (counter == 3) battery = battery_3; if (counter == 4) battery = battery_4; if (counter == 5) battery = battery_5; if (counter == 6) battery = battery_6; glcd_draw_rectangle(98, 13, 106, 26, 1, OVERLAY_NAND); glcd_draw_bitmap(100, 15, 5, 9, battery, OVERLAY_OR); glcd_write_buffer(); if (counter == 0) { counter = 7; } */ } }