FreeCalypso > hg > freecalypso-tools
comparison rvinterf/etmsync/piradccal.c @ 323:886f65760d09
fc-tmsync: added pirelli-vbat-cal command to read Pirelli's ADC calibration
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 18 Dec 2017 21:00:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
322:ee6443191465 | 323:886f65760d09 |
---|---|
1 /* | |
2 * This module is linked into fc-tmsync and implements a command for | |
3 * retrieving Pirelli's VBAT ADC calibration. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 #include <string.h> | |
10 #include <strings.h> | |
11 #include "localtypes.h" | |
12 #include "exitcodes.h" | |
13 | |
14 get_pirelli_vbat_cal() | |
15 { | |
16 u_char bytes[2]; | |
17 int a, b; | |
18 int rc; | |
19 | |
20 rc = do_memory_read(0x027F06E5, bytes, 2); | |
21 if (rc) | |
22 return(rc); | |
23 a = bytes[0] | (bytes[1] << 8); | |
24 rc = do_memory_read(0x027F06F7, bytes, 2); | |
25 if (rc) | |
26 return(rc); | |
27 b = bytes[0] | (bytes[1] << 8); | |
28 if (b >= 32768) | |
29 b -= 65536; | |
30 printf("A=%d B=%d\n", a, b); | |
31 return(0); | |
32 } |