-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
77 lines (77 loc) · 2.03 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//=============================================================================
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
//=============================================================================
#include "pins.h"
#include "events.h"
#include "rtos.h"
#include "i2csw.h"
#include "rc5.h"
#include "enc.h"
#include "kbd.h"
#include "ds18x20.h"
#include "bmp180.h"
#include "dht22.h"
#include "rda5807.h"
#include "lcd_lib.h"
#include "ds3231.h"
#include "interface.h"
#include "utils.h"
//=============================================================================
int main(void)
{
LIGHT_init();
LCD_init();
LIGHT_on();
LCD_clear();
BEEP_init();
RTC_init();
RTOS_init();
RC5_Init();
RC5_Reset();
ENC_init();
KBD_init();
bmp180Init();
dht22Init();
rda5807Init();
rda5807PowerOn();
rda5807SetMute(1);
ds18x20SearchDevices();
LCD_goto(0, 0);
LCD_puts("POGODNAY STATION");
LCD_goto(0, 1);
LCD_puts(" VERSION 1.0 ");
_delay_ms(1000);
LCD_clear();
LCD_load_bignum();
ds18x20Process();
if (bmp180HaveSensor()) bmp180Convert();
dht22Read();
#if (DEBUG == 1)
if ((BUT_1_PINX & (1<<(BUT_1_PIN))) == 0) {
_delay_ms(100);
if ((BUT_1_PINX & (1<<(BUT_1_PIN))) == 0) {
RTOS_setTask(EVENT_SET_STATE_OPTION, 0, 0);
BEEP_beep();
while (((BUT_1_PINX & (1<<(BUT_1_PIN))) == 0)) { }
BEEP_beep();
}
}
#else
RTOS_setTask(EVENT_SET_STATE_OPTION, 0, 0);
BEEP_beep();
#endif
RTOS_setTaskFunc(set_blink, 0, 1000); // ìîðãàíèå
RTOS_setTaskFunc(KBD_scan, 0, 5); // çàïóñêàåì îïðîñ êíîïîê
RTOS_setTaskFunc(ENC_poll, 0, 1); // çàïóñêàåì îïðîñ åíêîäåðà
RTOS_setTaskFunc(RC5_scan, 0, 5); // çàïóñêàåì îïðîñ RC5
RTOS_setTask(EVENT_SET_SHOW, 0, 0); // çàïóñê øîó
sei(); // Ðàçðåøèëè ïðåðûâàíèÿ
while(1) {
RTOS_dispatchTask(); // Âûçûâàåì äèñïåò÷åð â öèêëå.
}
}
//=============================================================================