From b6d9822e52f2e9f57f61e95ef6b215ef5cf4fc15 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Fri, 2 Jun 2017 13:32:32 +0200 Subject: [PATCH] Pt100: introduce compile time macro flag WITH_LCD --- pt100/main.c | 20 +++++++++++++++++--- pt100/main.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pt100/main.c b/pt100/main.c index 75d614a..7fa89f7 100644 --- a/pt100/main.c +++ b/pt100/main.c @@ -1,8 +1,11 @@ /* main.c */ #include "main.h" + +#if WITH_LCD == 1 #include "lcdlib/lcd-color-graphic.h" #include "lcdlib/font.h" +#endif volatile uint16_t control_reg; volatile uint16_t time; @@ -16,13 +19,16 @@ int32_t temperature[17][9]; uint8_t invalid[8]; uint8_t make_update_lcd; +#if WITH_LCD == 1 color_t col_background; color_t col_font; color_t col_title; color_t col_neg; +#endif struct calib_t calib_settings; +#if WITH_LCD == 1 /****************** * Init USART for LCD *****************/ @@ -33,6 +39,7 @@ void init_spi_lcd(void) { UBRR1H = 0; //full speed UDR1 = LCD_NOP; } +#endif /****************** * Read calibration from eeprom @@ -49,6 +56,7 @@ void read_calib() { time = 0; } +#if WITH_LCD == 1 /****************** * Some stuff on the LCD *****************/ @@ -101,7 +109,7 @@ void lcd_update(void) { LED2_OFF(); } - + #endif /****************** * Init all functions @@ -151,14 +159,16 @@ void init(void) { OCR1A = 31250; +#if WITH_LCD == 1 LED1_ON(); lcd_init(); LED1_OFF(); LED2_ON(); lcd_command_1(LCD_MIRROR, LCD_BGR | LCD_FLIP_XY); lcd_command(LCD_ON); - LED2_OFF(); +#endif + read_calib(); sei(); } @@ -189,12 +199,15 @@ ISR(TIMER1_COMPA_vect) { int main(void) { _delay_ms(100); init(); +#if WITH_LCD == 1 lcd_design(); +#endif while(1) { while(next_step==0); next_step = 0; if (measurement_active) {do_measurement_step();} - + +#if WITH_LCD == 1 if(make_update_lcd) { if(calib_settings.uselcd) lcd_update(); @@ -202,6 +215,7 @@ int main(void) { } if(key_was_pressed(1<