Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / PowerManagement_1-1 / module.h @ bffb3465

History | View | Annotate | Download (30.879 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 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 1c1b3372 Thomas Schöpping
/**
38 e545e620 Thomas Schöpping
 * @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 1c1b3372 Thomas Schöpping
#define CCM_RAM(...)                            __attribute__((section(".ram4"), ##__VA_ARGS__))
45 e545e620 Thomas Schöpping
46 1c1b3372 Thomas Schöpping
/**
47 e545e620 Thomas Schöpping
 * @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 1c1b3372 Thomas Schöpping
#define ETH_RAM(...)                            __attribute__((section(".ram2"), ##__VA_ARGS__))
54 e545e620 Thomas Schöpping
55 1c1b3372 Thomas Schöpping
/**
56 e545e620 Thomas Schöpping
 * @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 1c1b3372 Thomas Schöpping
#define BCKP_RAM(...)                           __attribute__((section(".ram5"), ##__VA_ARGS__))
63 e545e620 Thomas Schöpping
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 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).
96
 * @details Depending on the attached sensor ring, the devices connected to this bus vary:
97
 *          ProximitySensor:
98
 *            - I2C multiplexer (PCA9544A)
99
 *            - proximity sensors (VCNL4020) #1 - #4
100
 *          DistanceSensor (VL53L0X):
101
 *            TODO
102
 *          DistanceSensor (VL53L1X):
103
 *            TODO
104
 */
105
#define MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR   I2CD1
106
107
/**
108
 * @brief   Configuration for the sensor ring, power monitors for VIO1.8 and VIO3.3, and fuel gauge (rear battery) I2C driver.
109
 * @details Depending on the attached sensor ring, the devices connected to this bus vary:
110
 *          ProximitySensor:
111
 *            - I2C multiplexer (PCA9544A)
112
 *            - proximity sensors (VCNL4020) #1 - #4
113
 *          DistanceSensor (VL53L0X):
114
 *            TODO
115
 *          DistanceSensor (VL53L1X):
116
 *            TODO
117
 */
118
extern I2CConfig moduleHalI2cSrPm18Pm33GaugeRearConfig;
119
120
/**
121
 * @brief   I2C driver to access the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery).
122
 * @details Depending on the attached sensor ring, the devices connected to this bus vary:
123
 *          ProximitySensor:
124
 *            - I2C multiplexer (PCA9544A)
125
 *            - proximity sensors (VCNL4020) #1 - #4
126
 *            - touch sensor (MPR121)
127
 *          DistanceSensor (VL53L0X):
128
 *            TODO
129
 *          DistanceSensor (VL53L1X):
130
 *            TODO
131
 */
132
#define MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT I2CD2
133
134
/**
135
 * @brief   Configuration for the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery) I2C driver.
136
 * @details Depending on the attached sensor ring, the devices connected to this bus vary:
137
 *          ProximitySensor:
138
 *            - I2C multiplexer (PCA9544A)
139
 *            - proximity sensors (VCNL4020) #1 - #4
140
 *            - touch sensor (MPR121)
141
 *          DistanceSensor (VL53L0X):
142
 *            TODO
143
 *          DistanceSensor (VL53L1X):
144
 *            TODO
145
 */
146
extern I2CConfig moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig;
147 e545e620 Thomas Schöpping
148
/**
149
 * @brief   PWM driver for the buzzer.
150
 */
151
#define MODULE_HAL_PWM_BUZZER                   PWMD3
152
153
/**
154
 * @brief   Configuration of the PWM driver.
155
 */
156
extern PWMConfig moduleHalPwmBuzzerConfig;
157
158
/**
159
 * @brief   PWM channeö for the buzzer.
160
 */
161
#define MODULE_HAL_PWM_BUZZER_CHANNEL           1
162
163
/**
164
 * @brief   Serial driver of the programmer interface.
165
 */
166
#define MODULE_HAL_PROGIF                       SD1
167
168
/**
169
 * @brief   Configuration for the programmer serial interface driver.
170
 */
171
extern SerialConfig moduleHalProgIfConfig;
172
173 8399aeae Thomas Schöpping
/**
174
 * @brief   Real-Time Clock driver.
175
 */
176
#define MODULE_HAL_RTC                          RTCD1
177
178 e545e620 Thomas Schöpping
/** @} */
179
180
/*===========================================================================*/
181
/**
182
 * @name GPIO definitions
183
 * @{
184
 */
185
/*===========================================================================*/
186 8be006e0 Thomas Schöpping
#include <periphALtypes.h>
187 e545e620 Thomas Schöpping
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
 */
231