|
1 |
/*
|
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify
|
|
6 |
it under the terms of the GNU General Public License as published by
|
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
|
8 |
(at your option) any later version.
|
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful,
|
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
GNU General Public License for more details.
|
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License
|
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
*/
|
|
18 |
|
1 |
19 |
#include <amiroos.h>
|
2 |
20 |
#include <ut_alld_P9221R_v1.h>
|
3 |
21 |
|
|
22 |
#if ((AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_P9221R) && (AMIROLLD_CFG_P9221R == 1)) || defined(__DOXYGEN__)
|
|
23 |
|
|
24 |
#include <math.h>
|
|
25 |
|
|
26 |
/******************************************************************************/
|
|
27 |
/* LOCAL DEFINITIONS */
|
|
28 |
/******************************************************************************/
|
|
29 |
|
|
30 |
/******************************************************************************/
|
|
31 |
/* EXPORTED VARIABLES */
|
|
32 |
/******************************************************************************/
|
|
33 |
|
|
34 |
/******************************************************************************/
|
|
35 |
/* LOCAL TYPES */
|
|
36 |
/******************************************************************************/
|
|
37 |
|
|
38 |
/******************************************************************************/
|
|
39 |
/* LOCAL VARIABLES */
|
|
40 |
/******************************************************************************/
|
|
41 |
|
|
42 |
/******************************************************************************/
|
|
43 |
/* LOCAL FUNCTIONS */
|
|
44 |
/******************************************************************************/
|
|
45 |
|
|
46 |
/******************************************************************************/
|
|
47 |
/* EXPORTED FUNCTIONS */
|
|
48 |
/******************************************************************************/
|
|
49 |
|
4 |
50 |
aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut)
|
5 |
51 |
{
|
6 |
|
aos_utresult_t result = {0, 0};
|
7 |
|
return result;
|
|
52 |
aosDbgCheck(ut->data != NULL && ((ut_p9221rdata_t*)(ut->data))->PRd != NULL);
|
|
53 |
|
|
54 |
// local variables
|
|
55 |
aos_utresult_t result = {0, 0};
|
|
56 |
uint32_t status;
|
|
57 |
uint16_t data[18];
|
|
58 |
|
|
59 |
chprintf(stream, "read registers...\n");
|
|
60 |
status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_BATTERY_STATUS_SENT, data, 18, ((ut_p9221rdata_t*)ut->data)->timeout);
|
|
61 |
if (status == APAL_STATUS_SUCCESS) {
|
|
62 |
aosUtPassed(stream, &result);
|
|
63 |
for(int i=0; i<data.len; i++){
|
|
64 |
chprintf(stream, "register: %02x, data: %u \n", 0x3A+i, data[i]);
|
|
65 |
}
|
|
66 |
} else {
|
|
67 |
aosUtFailed(stream, &result);
|
|
68 |
}
|
|
69 |
|
8 |
70 |
}
|
|
71 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_P9221R) && (AMIROLLD_CFG_P9221R == 1) */
|