This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
main.c
101 lines (93 loc) · 2.41 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* Copyright 2023 Dual Tachyon
* https://github.com/DualTachyon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <at32f421.h>
#include "app/radio.h"
#include "app/uart.h"
#include "driver/bk4819.h"
#include "driver/crm.h"
#include "driver/delay.h"
#include "driver/key.h"
#include "driver/uart.h"
#include "helper/helper.h"
#include "misc.h"
#include "radio/data.h"
#include "radio/hardware.h"
#include "radio/settings.h"
#include "task/alarm.h"
#include "task/battery.h"
#include "task/cursor.h"
#include "task/encrypt.h"
#include "task/fmscanner.h"
#include "task/idle.h"
#include "task/incoming.h"
#include "task/keys.h"
#include "task/lock.h"
#include "task/noaa.h"
#include "task/ptt.h"
#include "task/rssi.h"
#include "task/scanner.h"
#include "task/screen.h"
#include "task/sidekeys.h"
#include "task/timeout.h"
#include "task/voice.h"
#include "task/vox.h"
extern const uint8_t StackVector[];
void Main(void) __attribute__((noreturn));
void _putchar(char c)
{
UART_SendByte((uint8_t)c);
}
void Main(void)
{
CRM_GetCoreClock();
SCB->VTOR = (uint32_t)StackVector;
DELAY_Init();
DELAY_WaitMS(200);
HARDWARE_Init();
RADIO_Init();
if (gSettings.DtmfState == DTMF_STATE_KILLED) {
DATA_ReceiverInit();
}
while (1) {
do {
while (!UART_IsRunning && gSettings.DtmfState != DTMF_STATE_KILLED) {
Task_VoicePlayer();
Task_CheckKeyPad();
Task_CheckSideKeys();
Task_UpdateScreen();
Task_BlinkCursor();
Task_Scanner();
Task_CheckPTT();
Task_CheckIncoming();
Task_CheckRSSI();
Task_CheckDisplayTimeout();
Task_Encrypt();
Task_CheckLockScreen();
Task_VoxUpdate();
Task_Idle();
Task_CheckBattery();
Task_CheckScannerFM();
Task_CheckNOAA();
Task_LocalAlarm();
}
} while (gSettings.DtmfState != DTMF_STATE_KILLED);
if (BK4819_ReadRegister(0x0C) & 0x0001U) {
DATA_ReceiverCheck();
}
DELAY_WaitMS(1);
STANDBY_BlinkGreen();
}
}