amiro-os / modules / PowerManagement_1-1 / module.h @ 1fa17188
History | View | Annotate | Download (24.525 KB)
| 1 | e545e620 | Thomas Schöpping | /*
|
|---|---|---|---|
| 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.
|
||
| 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 | 53710ca3 | Marc Rothmann | /**
|
| 20 | * @file
|
||
| 21 | * @brief Structures and constant for the PowerManagement module.
|
||
| 22 | *
|
||
| 23 | * @addtogroup powermanagement_module
|
||
| 24 | * @{
|
||
| 25 | */
|
||
| 26 | |||
| 27 | e545e620 | Thomas Schöpping | #ifndef _AMIROOS_MODULE_H_
|
| 28 | #define _AMIROOS_MODULE_H_
|
||
| 29 | |||
| 30 | /*===========================================================================*/
|
||
| 31 | /**
|
||
| 32 | * @name Module specific functions
|
||
| 33 | * @{
|
||
| 34 | */
|
||
| 35 | /*===========================================================================*/
|
||
| 36 | |||
| 37 | /*
|
||
| 38 | * @brief Makro to store data in the core coupled memory (ccm).
|
||
| 39 | * Example:
|
||
| 40 | * int compute_buffer[128] CCM_RAM;
|
||
| 41 | *
|
||
| 42 | * @note The ccm is not connected to any bus system.
|
||
| 43 | */
|
||
| 44 | #define CCM_RAM __attribute__((section(".ram4"), aligned(4))) |
||
| 45 | |||
| 46 | /*
|
||
| 47 | * @brief Makro to store data in the ethernet memory (eth).
|
||
| 48 | * Example:
|
||
| 49 | * int dma_buffer[128] ETH_RAM;
|
||
| 50 | *
|
||
| 51 | * @note The eth is a dedicated memory block with its own DMA controller.
|
||
| 52 | */
|
||
| 53 | #define ETH_RAM __attribute__((section(".ram2"), aligned(4))) |
||
| 54 | |||
| 55 | /*
|
||
| 56 | * @brief Makro to store data in the backup memory (bckp).
|
||
| 57 | * Example:
|
||
| 58 | * int backup_buffer[128] BCKP_RAM;
|
||
| 59 | *
|
||
| 60 | * @note The eth is a dedicated memory block with its own DMA controller.
|
||
| 61 | */
|
||
| 62 | #define BCKP_RAM __attribute__((section(".ram5"), aligned(4))) |
||
| 63 | |||
| 64 | /** @} */
|
||
| 65 | |||
| 66 | /*===========================================================================*/
|
||
| 67 | /**
|
||
| 68 | * @name ChibiOS/HAL configuration
|
||
| 69 | * @{
|
||
| 70 | */
|
||
| 71 | /*===========================================================================*/
|
||
| 72 | #include <hal.h> |
||
| 73 | |||
| 74 | /**
|
||
| 75 | * @brief ADC driver for reading the system voltage.
|
||
| 76 | */
|
||
| 77 | #define MODULE_HAL_ADC_VSYS ADCD1
|
||
| 78 | |||
| 79 | /**
|
||
| 80 | * @brief Configuration for the ADC.
|
||
| 81 | */
|
||
| 82 | extern ADCConversionGroup moduleHalAdcVsysConversionGroup;
|
||
| 83 | |||
| 84 | /**
|
||
| 85 | * @brief CAN driver to use.
|
||
| 86 | */
|
||
| 87 | #define MODULE_HAL_CAN CAND1
|
||
| 88 | |||
| 89 | /**
|
||
| 90 | * @brief Configuration for the CAN driver.
|
||
| 91 | */
|
||
| 92 | extern CANConfig moduleHalCanConfig;
|
||
| 93 | |||
| 94 | /**
|
||
| 95 | * @brief I2C driver to access multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery).
|
||
| 96 | */
|
||
| 97 | #define MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR I2CD1
|
||
| 98 | |||
| 99 | /**
|
||
| 100 | * @brief Configuration for the multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery) I2C driver.
|
||
| 101 | */
|
||
| 102 | extern I2CConfig moduleHalI2cProxPm18Pm33GaugeRearConfig;
|
||
| 103 | |||
| 104 | /**
|
||
| 105 | * @brief I2C driver to access multiplexer, proximity sensors 5 to 8, power monitors for VSYS4.2, VIO 5.0 and VDD, EEPROM, touch sensor, and fuel gauge (front battery).
|
||
| 106 | */
|
||
| 107 | #define MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT I2CD2
|
||
| 108 | |||
| 109 | /**
|
||
| 110 | * @brief Configuration for the multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery) I2C driver.
|
||
| 111 | */
|
||
| 112 | extern I2CConfig moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig;
|
||
| 113 | |||
| 114 | /**
|
||
| 115 | * @brief PWM driver for the buzzer.
|
||
| 116 | */
|
||
| 117 | #define MODULE_HAL_PWM_BUZZER PWMD3
|
||
| 118 | |||
| 119 | /**
|
||
| 120 | * @brief Configuration of the PWM driver.
|
||
| 121 | */
|
||
| 122 | extern PWMConfig moduleHalPwmBuzzerConfig;
|
||
| 123 | |||
| 124 | /**
|
||
| 125 | * @brief PWM channeö for the buzzer.
|
||
| 126 | */
|
||
| 127 | #define MODULE_HAL_PWM_BUZZER_CHANNEL 1 |
||
| 128 | |||
| 129 | /**
|
||
| 130 | * @brief Serial driver of the programmer interface.
|
||
| 131 | */
|
||
| 132 | #define MODULE_HAL_PROGIF SD1
|
||
| 133 | |||
| 134 | /**
|
||
| 135 | * @brief Configuration for the programmer serial interface driver.
|
||
| 136 | */
|
||
| 137 | extern SerialConfig moduleHalProgIfConfig;
|
||
| 138 | |||
| 139 | 8399aeae | Thomas Schöpping | /**
|
| 140 | * @brief Real-Time Clock driver.
|
||
| 141 | */
|
||
| 142 | #define MODULE_HAL_RTC RTCD1
|
||
| 143 | |||
| 144 | e545e620 | Thomas Schöpping | /** @} */
|
| 145 | |||
| 146 | /*===========================================================================*/
|
||
| 147 | /**
|
||
| 148 | * @name GPIO definitions
|
||
| 149 | * @{
|
||
| 150 | */
|
||
| 151 | /*===========================================================================*/
|
||
| 152 | #include <amiro-lld.h> |
||
| 153 | |||
| 154 | /**
|
||
| 155 | * @brief SYS_REG_EN output signal GPIO.
|
||
| 156 | */
|
||
| 157 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioSysRegEn;
|
| 158 | e545e620 | Thomas Schöpping | |
| 159 | /**
|
||
| 160 | * @brief IR_INT1 input signal GPIO.
|
||
| 161 | */
|
||
| 162 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioIrInt1;
|
| 163 | e545e620 | Thomas Schöpping | |
| 164 | /**
|
||
| 165 | * @brief POWER_EN output signal GPIO.
|
||
| 166 | */
|
||
| 167 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioPowerEn;
|
| 168 | e545e620 | Thomas Schöpping | |
| 169 | /**
|
||
| 170 | * @brief SYS_UART_DN bidirectional signal GPIO.
|
||
| 171 | */
|
||
| 172 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioSysUartDn;
|
| 173 | e545e620 | Thomas Schöpping | |
| 174 | /**
|
||
| 175 | * @brief CHARGE_STAT2A input signal GPIO.
|
||
| 176 | */
|
||
| 177 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioChargeStat2A;
|
| 178 | e545e620 | Thomas Schöpping | |
| 179 | /**
|
||
| 180 | * @brief GAUGE_BATLOW2 input signal GPIO.
|
||
| 181 | */
|
||
| 182 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioGaugeBatLow2;
|
| 183 | e545e620 | Thomas Schöpping | |
| 184 | /**
|
||
| 185 | * @brief GAUGE_BATGD2 input signal GPIO.
|
||
| 186 | */
|
||
| 187 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioGaugeBatGd2;
|
| 188 | e545e620 | Thomas Schöpping | |
| 189 | /**
|
||
| 190 | * @brief LED output signal GPIO.
|
||
| 191 | */
|
||
| 192 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioLed;
|
| 193 | e545e620 | Thomas Schöpping | |
| 194 | /**
|
||
| 195 | * @brief SYS_UART_UP bidirectional signal GPIO.
|
||
| 196 | */
|
||
| 197 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioSysUartUp;
|
| 198 | e545e620 | Thomas Schöpping | |
| 199 | /**
|
||
| 200 | * @brief CHARGE_STAT1A input signal GPIO.
|
||
| 201 | */
|
||
| 202 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioChargeStat1A;
|
| 203 | e545e620 | Thomas Schöpping | |
| 204 | /**
|
||
| 205 | * @brief GAUGE_BATLOW1 input signal GPIO.
|
||
| 206 | */
|
||
| 207 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioGaugeBatLow1;
|
| 208 | e545e620 | Thomas Schöpping | |
| 209 | /**
|
||
| 210 | * @brief GAUGE_BATGD1 input signal GPIO.
|
||
| 211 | */
|
||
| 212 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioGaugeBatGd1;
|
| 213 | e545e620 | Thomas Schöpping | |
| 214 | /**
|
||
| 215 | * @brief CHARG_EN1 output signal GPIO.
|
||
| 216 | */
|
||
| 217 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioChargeEn1;
|
| 218 | e545e620 | Thomas Schöpping | |
| 219 | /**
|
||
| 220 | * @brief IR_INT2 input signal GPIO.
|
||
| 221 | */
|
||
| 222 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioIrInt2;
|
| 223 | e545e620 | Thomas Schöpping | |
| 224 | /**
|
||
| 225 | * @brief TOUCH_INT input signal GPIO.
|
||
| 226 | */
|
||
| 227 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioTouchInt;
|
| 228 | e545e620 | Thomas Schöpping | |
| 229 | /**
|
||
| 230 | * @brief SYS_DONE input signal GPIO.
|
||
| 231 | */
|
||
| 232 | 1e5f7648 | Thomas Schöpping | extern apalControlGpio_t moduleGpioSysDone;
|
| 233 | e545e620 | Thomas Schöpping | |
| 234 | /**
|
||
| 235 | * @brief SYS_PROG output signal GPIO.
|
||
| 236 |