mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
barosim: revamp driver
Current driver was copy pasted from a MS5611 driver. The existing driver takes data from Simulator, not from an actual device. Signed-off-by: Nicolae Rosia <nicolae.rosia@gmail.com>
This commit is contained in:
committed by
Julian Oes
parent
4ccbeb47c0
commit
67987d27d8
File diff suppressed because it is too large
Load Diff
@@ -34,48 +34,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file barosim.h
|
* @file barosim.h
|
||||||
*
|
*
|
||||||
* Shared defines for the ms5611 driver.
|
* A simulated Barometer.
|
||||||
*/
|
*/
|
||||||
#include "VirtDevObj.hpp"
|
#include "VirtDevObj.hpp"
|
||||||
|
|
||||||
#define ADDR_RESET_CMD 0x1E /* write to this address to reset chip */
|
|
||||||
#define ADDR_CMD_CONVERT_D1 0x48 /* write to this address to start pressure conversion */
|
|
||||||
#define ADDR_CMD_CONVERT_D2 0x58 /* write to this address to start temperature conversion */
|
|
||||||
#define ADDR_DATA 0x00 /* address of 3 bytes / 32bit pressure data */
|
|
||||||
#define ADDR_PROM_SETUP 0xA0 /* address of 8x 2 bytes factory and calibration data */
|
|
||||||
#define ADDR_PROM_C1 0xA2 /* address of 6x 2 bytes calibration data */
|
|
||||||
|
|
||||||
/* interface ioctls */
|
|
||||||
#define IOCTL_RESET 2
|
|
||||||
#define IOCTL_MEASURE 3
|
|
||||||
|
|
||||||
namespace barosim
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calibration PROM as reported by the device.
|
|
||||||
*/
|
|
||||||
#pragma pack(push,1)
|
|
||||||
struct prom_s {
|
|
||||||
uint16_t factory_setup;
|
|
||||||
uint16_t c1_pressure_sens;
|
|
||||||
uint16_t c2_pressure_offset;
|
|
||||||
uint16_t c3_temp_coeff_pres_sens;
|
|
||||||
uint16_t c4_temp_coeff_pres_offset;
|
|
||||||
uint16_t c5_reference_temp;
|
|
||||||
uint16_t c6_temp_coeff_temp;
|
|
||||||
uint16_t serial_and_crc;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grody hack for crc4()
|
|
||||||
*/
|
|
||||||
union prom_u {
|
|
||||||
uint16_t c[8];
|
|
||||||
prom_s s;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
extern bool crc4(uint16_t *n_prom);
|
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|||||||
Reference in New Issue
Block a user