Display: create infrastructure for distinct displays.

Dropped all the funtions for specific messages because plans on
how to handle this have changed.
This commit is contained in:
Markus Hitter 2016-04-25 00:22:38 +02:00
parent 9dd53a1722
commit cec45a2fec
6 changed files with 60 additions and 61 deletions

16
display.c Normal file
View File

@ -0,0 +1,16 @@
/** \file
\brief Display broker.
Here we map generic display calls to calls to the actually used display and
also define functions common to all displays.
*/
#include "display.h"
#define TEACUP_C_INCLUDE
#include "display_ssd1306.c"
#undef TEACUP_C_INCLUDE
/* No common code so far. */

39
display.h Normal file
View File

@ -0,0 +1,39 @@
/** \file
\brief Display broker.
Here we map generic display calls to calls to the actually used display.
*/
#ifndef _DISPLAY_H
#define _DISPLAY_H
#include <stdint.h>
#include "config_wrapper.h"
#include "displaybus.h"
#ifdef DISPLAY_BUS
#if defined DISPLAY_TYPE_SSD1306
#define DISPLAY_I2C_ADDRESS 0x78
#define DISPLAY_LINES 4
#define DISPLAY_SYMBOLS_PER_LINE 32
#define DISPLAY
#elif defined DISPLAY_TYPE_LCD1302
#error Display type LCD1302 not yet supported.
#endif /* DISPLAY_TYPE_... */
#endif /* DISPLAY_BUS */
void display_init(void);
void display_clear(void);
void display_text_P(uint8_t line, uint8_t column, PGM_P message_P);
#endif /* _DISPLAY_H */

View File

@ -4,9 +4,9 @@
\brief Code specific to the SSD1306 display.
*/
#include "display_ssd1306.h"
#include "display.h"
#ifdef DISPLAY_TYPE_SSD1306
#if defined TEACUP_C_INCLUDE && defined DISPLAY_TYPE_SSD1306
#include "displaybus.h"
#include "font.h"
@ -115,4 +115,4 @@ void display_text_P(uint8_t line, uint8_t column, PGM_P message) {
displaybus_write(0x00, 1);
}
#endif /* DISPLAY_TYPE_SSD1306 */
#endif /* TEACUP_C_INCLUDE && DISPLAY_TYPE_SSD1306 */

View File

@ -1,56 +0,0 @@
#ifndef _DISPLAY_SSD1306_H
#define _DISPLAY_SSD1306_H
#include "config_wrapper.h"
#ifdef DISPLAY_TYPE_SSD1306
#define DISPLAY
#define DISPLAY_I2C_ADDRESS (0x3C << 1)
#define DISPLAY_LINES 4
#define DISPLAY_SYMBOLS_PER_LINE 16
#define HOTENDS_COUNT 1
#define HOTBED_ZONES 1
#define DISPLAY_PLACE_HOTEND 0, 0, 8
#define DISPLAY_PLACE_HOTBED 0, 8, 8
#define DISPLAY_PLACE_X 1, 0, 5
#define DISPLAY_PLACE_Y 1, 5, 5
#define DISPLAY_PLACE_Z 1, 10, 5
#define DISPLAY_PLACE_FEEDRATE 2, 0, 5
#define DISPLAY_PLACE_PROGRESS 2, 5, 5
#define DISPLAY_PLACE_TIMER 2, 10, 6
#define DISPLAY_PLACE_STATUS 3, 0, 16
typedef struct {
uint16_t hotend_temp[HOTENDS_COUNT];
uint16_t hotbed_temp[HOTBED_ZONES];
uint16_t x;
uint16_t y;
uint16_t z;
uint16_t feedrate;
uint8_t progress; // in percents
uint32_t timer; // in seconds
} DISPLAY_T;
void display_init(void);
void display_on(void);
void display_hotend(uint8_t index);
void display_hotbed(uint8_t index);
void display_point(uint16_t x, uint16_t y, uint16_t z);
void display_feedrate(uint16_t value);
void display_progress(uint8_t value);
void display_timer(uint32_t value);
void display_off(void);
void display_clear(void);
void display_text_P(uint8_t line, uint8_t column, PGM_P message_P);
#endif /* DISPLAY_TYPE_SSD1306 */
#endif /* _DISPLAY_SSD1306_H */

View File

@ -15,7 +15,7 @@
#include <string.h>
#include "config_wrapper.h"
#include "display_ssd1306.h"
#include "display.h"
#include "font.h"

View File

@ -52,7 +52,7 @@
#include "intercom.h"
#include "spi.h"
#include "sd.h"
#include "display_ssd1306.h"
#include "display.h"
#include "simulator.h"
#ifdef SIMINFO