Revision 8543d0d9 modules/RT-STM32L476RG-NUCLEO64/module.c
| modules/RT-STM32L476RG-NUCLEO64/module.c | ||
|---|---|---|
| 1 | 1 |
/* |
| 2 | 2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
| 3 |
Copyright (C) 2016..2018 Thomas Schöpping et al.
|
|
| 3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
|
| 4 | 4 |
|
| 5 | 5 |
This program is free software: you can redistribute it and/or modify |
| 6 | 6 |
it under the terms of the GNU General Public License as published by |
| ... | ... | |
| 26 | 26 |
|
| 27 | 27 |
#include "module.h" |
| 28 | 28 |
|
| 29 |
#include <amiroos.h> |
|
| 30 |
|
|
| 31 | 29 |
/*===========================================================================*/ |
| 32 | 30 |
/** |
| 33 | 31 |
* @name Module specific functions |
| ... | ... | |
| 44 | 42 |
*/ |
| 45 | 43 |
/*===========================================================================*/ |
| 46 | 44 |
|
| 47 |
CANConfig moduleHalCanConfig = {
|
|
| 48 |
/* mcr */ CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, |
|
| 49 |
/* btr */ CAN_BTR_SJW(1) | CAN_BTR_TS2(3) | CAN_BTR_TS1(15) | CAN_BTR_BRP(1), |
|
| 50 |
}; |
|
| 51 |
|
|
| 52 | 45 |
SerialConfig moduleHalProgIfConfig = {
|
| 53 | 46 |
/* bit rate */ 115200, |
| 54 | 47 |
/* CR1 */ 0, |
| ... | ... | |
| 58 | 51 |
|
| 59 | 52 |
/** @} */ |
| 60 | 53 |
|
| 54 |
/*===========================================================================*/ |
|
| 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 |
/* active state */ APAL_GPIO_ACTIVE_HIGH, |
|
| 89 |
/* interrupt edge */ APAL_GPIO_EDGE_BOTH, |
|
| 90 |
}, |
|
| 91 |
}; |
|
| 92 |
|
|
| 93 |
/** @} */ |
|
| 61 | 94 |
|
| 62 | 95 |
/*===========================================================================*/ |
| 63 | 96 |
/** |
| ... | ... | |
| 66 | 99 |
*/ |
| 67 | 100 |
/*===========================================================================*/ |
| 68 | 101 |
|
| 69 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
|
| 70 |
ROMCONST char* moduleShellPrompt = "STM32L476-DevBoard";
|
|
| 102 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
|
|
| 103 |
ROMCONST char* moduleShellPrompt = "STM32L476RG-NUCLEO64";
|
|
| 71 | 104 |
#endif |
| 72 | 105 |
|
| 106 |
/** @} */ |
|
| 73 | 107 |
|
| 74 |
MPU6050Driver moduleLldMpu6050 = {
|
|
| 75 |
/* I2C Driver */ &MODULE_HAL_I2C_MPU6050, |
|
| 76 |
/* I²C address */ 0x68, |
|
| 77 |
/* current LSB (uA) */ 0x00u, |
|
| 78 |
/* configuration */ NULL, |
|
| 79 |
}; |
|
| 108 |
/*===========================================================================*/ |
|
| 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__) |
|
| 80 | 140 |
|
| 81 | 141 |
/* MPU6050 */ |
| 82 | 142 |
static int _utShellCmdCb_AlldMpu6050(BaseSequentialStream* stream, int argc, char* argv[]) |
| ... | ... | |
| 86 | 146 |
aosUtRun(stream, &moduleUtAlldMpu6050, NULL); |
| 87 | 147 |
return AOS_OK; |
| 88 | 148 |
} |
| 89 |
|
|
| 90 | 149 |
static ut_mpu6050data_t _utAlldMpu6050Data = {
|
| 91 | 150 |
/* driver */ &moduleLldMpu6050, |
| 92 | 151 |
/* timeout */ MICROSECONDS_PER_SECOND, |
| ... | ... | |
| 103 | 162 |
/* data */ &_utAlldMpu6050Data |
| 104 | 163 |
}; |
| 105 | 164 |
|
| 165 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
|
| 166 |
|
|
| 167 |
/** @} */ |
|
| 106 | 168 |
/** @} */ |
Also available in: Unified diff