mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-ms56xx.git
synced 2025-08-06 13:27:34 +00:00
Finish writing the driver; Still needs testing and debugging
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#define STA_SENSORS_MS5607_HPP
|
||||
|
||||
#include<sta/spi/device.hpp>
|
||||
#include<sta/endian.hpp>
|
||||
#include<sta/stm32/delay.hpp>
|
||||
|
||||
namespace sta {
|
||||
class MS5607 {
|
||||
@@ -14,19 +16,40 @@ namespace sta {
|
||||
_4096 = 4
|
||||
};
|
||||
|
||||
MS5607(SpiDevice* device, OsrLevel osr);
|
||||
|
||||
int32_t getPressure();
|
||||
int32_t getTemperature();
|
||||
|
||||
void changeOsrLevel(OsrLevel newOsr) { this->osr_ = newOsr; }
|
||||
|
||||
private:
|
||||
SpiDevice* device_;
|
||||
OsrLevel osr_;
|
||||
|
||||
uint16_t sens, off, tcs, tco, t_ref, tempsens;
|
||||
|
||||
enum Operations {
|
||||
RESET = 0x1E,
|
||||
READ_PROM = 0xA0,
|
||||
READ_PROM = 0xA2,
|
||||
D1_CONVERSION = 0x40,
|
||||
D2_CONVERSION = 0x50,
|
||||
ADC_RESULT = 0x00
|
||||
};
|
||||
|
||||
uint32_t readPressure();
|
||||
uint32_t readTemp();
|
||||
int32_t calculatePressure(uint32_t d1, int32_t dT);
|
||||
int32_t calculateTemperature(uint32_t d2);
|
||||
|
||||
void reset();
|
||||
void readPROM();
|
||||
|
||||
// Take first bytes from buffer, swap them and store those in uint16_t
|
||||
static uint16_t uint_8BufferTouint16_t(uint8_t* buffer);
|
||||
|
||||
const char RESET_DELAY = 2800; // in uS
|
||||
const char ADC_DELAY = 8220; // in uS; not sure if thats correct since the datasheet doesn't say anything explicitly
|
||||
};
|
||||
|
||||
}
|
||||
|
6
include/sta/config.hpp
Normal file
6
include/sta/config.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// Needed for sta/endian.hpp
|
||||
#define STA_MCU_LITTLE_ENDIAN
|
||||
|
||||
// Needed for sta/stm32/delay.hpp
|
||||
#define STA_PLATFORM_STM32
|
||||
#define STA_STM32_DELAY_US_TIM
|
Reference in New Issue
Block a user