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