amiro-os / modules / NUCLEO-L476RG / module.c @ 2a9f9ad7
History | View | Annotate | Download (4.83 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 | 126ace3c | Thomas Schöpping | * @brief Structures and constant for the NUCLEO-L476RG module.
|
22 | 27d0378b | Simon Welzel | *
|
23 | 126ace3c | Thomas Schöpping | * @addtogroup NUCLEO-L476RG_module
|
24 | 27d0378b | Simon Welzel | * @{
|
25 | */
|
||
26 | |||
27 | 126ace3c | Thomas Schöpping | #include <amiroos.h> |
28 | 27d0378b | Simon Welzel | |
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 | 126ace3c | Thomas Schöpping | #if defined(AMIROLLD_CFG_MPU6050)
|
53 | |||
54 | I2CConfig moduleHalI2c3Config = { |
||
55 | /* timing reg */ 0, // configured later in MODULE_INIT_PERIPHERY_COMM_MPU6050() hook |
||
56 | /* CR1 */ 0, |
||
57 | /* CR2 */ 0, |
||
58 | }; |
||
59 | |||
60 | #endif /* defined(AMIROLLD_CFG_MPU6050) */ |
||
61 | |||
62 | 27d0378b | Simon Welzel | /** @} */
|
63 | |||
64 | 8543d0d9 | Thomas Schöpping | /*===========================================================================*/
|
65 | /**
|
||
66 | * @name GPIO definitions
|
||
67 | * @{
|
||
68 | */
|
||
69 | /*===========================================================================*/
|
||
70 | |||
71 | /**
|
||
72 | a0301104 | Thomas Schöpping | * @brief LED output signal GPIO.
|
73 | 8543d0d9 | Thomas Schöpping | */
|
74 | static apalGpio_t _gpioLed = {
|
||
75 | /* port */ GPIOA,
|
||
76 | /* pad */ GPIOA_LED_GREEN,
|
||
77 | }; |
||
78 | ROMCONST apalControlGpio_t moduleGpioLed = { |
||
79 | /* GPIO */ &_gpioLed,
|
||
80 | /* meta */ {
|
||
81 | /* direction */ APAL_GPIO_DIRECTION_OUTPUT,
|
||
82 | /* active state */ APAL_GPIO_ACTIVE_HIGH,
|
||
83 | /* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
||
84 | }, |
||
85 | }; |
||
86 | |||
87 | /**
|
||
88 | * @brief User button input signal GPIO.
|
||
89 | */
|
||
90 | static apalGpio_t _gpioUserButton = {
|
||
91 | /* port */ GPIOC,
|
||
92 | /* pad */ GPIOC_BUTTON,
|
||
93 | }; |
||
94 | ROMCONST apalControlGpio_t moduleGpioUserButton = { |
||
95 | /* GPIO */ &_gpioUserButton,
|
||
96 | /* meta */ {
|
||
97 | /* direction */ APAL_GPIO_DIRECTION_INPUT,
|
||
98 | 83e94d4b | Thomas Schöpping | /* active state */ APAL_GPIO_ACTIVE_LOW,
|
99 | 8543d0d9 | Thomas Schöpping | /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
|
100 | }, |
||
101 | }; |
||
102 | |||
103 | /** @} */
|
||
104 | 27d0378b | Simon Welzel | |
105 | /*===========================================================================*/
|
||
106 | /**
|
||
107 | * @name AMiRo-OS core configurations
|
||
108 | * @{
|
||
109 | */
|
||
110 | /*===========================================================================*/
|
||
111 | |||
112 | 8543d0d9 | Thomas Schöpping | #if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
113 | a0301104 | Thomas Schöpping | ROMCONST char* moduleShellPrompt = "NUCLEO-L476RG"; |
114 | 7de0cc90 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
115 | 27d0378b | Simon Welzel | |
116 | 8543d0d9 | Thomas Schöpping | /** @} */
|
117 | 27d0378b | Simon Welzel | |
118 | 8543d0d9 | Thomas Schöpping | /*===========================================================================*/
|
119 | /**
|
||
120 | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
||
121 | * @{
|
||
122 | */
|
||
123 | /*===========================================================================*/
|
||
124 | |||
125 | /** @} */
|
||
126 | |||
127 | /*===========================================================================*/
|
||
128 | /**
|
||
129 | * @name Low-level drivers
|
||
130 | * @{
|
||
131 | */
|
||
132 | /*===========================================================================*/
|
||
133 | |||
134 | 126ace3c | Thomas Schöpping | #if defined(AMIROLLD_CFG_MPU6050)
|
135 | |||
136 | MPU6050Driver moduleLldMpu6050 = { |
||
137 | /* I2C Driver */ &MODULE_HAL_I2C3,
|
||
138 | /* I²C address */ MPU6050_LLD_I2C_ADDR_FIXED,
|
||
139 | }; |
||
140 | |||
141 | #endif /* defined(AMIROLLD_CFG_MPU6050) */ |
||
142 | |||
143 | 8543d0d9 | Thomas Schöpping | /** @} */
|
144 | |||
145 | /*===========================================================================*/
|
||
146 | /**
|
||
147 | * @name Unit tests (UT)
|
||
148 | * @{
|
||
149 | */
|
||
150 | /*===========================================================================*/
|
||
151 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
152 | 1678f270 | Simon Welzel | |
153 | 126ace3c | Thomas Schöpping | #if defined(AMIROLLD_CFG_MPU6050)
|
154 | |||
155 | /* MPU6050 */
|
||
156 | static int _utShellCmdCb_AlldMpu6050(BaseSequentialStream* stream, int argc, char* argv[]) |
||
157 | { |
||
158 | (void)argc;
|
||
159 | (void)argv;
|
||
160 | aosUtRun(stream, &moduleUtAlldMpu6050, NULL);
|
||
161 | return AOS_OK;
|
||
162 | } |
||
163 | static ut_mpu6050data_t _utAlldMpu6050Data = {
|
||
164 | /* driver */ &moduleLldMpu6050,
|
||
165 | /* timeout */ MICROSECONDS_PER_SECOND,
|
||
166 | }; |
||
167 | aos_unittest_t moduleUtAlldMpu6050 = { |
||
168 | /* name */ "MPU6050", |
||
169 | /* info */ "accelerometer and gyroscope", |
||
170 | /* test function */ utAlldMpu6050Func,
|
||
171 | /* shell command */ {
|
||
172 | /* name */ "unittest:Accelerometer&Gyroscope", |
||
173 | /* callback */ _utShellCmdCb_AlldMpu6050,
|
||
174 | /* next */ NULL, |
||
175 | }, |
||
176 | /* data */ &_utAlldMpu6050Data
|
||
177 | }; |
||
178 | |||
179 | #endif /* defined(AMIROLLD_CFG_MPU6050) */ |
||
180 | |||
181 | 7de0cc90 | Thomas Schöpping | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
182 | 8543d0d9 | Thomas Schöpping | |
183 | /** @} */
|
||
184 | 27d0378b | Simon Welzel | /** @} */ |