Revision 8cbe3240

View differences:

modules/LightRing_1-2/alldconf.h
54 54
#define AMIROLLD_CFG_INA219                     1
55 55

  
56 56
/**
57
 * @brief   Enable flag for the P9221R power monitor.
58
 */
59
#define AMIROLLD_CFG_P9221R                     1
60

  
61
/**
57 62
 * @brief   Enable flag for the status LED.
58 63
 */
59 64
#define AMIROLLD_CFG_LED                        1
modules/LightRing_1-2/module.c
549 549
  aosUtRun(stream, &moduleUtAlldP9221r, NULL);
550 550
  return AOS_OK;
551 551
}
552

  
552 553
static ut_p9221rdata_t _utP9221rData = {
553
  /* driver           */ &moduleLldPowerMonitorVled,
554
  /* expected voltage */ 4.2f,
555
  /* tolerance        */ 0.2f,
554
  /* driver           */ &moduleQiCharger, // !!!!
555
  /* x alignment      */ 0.0f,
556
  /* y alignment      */ 0.0f,
557
  /* op freq          */ 0.0f,
558
  /* voltage          */ 0.0f,
559
  /* current          */ 0.0f,
556 560
  /* timeout */ MICROSECONDS_PER_SECOND,
557 561
};
562

  
558 563
aos_unittest_t moduleUtAlldP9221r = {
559
  /* name           */ "P9221R",
560
  /* info           */ "qi charger",
561
  /* test function  */ utAlldP9221rFunc,
562
  /* shell command  */ {
563
    /* name     */ "unittest:QiCharger",
564
    /* callback */ _utShellCmdCb_AlldP9221r,
565
    /* next     */ NULL,
566
  },
567
  /* data           */ &_utP9221rData,
568
};
564
    /* name           */ "P9221R",
565
    /* info           */ "qi charger",
566
    /* test function  */ utAlldP9221rFunc,
567
    /* shell command  */ {
568
      /* name     */ "unittest:QiCharger",
569
      /* callback */ _utShellCmdCb_AlldP9221r,
570
      /* next     */ NULL,
571
    },
572
    /* data           */ &_utP9221rData,
573
  };
569 574

  
570 575
/*
571 576
 * Status LED
modules/LightRing_1-2/module.h
391 391
/*===========================================================================*/
392 392
#include <alld_AT24C01B.h>
393 393
#include <alld_INA219.h>
394
#include <alld_P9221R.h>
394 395
#include <alld_LED.h>
395 396
#include <alld_MIC9404x.h>
396 397
//#include <alld_SNx5C3221E.h>
......
458 459
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
459 460
#include <ut_alld_AT24C01B_v1.h>
460 461
#include <ut_alld_INA219_v1.h>
462
#include <ut_alld_P9221R_v1.h>
461 463
#include <ut_alld_LED_v1.h>
462 464
#include <ut_alld_MIC9404x_v1.h>
463 465
//#include <ut_alld_SNx5C3221E_v1.h>
......
474 476
extern aos_unittest_t moduleUtAlldIna219;
475 477

  
476 478
/**
479
 * @brief   P9221R (qi charger) unit test object.
480
 */
481
extern aos_unittest_t moduleUtAlldP9221r;
482

  
483
/**
477 484
 * @brief   Status LED unit test object.
478 485
 */
479 486
extern aos_unittest_t moduleUtAlldLed;
modules/PowerManagement_1-2/module.h
444 444
  aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500.shellcmd);              \
445 445
  aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500Bq24103a.shellcmd);      \
446 446
  aosShellAddCommand(&aos.shell, &moduleUtAlldIna219.shellcmd);               \
447
  aosShellAddCommand(&aos.shell, &moduleUtAlldP9221r.shellcmd);               \
448 447
  aosShellAddCommand(&aos.shell, &moduleUtAlldPklcs1212e4001.shellcmd);       \
449 448
  aosShellAddCommand(&aos.shell, &moduleUtAlldLed.shellcmd);                  \
450 449
  aosShellAddCommand(&aos.shell, &moduleUtAlldTps62113.shellcmd);             \
......
596 595
#include <alld_bq241xx.h>
597 596
#include <alld_bq27500.h>
598 597
#include <alld_INA219.h>
599
#include <alld_P9221R.h>
600 598
#include <alld_LED.h>
601 599
#include <alld_PKxxxExxx.h>
602 600
#include <alld_TPS6211x.h>
......
754 752
#include <ut_alld_bq27500_v1.h>
755 753
#include <ut_alld_bq27500_v1_bq241xx_v1.h>
756 754
#include <ut_alld_INA219_v1.h>
757
#include <ut_alld_P9221R_v1.h>
758 755
#include <ut_alld_LED_v1.h>
759 756
#include <ut_alld_PKxxxExxx_v1.h>
760 757
#include <ut_alld_TPS6211x_v1.h>
......
791 788
extern aos_unittest_t moduleUtAlldIna219;
792 789

  
793 790
/**
794
 * @brief   P9221R (qi charger) unit test object.
795
 */
796
extern aos_unittest_t moduleUtAlldP9221r;
797

  
798
/**
799 791
 * @brief   Status LED unit test object.
800 792
 */
801 793
extern aos_unittest_t moduleUtAlldLed;
unittests/periphery-lld/inc/ut_alld_P9221R_v1.h
21 21

  
22 22
#include <amiroos.h>
23 23

  
24
#if ((AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_R9221R) && (AMIROLLD_CFG_R9221R == 1)) || defined(__DOXYGEN__)
24
#if ((AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_P9221R) && (AMIROLLD_CFG_P9221R == 1)) || defined(__DOXYGEN__)
25 25

  
26
#include <alld_R9221R.h>
26
#include <alld_P9221R.h>
27 27

  
28 28
/******************************************************************************/
29 29
/* CONSTANTS                                                                  */
......
48 48
  /**
49 49
   * @brief   R9221R driver to use.
50 50
   */
51
  R9221RDriver *PRd;
51
  P9221RDriver *PRd;
52 52

  
53 53
  /**
54 54
   * @brief   Alignment in x direction measured.
unittests/periphery-lld/src/ut_alld_P9221R_v1.c
60 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 61
    if (status == APAL_STATUS_SUCCESS) {
62 62
      aosUtPassed(stream, &result);
63
      for(int i=0; i<data.len; i++){
63
      for(int i=0; i<18; i++){
64 64
          chprintf(stream, "register: %02x, data: %u \n", 0x3A+i, data[i]);
65 65
      }
66 66
    } else {
67 67
      aosUtFailed(stream, &result);
68 68
    }
69 69

  
70
    return result;
70 71
}
71 72
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_P9221R) && (AMIROLLD_CFG_P9221R == 1) */

Also available in: Unified diff