Revision ded1ded7 modules/NUCLEO-L476RG/module.c

View differences:

modules/NUCLEO-L476RG/module.c
49 49
  /* CR1      */ 0,
50 50
};
51 51

  
52
#if (BOARD_MPU6050_CONNECTED == true)
53

  
54
I2CConfig moduleHalI2c3Config = {
55
  /* timing reg */ 0, // configured later in MODULE_INIT_PERIPHERY_IF_MPU6050() hook
56
  /* CR1        */ 0,
57
  /* CR2        */ 0,
58
};
59

  
60
#endif /* (BOARD_MPU6050_CONNECTED == true) */
61

  
62
#if (BOARD_VL53L1X_CONNECTED == true)
63

  
64
I2CConfig moduleHalI2c3Config = {
65
  /* timing reg */ 0, // configured later in MODULE_INIT_PERIPHERY_IF_MPU6050() hook
52
I2CConfig moduleHalI2cConfig = {
53
  /* timing reg */ 0, // configured later in MODULE_INIT_PERIPHERY_IF hook
66 54
  /* CR1        */ 0,
67 55
  /* CR2        */ 0,
68 56
};
69 57

  
70
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
71

  
72 58
/** @} */
73 59

  
74 60
/*===========================================================================*/
......
108 94
  },
109 95
};
110 96

  
97
#if (BOARD_VL53L1X_CONNECTED == true) || defined(__DOXYGEN__)
111 98

  
99
/**
100
 * @brief   VL53L1X interrupt signal GPIO.
101
 */
112 102
static apalGpio_t _gpioVl53l1xINT = {
113
  /* line */ PAL_LINE(GPIOC, GPIOC_PIN2),
103
  /* line */ PAL_LINE(GPIOC, GPIOC_PIN6),
114 104
};
115 105
ROMCONST apalControlGpio_t moduleGpioVl53l1xINT = {
116 106
  /* GPIO */ &_gpioVl53l1xINT,
......
121 111
  },
122 112
};
123 113

  
114
/**
115
 * @brief   VL53L1X XSHUT signal GPIO.
116
 */
124 117
static apalGpio_t _gpioVl53l1xXSHUT = {
125
  /* line */ PAL_LINE(GPIOC, GPIOC_PIN3),
118
  /* line */ PAL_LINE(GPIOC, GPIOC_PIN5),
126 119
};
127 120
ROMCONST apalControlGpio_t moduleGpioVl53l1xXSHUT = {
128 121
  /* GPIO */ &_gpioVl53l1xXSHUT,
......
133 126
  },
134 127
};
135 128

  
129
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
130

  
136 131
/** @} */
137 132

  
138 133
/*===========================================================================*/
......
172 167
  /* Button Gpio  */ &moduleGpioUserButton,
173 168
};
174 169

  
175

  
176
#if (BOARD_VL53L1X_CONNECTED == true)
177
VL53L1XDriver moduleLldVl53l1x = {
178
   /* I2C Driver       */ &MODULE_HAL_I2C3,
179
  /* I²C address      */ VL53L1X_LLD_I2C_ADDR_DEFAULT,
180
  /* GPIO 1:INT pin */ &moduleGpioVl53l1xINT,
181
   /* Xshut  */        &moduleGpioVl53l1xXSHUT,
182
};
183

  
184
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
185

  
186 170
#if (BOARD_MPU6050_CONNECTED == true)
187 171

  
188 172
MPU6050Driver moduleLldMpu6050 = {
189
  /* I2C Driver       */ &MODULE_HAL_I2C3,
173
  /* I2C Driver       */ &MODULE_HAL_I2C,
190 174
  /* I²C address      */ MPU6050_LLD_I2C_ADDR_FIXED,
191 175
};
192 176

  
177
#endif /* (BOARD_MPU6050_CONNECTED == true) */
193 178

  
179
#if (BOARD_VL53L1X_CONNECTED == true)
194 180

  
195
#endif /* (BOARD_MPU6050_CONNECTED == true) */
181
VL53L1XDriver moduleLldVl53l1x = {
182
  /* device data    */ {},
183
  /* interface data */ {
184
    /* I2C Driver     */ &MODULE_HAL_I2C,
185
    /* I²C address    */ VL53L1X_LLD_I2C_ADDR_DEFAULT,
186
    /* GPIO 1:INT pin */ &moduleGpioVl53l1xINT,
187
    /* Xshut          */ &moduleGpioVl53l1xXSHUT,
188
  },
189
};
190

  
191
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
196 192

  
197 193
/** @} */
198 194

  
......
215 211
AOS_SHELL_COMMAND(moduleTestLedShellCmd, "test:LED", _testLedShellCmdCb);
216 212

  
217 213
/*
218
 * LED
219
 */
220
#include <module_test_VL53L1X.h>
221
static int _testShellVL53L1XCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
222
{
223
  return moduleTestVL53L1XShellCb(stream, argc, argv, NULL);
224
}
225
AOS_SHELL_COMMAND(moduleTestVL53L1XShellCmd, "test:VL53L1X", _testShellVL53L1XCmdCb);
226

  
227
static int _testShellVL53L1XInitCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
228
{
229
  return moduleTestVL53L1XInitShellCb(stream, argc, argv, NULL);
230
}
231
AOS_SHELL_COMMAND(moduleTestVL53L1XInitShellCmd, "test:VL53L1X:INIT", _testShellVL53L1XInitCmdCb);
232

  
233
/*
234 214
 * User button
235 215
 */
236 216
#include <module_test_button.h>
......
241 221
AOS_SHELL_COMMAND(moduleTestButtonShellCmd, "test:button", _testButtonShellCmdCb);
242 222

  
243 223
#if (BOARD_MPU6050_CONNECTED == true) || defined(__DOXYGEN__)
244

  
245 224
/*
246 225
 * MPU6050 (accelerometer & gyroscope)
247 226
 */
......
251 230
  return moduleTestMpu6050ShellCb(stream, argc, argv, NULL);
252 231
}
253 232
AOS_SHELL_COMMAND(moduleTestMpu6050ShellCmd, "test:IMU", _testMpu6050ShellCmdCb);
254

  
255 233
#endif /* (BOARD_MPU6050_CONNECTED == true) */
256 234

  
235
#if (BOARD_VL53L1X_CONNECTED == true) || defined(__DOXYGEN__)
236
/*
237
 * VL53L1X
238
 */
239
#include <module_test_VL53L1X.h>
240
static int _testShellVL53L1XCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
241
{
242
  return moduleTestVL53L1XShellCb(stream, argc, argv, NULL);
243
}
244
AOS_SHELL_COMMAND(moduleTestVL53L1XShellCmd, "test:VL53L1X", _testShellVL53L1XCmdCb);
245
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
246

  
257 247
/*
258 248
 * entire module
259 249
 */
......
275 265
  status |= moduleTestButtonShellCb(stream, 0, targv, &result_test);
276 266
  result_total = aosTestResultAdd(result_total, result_test);
277 267

  
278
  /* MPU6050 (accelerometer & gyroscope) */
279 268
#if (BOARD_MPU6050_CONNECTED == true)
269
  /* MPU6050 (accelerometer & gyroscope) */
280 270
  status |= moduleTestMpu6050ShellCb(stream, 0, targv, &result_test);
281 271
  result_total = aosTestResultAdd(result_total, result_test);
282 272
#endif /* (BOARD_MPU6050_CONNECTED == true) */
283 273

  
274
#if (BOARD_VL53L1X_CONNECTED == true)
275
  /* VL53L1X (ToF sensor) */
276
  status |= moduleTestVL53L1XShellCb(stream, 0, targv, &result_test);
277
  result_total = aosTestResultAdd(result_total, result_test);
278
#endif /* (BOARD_VL53L1X_CONNECTED == true) */
279

  
284 280
  // print total result
285 281
  chprintf(stream, "\n");
286 282
  aosTestResultPrintSummary(stream, &result_total, "entire module");

Also available in: Unified diff