amiro-os / modules / STM32F4Discovery / module.c @ cca61a53
History | View | Annotate | Download (4.836 KB)
| 1 |
/*
|
|---|---|
| 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 |
/**
|
| 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 |
#include <amiroos.h> |
| 30 |
|
| 31 |
/*===========================================================================*/
|
| 32 |
/**
|
| 33 |
* @name Module specific functions
|
| 34 |
* @{
|
| 35 |
*/
|
| 36 |
/*===========================================================================*/
|
| 37 |
|
| 38 |
/** @} */
|
| 39 |
|
| 40 |
/*===========================================================================*/
|
| 41 |
/**
|
| 42 |
* @name ChibiOS/HAL configuration
|
| 43 |
* @{
|
| 44 |
*/
|
| 45 |
/*===========================================================================*/
|
| 46 |
|
| 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 |
SerialConfig moduleHalProgIfConfig = {
|
| 53 |
/* bit rate */ 115200, |
| 54 |
/* CR1 */ 0, |
| 55 |
/* CR1 */ 0, |
| 56 |
/* CR1 */ 0, |
| 57 |
}; |
| 58 |
|
| 59 |
/** @} */
|
| 60 |
|
| 61 |
/*===========================================================================*/
|
| 62 |
/**
|
| 63 |
* @name GPIO definitions
|
| 64 |
* @{
|
| 65 |
*/
|
| 66 |
/*===========================================================================*/
|
| 67 |
|
| 68 |
/**
|
| 69 |
* @brief Red LED output signal GPIO.
|
| 70 |
*/
|
| 71 |
static apalGpio_t _gpioLedRed = {
|
| 72 |
/* port */ GPIOD,
|
| 73 |
/* pad */ GPIOD_LED5,
|
| 74 |
}; |
| 75 |
ROMCONST apalControlGpio_t moduleGpioLedRed = {
|
| 76 |
/* GPIO */ &_gpioLedRed,
|
| 77 |
/* meta */ {
|
| 78 |
/* direction */ APAL_GPIO_DIRECTION_OUTPUT,
|
| 79 |
/* active state */ APAL_GPIO_ACTIVE_HIGH,
|
| 80 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
| 81 |
}, |
| 82 |
}; |
| 83 |
|
| 84 |
/**
|
| 85 |
* @brief Green LED output signal GPIO.
|
| 86 |
*/
|
| 87 |
static apalGpio_t _gpioLedGreen = {
|
| 88 |
/* port */ GPIOD,
|
| 89 |
/* pad */ GPIOD_LED4,
|
| 90 |
}; |
| 91 |
ROMCONST apalControlGpio_t moduleGpioLedGreen = {
|
| 92 |
/* GPIO */ &_gpioLedGreen,
|
| 93 |
/* meta */ {
|
| 94 |
/* direction */ APAL_GPIO_DIRECTION_OUTPUT,
|
| 95 |
/* active state */ APAL_GPIO_ACTIVE_HIGH,
|
| 96 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
| 97 |
}, |
| 98 |
}; |
| 99 |
|
| 100 |
/**
|
| 101 |
* @brief Blue LED output signal GPIO.
|
| 102 |
*/
|
| 103 |
static apalGpio_t _gpioLedBlue = {
|
| 104 |
/* port */ GPIOD,
|
| 105 |
/* pad */ GPIOD_LED6,
|
| 106 |
}; |
| 107 |
ROMCONST apalControlGpio_t moduleGpioLedBlue = {
|
| 108 |
/* GPIO */ &_gpioLedBlue,
|
| 109 |
/* meta */ {
|
| 110 |
/* direction */ APAL_GPIO_DIRECTION_OUTPUT,
|
| 111 |
/* active state */ APAL_GPIO_ACTIVE_HIGH,
|
| 112 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
| 113 |
}, |
| 114 |
}; |
| 115 |
|
| 116 |
/**
|
| 117 |
* @brief Orange LED output signal GPIO.
|
| 118 |
*/
|
| 119 |
static apalGpio_t _gpioLedOrange = {
|
| 120 |
/* port */ GPIOD,
|
| 121 |
/* pad */ GPIOD_LED3,
|
| 122 |
}; |
| 123 |
ROMCONST apalControlGpio_t moduleGpioLedOrange = {
|
| 124 |
/* GPIO */ &_gpioLedOrange,
|
| 125 |
/* meta */ {
|
| 126 |
/* direction */ APAL_GPIO_DIRECTION_OUTPUT,
|
| 127 |
/* active state */ APAL_GPIO_ACTIVE_HIGH,
|
| 128 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
| 129 |
}, |
| 130 |
}; |
| 131 |
|
| 132 |
/**
|
| 133 |
* @brief User button input signal GPIO.
|
| 134 |
*/
|
| 135 |
static apalGpio_t _gpioUserButton = {
|
| 136 |
/* port */ GPIOA,
|
| 137 |
/* pad */ GPIOA_BUTTON,
|
| 138 |
}; |
| 139 |
ROMCONST apalControlGpio_t moduleGpioUserButton = {
|
| 140 |
/* GPIO */ &_gpioUserButton,
|
| 141 |
/* meta */ {
|
| 142 |
/* direction */ APAL_GPIO_DIRECTION_INPUT,
|
| 143 |
/* active state */ APAL_GPIO_ACTIVE_HIGH,
|
| 144 |
/* interrupt edge */ APAL_GPIO_EDGE_BOTH,
|
| 145 |
}, |
| 146 |
}; |
| 147 |
|
| 148 |
/** @} */
|
| 149 |
|
| 150 |
/*===========================================================================*/
|
| 151 |
/**
|
| 152 |
* @name AMiRo-OS core configurations
|
| 153 |
* @{
|
| 154 |
*/
|
| 155 |
/*===========================================================================*/
|
| 156 |
|
| 157 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
| 158 |
ROMCONST char* moduleShellPrompt = "STM32F407Discovery"; |
| 159 |
#endif
|
| 160 |
|
| 161 |
/** @} */
|
| 162 |
|
| 163 |
/*===========================================================================*/
|
| 164 |
/**
|
| 165 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
| 166 |
* @{
|
| 167 |
*/
|
| 168 |
/*===========================================================================*/
|
| 169 |
|
| 170 |
/** @} */
|
| 171 |
|
| 172 |
/*===========================================================================*/
|
| 173 |
/**
|
| 174 |
* @name Low-level drivers
|
| 175 |
* @{
|
| 176 |
*/
|
| 177 |
/*===========================================================================*/
|
| 178 |
|
| 179 |
/** @} */
|
| 180 |
|
| 181 |
/*===========================================================================*/
|
| 182 |
/**
|
| 183 |
* @name Unit tests (UT)
|
| 184 |
* @{
|
| 185 |
*/
|
| 186 |
/*===========================================================================*/
|
| 187 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
| 188 |
|
| 189 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
| 190 |
|
| 191 |
/** @} */
|
| 192 |
/** @} */
|