-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrtc.c
61 lines (49 loc) · 1.16 KB
/
rtc.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
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
#include <termios.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <gps.h>
#include "start.h"
#include "utils.h"
#include "rtc.h"
#include "log.h"
static RTC_TIME_COORD rtc_data;
/* функция чтения времени - параметр не м.б. NULL */
void *rtc_read_port_func(void *par)
{
char byte;
char str[128], str0[128];
int t0 = 0, t1;
int ret_code = EXIT_FAILURE;
do {
/* Чтение и разбор данных */
while (!is_end_thread()) {
t1 = (s32) get_sec_ticks();
/* if we can get coordinates */
if (t1 != t0) {
t0 = t1;
rtc_data.lon = (s32) (37.617 * 10000);
rtc_data.lat = (s32) (55.755 * 10000);
rtc_data.time = t1;
rtc_data.check = true;
}
}
ret_code = EXIT_SUCCESS;
} while (0);
log_write_log_file("INFO: exit time thread\n");
pthread_exit(&ret_code);
}
/* Параметры NMEA */
void rtc_get_param(void *par)
{
if (par != NULL) {
memcpy((u8 *) par, &rtc_data, sizeof(RTC_TIME_COORD));
}
}