amiro-os / test / periphery-lld / PN532_v1 / aos_test_PN532.c @ 35880232
History | View | Annotate | Download (2.356 KB)
1 |
#include <amiroos.h> |
---|---|
2 |
#include <aos_test_PN532.h> |
3 |
|
4 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
5 |
|
6 |
|
7 |
/******************************************************************************/
|
8 |
/* LOCAL DEFINITIONS */
|
9 |
/******************************************************************************/
|
10 |
|
11 |
/******************************************************************************/
|
12 |
/* EXPORTED VARIABLES */
|
13 |
/******************************************************************************/
|
14 |
|
15 |
/******************************************************************************/
|
16 |
/* LOCAL TYPES */
|
17 |
/******************************************************************************/
|
18 |
|
19 |
/******************************************************************************/
|
20 |
/* LOCAL VARIABLES */
|
21 |
/******************************************************************************/
|
22 |
|
23 |
/******************************************************************************/
|
24 |
/* LOCAL FUNCTIONS */
|
25 |
/******************************************************************************/
|
26 |
|
27 |
/******************************************************************************/
|
28 |
/* EXPORTED FUNCTIONS */
|
29 |
/******************************************************************************/
|
30 |
|
31 |
|
32 |
aos_testresult_t aosTestPn532Func(BaseSequentialStream* stream, const aos_test_t* test)
|
33 |
{ |
34 |
aosDbgCheck(test->data != NULL && ((aos_test_pn532data_t*)(test->data))->PRd != NULL); |
35 |
|
36 |
//local variables
|
37 |
aos_testresult_t result = {0, 0}; |
38 |
uint32_t status; |
39 |
uint8_t data[2] = {0xA5}; |
40 |
|
41 |
chprintf(stream, "read all registers...\n");
|
42 |
status = pn532_lld_read_register(((aos_test_pn532data_t*)test->data)->PRd, PN532_LLD_REGISTER, data, 2, ((aos_test_pn532data_t*)test->data)->timeout);
|
43 |
if (status == APAL_STATUS_SUCCESS) {
|
44 |
aosTestPassed(stream, &result); |
45 |
for(int i=0; i<2; i++){ |
46 |
chprintf(stream, "register: 0x%02x, data: 0x%02X \n", 0x00+i, data[i]); |
47 |
} |
48 |
} else {
|
49 |
aosTestFailed(stream, &result); |
50 |
} |
51 |
|
52 |
|
53 |
return result;
|
54 |
} |
55 |
|
56 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
57 |
|