Linux: Added barosim support to simulator

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-20 11:37:50 -07:00
parent 89bc1b86b2
commit 93c39e6d1d
3 changed files with 163 additions and 70 deletions
@@ -50,6 +50,7 @@
#include <unistd.h>
#include <drivers/device/sim.h>
#include <simulator/simulator.h>
#include "barosim.h"
#include "board_config.h"
@@ -201,5 +202,16 @@ BARO_SIM::transfer(const uint8_t *send, unsigned send_len,
{
// TODO add Simulation data connection so calls retrieve
// data from the simulator
if (send_len != 1 || send[0] != 0 || recv_len != 3) {
return 1;
}
else {
Simulator *sim = Simulator::getInstance();
if (sim == NULL) {
return -ENODEV;
}
sim->getBaroSample(recv, recv_len);
}
return 0;
}