Revision c60ee2dd

View differences:

modules/LightRing_1-2/module.c
509 509
/*
510 510
 * P9221R (qi charger)
511 511
 */
512
//static int _utShellCmdCb_AlldP9221r(BaseSequentialStream* stream, int argc, char* argv[])
513
//{
514
//  (void)argc;
515
//  (void)argv;
516
//  aosTestRun(stream, &moduleTestP9221r, NULL);
517
//  return AOS_OK;
518
//}
519
//static ut_p9221rdata_t _utP9221rData = {
520
//  /* driver           */ &moduleQiCharger, // !!!!
521
//  /* x alignment      */ 0.0f,
522
//  /* y alignment      */ 0.0f,
523
//  /* op freq          */ 0.0f,
524
//  /* voltage          */ 0.0f,
525
//  /* current          */ 0.0f,
526
//  /* timeout */ MICROSECONDS_PER_SECOND,
527
//};
528
//aos_unittest_t moduleTestP9221r = {
529
//    /* name           */ "P9221R",
530
//    /* info           */ "qi charger",
531
//    /* test function  */ aosTestP9221rFunc,
532
//    /* shell command  */ {
533
//      /* name     */ "unittest:QiCharger",
534
//      /* callback */ _utShellCmdCb_AlldP9221r,
535
//      /* next     */ NULL,
536
//    },
537
//    /* data           */ &_utP9221rData,
538
//};
512
#include <module_test_P9221R.h>
513
static int _testP9221rShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
514
{
515
  return moduleTestP9221rShellCb(stream, argc, argv, NULL);
516
}
517
AOS_SHELL_COMMAND(moduleTestP9221rShellCmd, "test:QiCharger", _testP9221rShellCmdCb);
539 518

  
540 519
/*
541 520
 * Status LED
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 307
  aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
308 308
  aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
309 309
}
modules/LightRing_1-2/test/P9221R/module_test_P9221R.c
39 39
/* LOCAL VARIABLES                                                            */
40 40
/******************************************************************************/
41 41

  
42
//static aos_test_leddata_t _data = {
43
//  /* LED  */ &moduleLldStatusLed,
44
//};
45

  
46
//static AOS_TEST(_test, "LED", NULL, moduleTestLedShellCb, aosTestLedFunc, &_data);
42
static aos_test_p9221rdata_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
};
51

  
52
static AOS_TEST(_test, "P9221R", "qi charger", moduleTestP9221rShellCb, aosTestP9221rFunc, &_data);
47 53

  
48 54
/******************************************************************************/
49 55
/* LOCAL FUNCTIONS                                                            */
......
53 59
/* EXPORTED FUNCTIONS                                                         */
54 60
/******************************************************************************/
55 61

  
56
//int moduleTestLedShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
57
//{
58
//  (void)argc;
59
//  (void)argv;
60
//
61
//  if (result != NULL) {
62
//    *result = aosTestRun(stream, &_test, NULL);
63
//  } else {
64
//    aosTestRun(stream, &_test, NULL);
65
//  }
66
//
67
//  return AOS_OK;
68
//}
62
 int moduleTestP9221rShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
63
{
64
  (void)argc;
65
  (void)argv;
66

  
67
  if (result != NULL) {
68
    *result = aosTestRun(stream, &_test, NULL);
69
  } else {
70
    aosTestRun(stream, &_test, NULL);
71
  }
72

  
73
  return AOS_OK;
74
}
69 75

  
70 76
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
modules/LightRing_1-2/test/P9221R/module_test_P9221R.h
51 51
#if defined(__cplusplus)
52 52
extern "C" {
53 53
#endif /* defined(__cplusplus) */
54
//  int moduleTestLedShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result);
54
    int moduleTestP9221rShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result);
55 55
#if defined(__cplusplus)
56 56
}
57 57
#endif /* defined(__cplusplus) */
test/periphery-lld/P9221R_v1/aos_test_P9221R.c
56 56
    aos_testresult_t result = {0, 0};
57 57
    uint32_t status;
58 58
    uint8_t data[79] = {0xA5};
59
    int8_t x_alignment[2] = {0xA5};
60
    int8_t y_alignment[2] = {0xA5};
59
    int8_t alignment[2] = {0xA5};
61 60
    float voltage[1];
62 61
    float current[1];
63 62

  
......
72 71
      aosTestFailed(stream, &result);
73 72
    }
74 73

  
75
    chprintf(stream, "read x_alignment for five seconds, move receiver ... \n");
74
    chprintf(stream, "read alignment for five seconds, move receiver ... \n");
76 75
    status = APAL_STATUS_SUCCESS;
77 76
    for (uint32_t i = 0; i <= 5; i++) {
78
        status |=   p9221r_lld_read_x_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, x_alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
79
        chprintf(stream, "x_alignment %d \n", x_alignment[0]);
80
        //aosTestPassed(stream, &result);
81
        aosThdSSleep(1);
82
    }
83
    if(status == APAL_STATUS_SUCCESS) {
84
      aosTestPassed(stream, &result);
85
    } else {
86
      aosTestFailed(stream, &result);
87
    }
88

  
89
    chprintf(stream, "read y_alignment for five seconds, move receiver ... \n");
90
    status = APAL_STATUS_SUCCESS;
91
    for (uint32_t i = 0; i <= 5; i++) {
92
        status |= p9221r_lld_read_y_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, y_alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
93
        chprintf(stream, "y_alignment: %d \n", y_alignment[0]);
77
        status |=   p9221r_lld_read_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
78
        chprintf(stream, "x_alignment %2d \n", alignment[0]);
79
        chprintf(stream, "y_alignment %2d \n", alignment[1]);
94 80
        //aosTestPassed(stream, &result);
95 81
        aosThdSSleep(1);
96 82
    }

Also available in: Unified diff