Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / LightRing_1-2 / test / DW1000 / module_test_DW1000.c @ 0b989911

History | View | Annotate | Download (3.416 KB)

1 0b989911 Cung Sang
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include <amiroos.h>
20
21
#if (AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__)
22
23
24
#include <module_test_DW1000.h>
25
#include <aos_test_DW1000.h>
26
//#include <aos_test_MIC9404x.h>
27
#include <module_test_MIC9404x.h>
28
29
/******************************************************************************/
30
/* LOCAL DEFINITIONS                                                          */
31
/******************************************************************************/
32
33
/******************************************************************************/
34
/* EXPORTED VARIABLES                                                         */
35
/******************************************************************************/
36
37
/******************************************************************************/
38
/* LOCAL TYPES                                                                */
39
/******************************************************************************/
40
41
/******************************************************************************/
42
/* LOCAL VARIABLES                                                            */
43
/******************************************************************************/
44
45
static aos_test_dw1000data_t _data = {
46
  /* UWB data     */ &moduleLldDw1000,
47
  /* event source */ &aos.events.io,
48
  /* event flags  */ MODULE_OS_IOEVENTFLAGS_DW1000,
49
  /* Power supply */ &moduleLldPowerSwitchDw1000,
50
};
51
52
static AOS_TEST(_test, "DW1000", NULL, moduleTestDw1000ShellCb, aosTestDw1000Func, &_data);
53
54
/******************************************************************************/
55
/* LOCAL FUNCTIONS                                                            */
56
/******************************************************************************/
57
58
/******************************************************************************/
59
/* EXPORTED FUNCTIONS                                                         */
60
/******************************************************************************/
61
62
int moduleTestDw1000ShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
63
{
64
  (void)argc;
65
  (void)argv;
66
67
  /* MIC9404x (power switch) */
68
  // Enable 1.8V for DW1000 module on Light Ring
69
  _data.mic9404xd = &moduleLldPowerSwitchV18;
70
  aosTestRun(stream, &_test, "1.8V");
71
  _data.mic9404xd = NULL;
72
73
  // Enable 3.3V for DW1000 module on Light Ring
74
  _data.mic9404xd = &moduleLldPowerSwitchV33;
75
  aosTestRun(stream, &_test, "3.3V");
76
  _data.mic9404xd = NULL;
77
78
79
  /* DW1000 (test) */
80
  if (result != NULL) {
81
    *result = aosTestRun(stream, &_test, NULL);
82
83
  } else {
84
    aosTestRun(stream, &_test, NULL);
85
  }
86
  return AOS_OK;
87
}
88
89
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */