Main.c
1 | #define F_CPU 14745600UL
| 2 | #include "Main.h"
| 3 |
| 4 | uint16_t temperatur = 0;
| 5 | float celsius = 0;
| 6 |
| 7 | uint8_t error = 0;
| 8 |
| 9 | //Unsere Main
| 10 | int main(void) {
| 11 |
| 12 | init_spi_lcd(); // SPI Init
| 13 |
| 14 | TSIC_INIT(); // Init TSIC Temperatursensor
| 15 |
| 16 | //DOGL Display
| 17 | lcd_init();
| 18 | lcd_set_font(FONT_PROP_8, 0);
| 19 |
| 20 | while (1) {
| 21 |
| 22 | BACKLIGHT_ON();
| 23 |
| 24 | error = getTSicTemp(&temperatur); //turn the TSIC-Sensor ON -> messure -> OFF
| 25 | if (error == 1) {
| 26 | lcd_moveto_xy(0, 0);
| 27 | lcd_put_string(FONT_PROP_8, 0, "Temperatur: ");
| 28 | celsius = ((float) temperatur * 200 / 2048) - 50;// conversion equation from TSic's data sheet
| 29 |
| 30 | lcd_put_float(celsius);
| 31 | lcd_moveto_xy(7, 0);
| 32 | lcd_put_string(FONT_PROP_8, 0, "UINT: ");
| 33 | lcd_put_long(temperatur);
| 34 | }
| 35 |
| 36 | lcd_moveto_xy(1, 0);
| 37 | lcd_put_string(FONT_PROP_8, 0, "Error: ");
| 38 | lcd_put_long(error);
| 39 |
| 40 | _delay_ms(200);
| 41 |
| 42 | }
| 43 | }
|
|