Revision 35880232

View differences:

modules/LightRing_1-2/module.c
443 443
  /* configuration    */ NULL,
444 444
};
445 445

  
446
PN532Driver moduleNfc = {
447
  /* I2C Driver       */ &MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT,
448
  /* I²C address      */ PN532_LLD_I2C_ADDR_FIXED,  //TODO
449
  /* current LSB (uA) */ 0x00u,
450
  /* configuration    */ NULL,
451
};
452

  
446 453
LEDDriver moduleLldStatusLed = {
447 454
  /* LED enable Gpio */ &moduleGpioLed,
448 455
};
......
517 524
AOS_SHELL_COMMAND(moduleTestP9221rShellCmd, "test:QiCharger", _testP9221rShellCmdCb);
518 525

  
519 526
/*
527
 * PN632 (nfc)
528
 */
529
#include <module_test_PN532.h>
530
static int _testPn532ShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
531
{
532
  return moduleTestPn532ShellCb(stream, argc, argv, NULL);
533
}
534
AOS_SHELL_COMMAND(moduleTestPn532ShellCmd, "test:QiCharger", _testPn532ShellCmdCb);
535

  
536
/*
520 537
 * Status LED
521 538
 */
522 539
#include <module_test_LED.h>
modules/LightRing_1-2/module.h
303 303
  aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd);                  \
304 304
  aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd);                     \
305 305
  aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd);                \
306
  aosShellAddCommand(&aos.shell, &moduleTestP9221rShellCmd);                 \
306
  aosShellAddCommand(&aos.shell, &moduleTestP9221rShellCmd);                  \
307
  aosShellAddCommand(&aos.shell, &moduleTestPn532ShellCmd);                  \
307 308
  aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
308 309
  aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
309 310
}
......
394 395
#include <alld_AT24C01B.h>
395 396
#include <alld_INA219.h>
396 397
#include <alld_P9221R.h>
398
#include <alld_PN532.h>
397 399
#include <alld_LED.h>
398 400
#include <alld_MIC9404x.h>
399 401
// TODO: add SNx5C3221E
......
410 412
extern INA219Driver moduleLldPowerMonitorVled;
411 413

  
412 414
/**
413
 * @brief   ???
415
 * @brief   Qi charger driver
414 416
 */
415 417
extern P9221RDriver moduleQiCharger;
416 418

  
417 419
/**
420
 * @brief   Nfc driver
421
 */
422
extern PN532Driver moduleNfc;
423

  
424
/**
418 425
 * @brief   Status LED driver.
419 426
 */
420 427
extern LEDDriver moduleLldStatusLed;
......
478 485
extern aos_shellcommand_t moduleTestP9221rShellCmd;
479 486

  
480 487
/**
488
 * @brief   PN532 (nfc) unit test object.
489
 */
490
extern aos_shellcommand_t moduleTestPn532ShellCmd;
491

  
492
/**
481 493
 * @brief   Status LED test command.
482 494
 */
483 495
extern aos_shellcommand_t moduleTestLedShellCmd;
modules/LightRing_1-2/test/PN532/module_test_PN532.c
21 21
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
22 22

  
23 23
#include <module_test_PN532.h>
24
//#include <aos_test_PN532.h>
24
#include <aos_test_PN532.h>
25 25

  
26 26
/******************************************************************************/
27 27
/* LOCAL DEFINITIONS                                                          */
......
39 39
/* LOCAL VARIABLES                                                            */
40 40
/******************************************************************************/
41 41

  
42
//static aos_test_pn532data_t _data = {
43
 // /* driver           */ &moduleQiCharger, // !!!!
44
 // /* x alignment      */ 0.0f,
45
 // /* y alignment      */ 0.0f,
46
 // /* op freq          */ 0.0f,
47
 // /* voltage          */ 0.0f,
48
 // /* current          */ 0.0f,
49
 // /* timeout */ MICROSECONDS_PER_SECOND,
50
//};
42
static aos_test_pn532data_t _data = {
43
  /* driver           */ &moduleNfc, // !!
44
  /* timeout */ MICROSECONDS_PER_SECOND,
45
};
51 46

  
52
//static AOS_TEST(_test, "PN532", "nfc", moduleTestPn532ShellCb, aosTestPn532Func, &_data);
47
static AOS_TEST(_test, "PN532", "nfc", moduleTestPn532ShellCb, aosTestPn532Func, &_data);
53 48

  
54 49
/******************************************************************************/
55 50
/* LOCAL FUNCTIONS                                                            */
......
59 54
/* EXPORTED FUNCTIONS                                                         */
60 55
/******************************************************************************/
61 56

  
62
// int moduleTestPn532ShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
63
//{
64
//  (void)argc;
65
//  (void)argv;
57
 int moduleTestPn532ShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
58
{
59
  (void)argc;
60
  (void)argv;
66 61

  
67
//  if (result != NULL) {
68
//    *result = aosTestRun(stream, &_test, NULL);
69
//  } else {
70
//    aosTestRun(stream, &_test, NULL);
71
//  }
62
  if (result != NULL) {
63
    *result = aosTestRun(stream, &_test, NULL);
64
  } else {
65
    aosTestRun(stream, &_test, NULL);
66
  }
72 67

  
73
//  return AOS_OK;
74
//}
68
  return AOS_OK;
69
}
75 70

  
76 71
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
77 72

  
modules/LightRing_1-2/test/PN532/module_test_PN532.h
62 62

  
63 63
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
64 64

  
65
#endif /* MODULE_TEST_P9221R_H */
65
#endif /* MODULE_TEST_PN532_H */
66 66

  
67 67

  
periphery-lld/AMiRo-LLD
1
Subproject commit 27eae8ce786bec4b53d5d12fe0bbf30ae565f114
1
Subproject commit 15f74f80d61e1ece782ba90ccdefabfd4fe19933
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 */
test/periphery-lld/PN532_v1/aos_test_PN532.h
40 40
/******************************************************************************/
41 41
/* DATA STRUCTURES AND TYPES                                                  */
42 42
/******************************************************************************/
43
/**
44
 * @brief   Custom data structure for the test.
45
 */
46
typedef struct {
47
  /**
48
   * @brief   RN532 driver to use.
49
   */
50
  PN532Driver *PRd;
51
 
52
/**
53
   * @brief   Timeout delay for certain tests.
54
   */
55
  apalTime_t timeout;
56
} aos_test_pn532data_t;
43 57

  
44 58
/******************************************************************************/
45 59
/* MACROS                                                                     */
......
52 66
#if defined(__cplusplus)
53 67
extern "C" {
54 68
#endif /* defined(__cplusplus) */
55
 // aos_testresult_t aosTestP9221rFunc(BaseSequentialStream* stream, const aos_test_t* test);
69
  aos_testresult_t aosTestPn532Func(BaseSequentialStream* stream, const aos_test_t* test);
56 70
#if defined(__cplusplus)
57 71
}
58 72
#endif /* defined(__cplusplus) */
......
63 77

  
64 78
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
65 79

  
66
#endif /* AMIROOS_TEST_P9221R_H */
80
#endif /* AMIROOS_TEST_PN532_H */
67 81

  

Also available in: Unified diff