Skip to content

Commit 93cfb91

Browse files
committed
latest bringup code
1 parent eea65c2 commit 93cfb91

File tree

8 files changed

+609
-110
lines changed

8 files changed

+609
-110
lines changed

soccer_firmware/.cproject

+2-16
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,6 @@
209209
</storageModule>
210210
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
211211
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
212-
<storageModule moduleId="scannerConfiguration">
213-
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
214-
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1071476856;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1071476856.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1434796339;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.370155548">
215-
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
216-
</scannerConfigBuildInfo>
217-
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.683473154;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.683473154.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.30071470;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1233310560">
218-
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
219-
</scannerConfigBuildInfo>
220-
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.683473154;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.683473154.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1389884261;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.402515729">
221-
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
222-
</scannerConfigBuildInfo>
223-
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1071476856;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1071476856.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.907636321;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.507996537">
224-
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
225-
</scannerConfigBuildInfo>
226-
</storageModule>
227212
<storageModule moduleId="refreshScope"/>
228-
</cproject>
213+
<storageModule moduleId="scannerConfiguration"/>
214+
</cproject>

soccer_firmware/.mxproject

+1-2
Large diffs are not rendered by default.

soccer_firmware/Core/Inc/BMI088.h

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#ifndef BMI088_IMU_H
2+
#define BMI088_IMU_H
3+
4+
#include "stm32f4xx_hal.h"
5+
#include "main.h"
6+
7+
/* Register defines */
8+
#define BMI_GYR_I2C_ADDRESS 0x68
9+
#define BMI_ACC_I2C_ADDRESS 0x18
10+
11+
#define BMI_ACC_CHIP_ID 0x00
12+
#define BMI_ACC_DATA 0x12
13+
#define BMI_TEMP_DATA 0x22
14+
#define BMI_ACC_CONF 0x40
15+
#define BMI_ACC_RANGE 0x41
16+
#define BMI_INT1_IO_CONF 0x53
17+
#define BMI_INT1_INT2_MAP_DATA 0x58
18+
#define BMI_ACC_PWR_CONF 0x7C
19+
#define BMI_ACC_PWR_CTRL 0x7D
20+
#define BMI_ACC_SOFTRESET 0x7E
21+
22+
#define BMI_GYR_CHIP_ID 0x00
23+
#define BMI_GYR_DATA 0x02
24+
#define BMI_GYR_RANGE 0x0F
25+
#define BMI_GYR_BANDWIDTH 0x10
26+
#define BMI_GYR_SOFTRESET 0x14
27+
#define BMI_GYR_INT_CTRL 0x15
28+
#define BMI_INT3_INT4_IO_CONF 0x16
29+
#define BMI_INT3_INT4_IO_MAP 0x18
30+
31+
typedef struct {
32+
33+
/* I2C */
34+
I2C_HandleTypeDef *m_i2c_handle;
35+
// GPIO_TypeDef *csAccPinBank;
36+
// GPIO_TypeDef *csGyrPinBank;
37+
// uint16_t csAccPin;
38+
// uint16_t csGyrPin;
39+
40+
/* DMA */
41+
uint8_t readingAcc;
42+
uint8_t readingGyr;
43+
uint8_t accTxBuf[8];
44+
uint8_t gyrTxBuf[7];
45+
volatile uint8_t accRxBuf[8];
46+
volatile uint8_t gyrRxBuf[7];
47+
48+
/* Conversion constants (raw to m/s^2 and raw to rad/s) */
49+
float accConversion;
50+
float gyrConversion;
51+
52+
/* x-y-z measurements */
53+
float acc_mps2[3];
54+
float gyr_rps[3];
55+
56+
} BMI088;
57+
58+
/*
59+
*
60+
* INITIALISATION
61+
*
62+
*/
63+
uint8_t BMI088_Init(BMI088 *imu, I2C_HandleTypeDef *m_i2c_handle);
64+
65+
/*
66+
*
67+
* LOW-LEVEL REGISTER FUNCTIONS
68+
*
69+
*/
70+
uint8_t BMI088_ReadAccRegister(BMI088 *imu, uint8_t regAddr, uint8_t *data);
71+
uint8_t BMI088_ReadGyrRegister(BMI088 *imu, uint8_t regAddr, uint8_t *data);
72+
73+
uint8_t BMI088_WriteAccRegister(BMI088 *imu, uint8_t regAddr, uint8_t data);
74+
uint8_t BMI088_WriteGyrRegister(BMI088 *imu, uint8_t regAddr, uint8_t data);
75+
76+
/*
77+
*
78+
* POLLING
79+
*
80+
*/
81+
uint8_t BMI088_ReadAccelerometer(BMI088 *imu);
82+
uint8_t BMI088_ReadGyroscope(BMI088 *imu);
83+
uint8_t readGyroscopeFromBMI088(I2C_HandleTypeDef *hi2c, int16_t *gyroX, int16_t *gyroY, int16_t *gyroZ);
84+
85+
/*
86+
*
87+
* DMA
88+
*
89+
*/
90+
uint8_t BMI088_ReadAccelerometerDMA(BMI088 *imu);
91+
void BMI088_ReadAccelerometerDMA_Complete(BMI088 *imu);
92+
93+
uint8_t BMI088_ReadGyroscopeDMA(BMI088 *imu);
94+
void BMI088_ReadGyroscopeDMA_Complete(BMI088 *imu);
95+
96+
/*
97+
*
98+
* WORKAROUND
99+
*
100+
*/
101+
void generateClocks2(uint8_t num_clocks, uint8_t send_stop_bits);
102+
103+
#endif

0 commit comments

Comments
 (0)