This commit is contained in:
2025-05-13 04:55:13 +03:00
parent 3f693566bd
commit ceb6d0ccec
4364 changed files with 2897163 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
/*
* bmp180_stm32_hw.h
*
* Created on: 3 îêò. 2016 ã.
* Author: l-pro
*/
#ifndef BMP180_STM32_HW_H_
#define BMP180_STM32_HW_H_
#include "stm32f4xx_hal.h"
extern I2C_HandleTypeDef hi2c3;
struct Bmp180Stm32Interface {
static void delayUs(uint32_t us){
HAL_Delay((us + 999) / 1000);
}
static uint8_t read8(uint8_t deviceAddress, uint8_t address) {
uint8_t result = 0;
HAL_I2C_Master_Transmit(&hi2c3, deviceAddress, &address, 1, HAL_MAX_DELAY);
HAL_I2C_Master_Receive(&hi2c3, deviceAddress, &result, 1, HAL_MAX_DELAY);
return result;
}
static void read16(uint8_t deviceAddress, uint8_t address, uint16_t* data) {
HAL_I2C_Master_Transmit(&hi2c3, deviceAddress, &address, 1, HAL_MAX_DELAY);
HAL_I2C_Master_Receive(&hi2c3, deviceAddress, reinterpret_cast<uint8_t*>(data), 2, HAL_MAX_DELAY);
//swap bytes
*data = (((*data) & 0xff) << 8) | (((*data) & 0xff00) >> 8);
}
static void write8(uint8_t deviceAddress, uint8_t address, uint8_t data){
uint8_t bytes[] = {address, data};
HAL_I2C_Master_Transmit(&hi2c3, deviceAddress, &bytes[0], 2, HAL_MAX_DELAY);
}
};
#endif /* BMP180_STM32_HW_H_ */
+17
View File
@@ -0,0 +1,17 @@
/*
* board.h
*
* Created on: 11 ÿíâ. 2016 ã.
* Author: Sergey
*/
#ifndef BOARD_H_
#define BOARD_H_
#include "hal_library.h"
#define UART_STDIO
#define CONSOLE_UART huart3
extern UART_HandleTypeDef CONSOLE_UART;
#endif /* BOARD_H_ */
+15
View File
@@ -0,0 +1,15 @@
/*
* debug.h
*
* Created on: 4 îêò. 2016 ã.
* Author: l-pro
*/
#ifndef DEBUG_H_
#define DEBUG_H_
#define ASSERT(__expr) if(!(__expr)){for(;;){}}
#endif /* DEBUG_H_ */