Revision 35880232 test/periphery-lld/PN532_v1/aos_test_PN532.c
test/periphery-lld/PN532_v1/aos_test_PN532.c | ||
---|---|---|
3 | 3 |
|
4 | 4 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
5 | 5 |
|
6 |
#include <math.h> |
|
7 | 6 |
|
8 | 7 |
/******************************************************************************/ |
9 | 8 |
/* LOCAL DEFINITIONS */ |
... | ... | |
30 | 29 |
/******************************************************************************/ |
31 | 30 |
|
32 | 31 |
|
33 |
aos_testresult_t aosTestP9221rFunc(BaseSequentialStream* stream, const aos_test_t* test)
|
|
32 |
aos_testresult_t aosTestPn532Func(BaseSequentialStream* stream, const aos_test_t* test)
|
|
34 | 33 |
{ |
35 |
aosDbgCheck(test->data != NULL && ((aos_test_p9221rdata_t*)(test->data))->PRd != NULL); |
|
36 |
|
|
37 |
// local variables |
|
38 |
|
|
39 |
return result; |
|
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; |
|
40 | 54 |
} |
41 | 55 |
|
42 | 56 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
Also available in: Unified diff