Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / STM32L476RG-NUCLEO64 / module.c @ 83e94d4b

History | View | Annotate | Download (4.429 KB)

1 27d0378b Simon Welzel
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3 8543d0d9 Thomas Schöpping
Copyright (C) 2016..2019  Thomas Schöpping et al.
4 27d0378b Simon Welzel

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
/**
20
 * @file
21
 * @brief   Structures and constant for the PowerManagement module.
22
 *
23
 * @addtogroup powermanagement_module
24
 * @{
25
 */
26
27
#include "module.h"
28
29
/*===========================================================================*/
30
/**
31
 * @name Module specific functions
32
 * @{
33
 */
34
/*===========================================================================*/
35
36
/** @} */
37
38
/*===========================================================================*/
39
/**
40
 * @name ChibiOS/HAL configuration
41
 * @{
42
 */
43
/*===========================================================================*/
44
45
SerialConfig moduleHalProgIfConfig = {
46
  /* bit rate */ 115200,
47
  /* CR1      */ 0,
48
  /* CR1      */ 0,
49
  /* CR1      */ 0,
50
};
51
52
/** @} */
53
54 8543d0d9 Thomas Schöpping
/*===========================================================================*/
55
/**
56
 * @name GPIO definitions
57
 * @{
58
 */
59
/*===========================================================================*/
60
61
/**
62
 * @brief   Red LED output signal GPIO.
63
 */
64
static apalGpio_t _gpioLed = {
65
  /* port */ GPIOA,
66
  /* pad  */ GPIOA_LED_GREEN,
67
};
68
ROMCONST apalControlGpio_t moduleGpioLed = {
69
  /* GPIO */ &_gpioLed,
70
  /* meta */ {
71
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
72
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
73
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
74
  },
75
};
76
77
/**
78
 * @brief   User button input signal GPIO.
79
 */
80
static apalGpio_t _gpioUserButton = {
81
  /* port */ GPIOC,
82
  /* pad  */ GPIOC_BUTTON,
83
};
84
ROMCONST apalControlGpio_t moduleGpioUserButton = {
85
  /* GPIO */ &_gpioUserButton,
86
  /* meta */ {
87
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
88 83e94d4b Thomas Schöpping
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
89 8543d0d9 Thomas Schöpping
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
90
  },
91
};
92
93
/** @} */
94 27d0378b Simon Welzel
95
/*===========================================================================*/
96
/**
97
 * @name AMiRo-OS core configurations
98
 * @{
99
 */
100
/*===========================================================================*/
101
102 8543d0d9 Thomas Schöpping
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
103
ROMCONST char* moduleShellPrompt = "STM32L476RG-NUCLEO64";
104 27d0378b Simon Welzel
#endif
105
106 8543d0d9 Thomas Schöpping
/** @} */
107 27d0378b Simon Welzel
108 8543d0d9 Thomas Schöpping
/*===========================================================================*/
109
/**
110
 * @name Startup Shutdown Synchronization Protocol (SSSP)
111
 * @{
112
 */
113
/*===========================================================================*/
114
115
/** @} */
116
117
/*===========================================================================*/
118
/**
119
 * @name Low-level drivers
120
 * @{
121
 */
122
/*===========================================================================*/
123
124
/** @} */
125
126
//MPU6050Driver moduleLldMpu6050 = {
127
//  /* I2C Driver       */ &MODULE_HAL_I2C_MPU6050,
128
//  /* I²C address      */ 0x68,
129
//  /* current LSB (uA) */ 0x00u,
130
//  /* configuration    */ NULL,
131
//};
132
133
/*===========================================================================*/
134
/**
135
 * @name Unit tests (UT)
136
 * @{
137
 */
138
/*===========================================================================*/
139
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
140 1678f270 Simon Welzel
141
/* MPU6050 */
142
static int _utShellCmdCb_AlldMpu6050(BaseSequentialStream* stream, int argc, char* argv[])
143
{
144
  (void)argc;
145
  (void)argv;
146
  aosUtRun(stream, &moduleUtAlldMpu6050, NULL);
147
  return AOS_OK;
148
}
149
static ut_mpu6050data_t _utAlldMpu6050Data = {
150
   /* driver */ &moduleLldMpu6050,
151
  /* timeout  */ MICROSECONDS_PER_SECOND,
152
};
153
aos_unittest_t moduleUtAlldMpu6050 = {
154
  /* name           */ "MPU6050",
155
  /* info           */ "accelerometer and gyroscope",
156
  /* test function  */ utAlldMpu6050Func,
157
  /* shell command  */ {
158
    /* name     */ "unittest:Accelerometer&Gyroscope",
159
    /* callback */ _utShellCmdCb_AlldMpu6050,
160
    /* next     */ NULL,
161
  },
162
  /* data           */ &_utAlldMpu6050Data
163
};
164
165 8543d0d9 Thomas Schöpping
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
166
167
/** @} */
168 27d0378b Simon Welzel
/** @} */