Display: finally get rid of i2c_test.c.
Not without dubbing its remaining functionality in form of a display_greeting(), of course.
This commit is contained in:
parent
92a303c607
commit
12dc74fe62
|
|
@ -39,6 +39,7 @@ void display_init(void);
|
|||
void display_tick(void);
|
||||
void display_clear(void);
|
||||
|
||||
void display_greeting(void);
|
||||
void display_clock(void);
|
||||
void display_set_cursor(uint8_t line, uint8_t column);
|
||||
void display_writechar(uint8_t data);
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@
|
|||
logo, like "Welcome to Teacup" as a greeting screen, like writing numbers
|
||||
to readable places and so on.
|
||||
|
||||
- Get rid of i2c_test.c.
|
||||
|
||||
- Allow different fonts. Already paraphrased in font.h and font.c. Needs
|
||||
a selection menu in Configtool, of course, the same way one can select
|
||||
display types.
|
||||
|
|
@ -84,6 +82,7 @@
|
|||
#include "displaybus.h"
|
||||
#include "font.h"
|
||||
#include "sendf.h"
|
||||
#include "delay.h"
|
||||
#include "dda.h"
|
||||
|
||||
|
||||
|
|
@ -176,6 +175,30 @@ void display_set_cursor(uint8_t line, uint8_t column) {
|
|||
displaybus_write(0x10 | ((column >> 4) & 0x0F), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
Show a nice greeting. Pure eye candy.
|
||||
*/
|
||||
void display_greeting(void) {
|
||||
|
||||
display_clear();
|
||||
|
||||
/**
|
||||
"Welcome to Teacup" is 64 pixel columns wide, entire display is
|
||||
128 columns, so we offset by 32 columns to get it to the center.
|
||||
*/
|
||||
display_set_cursor(1, 32);
|
||||
|
||||
display_writestr_P(PSTR("Welcome to Teacup"));
|
||||
|
||||
// Forward this to the display immediately.
|
||||
while (buf_canread(display)) {
|
||||
display_tick();
|
||||
}
|
||||
|
||||
// Allow the user to worship our work for a moment :-)
|
||||
delay_ms(5000);
|
||||
}
|
||||
|
||||
/**
|
||||
Regular update of the display. Typically called once a second from clock.c.
|
||||
*/
|
||||
|
|
|
|||
32
i2c_test.c
32
i2c_test.c
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
/**
|
||||
Quick test for sending some visible data to a SSD1306 display connected
|
||||
via I2C. This means not to test the display, but the I2C implementation.
|
||||
|
||||
To run this test, add this line to board or printer config.h:
|
||||
|
||||
#define I2C
|
||||
|
||||
With this done, a welcome message should appear on the display. Without
|
||||
these additions, the binary size should be as small as the commit before.
|
||||
*/
|
||||
|
||||
#ifdef I2C_TEST
|
||||
|
||||
#include <string.h>
|
||||
#include "config_wrapper.h"
|
||||
#include "display.h"
|
||||
#include "font.h"
|
||||
#include "sendf.h"
|
||||
|
||||
|
||||
static void i2c_test(void) {
|
||||
/**
|
||||
"Welcome to Teacup" is 64 pixel columns wide, entire display is
|
||||
128 columns, so we offset by 32 columns to get it to the center.
|
||||
*/
|
||||
display_set_cursor(1, 32);
|
||||
sendf_P(display_writechar, PSTR("Welcome to Teacup"));
|
||||
}
|
||||
|
||||
#endif /* I2C_TEST */
|
||||
10
mendel.c
10
mendel.c
|
|
@ -30,13 +30,6 @@
|
|||
#endif
|
||||
|
||||
#include "config_wrapper.h"
|
||||
#ifdef I2C
|
||||
// This is temporary, until display code is completed.
|
||||
// It includes static i2c_test(), which is called in init():
|
||||
#define I2C_TEST
|
||||
#include "i2c_test.c"
|
||||
#undef I2C_TEST
|
||||
#endif
|
||||
#include "cpu.h"
|
||||
#include "serial.h"
|
||||
#include "dda_queue.h"
|
||||
|
|
@ -125,8 +118,7 @@ void init(void) {
|
|||
|
||||
#ifdef DISPLAY
|
||||
display_init();
|
||||
display_clear();
|
||||
i2c_test();
|
||||
display_greeting();
|
||||
#endif
|
||||
|
||||
// say hi to host
|
||||
|
|
|
|||
Loading…
Reference in New Issue