AP_Baro: added dummy driver

useful for board bringup
This commit is contained in:
Andrew Tridgell 2020-01-16 17:51:11 +11:00
parent f7a65afa67
commit 4d24aa43db
3 changed files with 34 additions and 0 deletions

View File

@ -42,6 +42,7 @@
#include "AP_Baro_FBM320.h"
#include "AP_Baro_DPS280.h"
#include "AP_Baro_BMP388.h"
#include "AP_Baro_Dummy.h"
#if HAL_WITH_UAVCAN
#include "AP_Baro_UAVCAN.h"
#endif

View File

@ -0,0 +1,13 @@
#include "AP_Baro_Dummy.h"
AP_Baro_Dummy::AP_Baro_Dummy(AP_Baro &baro) :
AP_Baro_Backend(baro)
{
_instance = _frontend.register_sensor();
}
// Read the sensor
void AP_Baro_Dummy::update(void)
{
_copy_to_frontend(0, 91300, 21);
}

View File

@ -0,0 +1,20 @@
/*
dummy backend barometer. Used during board bringup. Selected using
BARO line in hwdef.dat
*/
#pragma once
#include "AP_Baro_Backend.h"
class AP_Baro_Dummy : public AP_Baro_Backend
{
public:
AP_Baro_Dummy(AP_Baro &baro);
void update(void) override;
static AP_Baro_Backend *probe(AP_Baro &baro) {
return new AP_Baro_Dummy(baro);
}
private:
uint8_t _instance;
};