bool time_updated(void) { if ( newtime ) { current_time = ds1307_gettime(); current_date = ds1307_getdate(); newtime --; return 1; } return 0; }
/* Summarization of all Sensor Readouts + RTC */ void Get_Weather_Data() { if (issetup==0) ds1307_getdate(&time[0], &time[1], &time[2], &time[3], &time[4], &time[5]); if (my_state == DISP_TEMP) weather.temp = bmp085_gettemperature()-2.4; //Calibration if (my_state == DISP_PRESS) //problem with i2c Communication, if temperature and pressure are readout after each other => bljad { weather.pres = bmp085_getpressure(); weather.pres = (weather.pres/100000)+0.16; //Calibration } //weather.hum = Get_Hum(); weather.lux = Get_Light(); }
int main(void) { //itialisierung init(); //settime();//get time from user //setalarm(); //get date ds1307_getdate(&year, &month, &day, &hour, &minute, &second); _delay_ms(1000); _delay_ms(1000);//hier war ich ----------- _delay_ms(1000); while (1) { } while (1) { //Dauerablauf showtime(hour, minute); //Uhrzeit erhšhen testweise _delay_ms(1000); minute++; if (minute >= 60) { minute = 0; hour++; } if (hour >= 13) { hour = 1; } //ende Uhrzeit Testweise erhšhen } }
int main(void) { uint8_t year=0, month=0, day=0, hour=0, minute=0, second=0; char str[16]; uint8_t count = 0, men = 0; UCSRB = (1<<RXEN)|(1<<TXEN)|(1<<RXC); //odblokowanie przerwania z odbiorem na urat lcd_init(); USART_Init(MYUBRR); initI2C(); LCD_DISPLAY(LCDDISPLAY); LCD_CLEAR; LCD_LOCATE(0,0); lcd_puts("Hello!"); ds1307_setdate(91, 1, 14, 12, 00, 00); sei(); while(1) { ds1307_getdate(&year, &month, &day, &hour, &minute, &second); if (a == "N") { LCD_CLEAR; men ++; _delay_ms(20); } switch(men){ case 0: LCD_LOCATE(5,1); lcd_puts(itoa(hour, str, 10)); lcd_puts(":"); lcd_puts(itoa(minute, str, 10)); lcd_puts(":"); lcd_puts(itoa(second, str, 10)); lcd_puts(a); break; case 1: LCD_LOCATE(5,1); lcd_puts("20"); lcd_puts(itoa(year, str, 10)); lcd_puts("-"); lcd_puts(itoa(month, str, 10)); lcd_puts("-"); lcd_puts(itoa(day, str, 10)); break; case 2: men = 0; break; } if (count == 20) { Send_Znak(a); count=0; } count++; _delay_ms(50); } }
Time get_time() { uint8_t dummy; Time result; ds1307_getdate(&dummy, &dummy, &dummy, &result.hour, &result.minute, &dummy); return result; }