A collection of Analog Devices drivers for the mbed platform

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

examples/drvdiag/driver_wrapper/cn0357_diag.cpp

Committer:
Adrian Suciu
Date:
2016-04-20
Revision:
7:b62398a1d17a
Child:
8:6e96c6b3c83f

File content as of revision 7:b62398a1d17a:

#include "mbed.h"
#include <stdio.h>
#include <vector>
#include <string>
#include "CN0357_Diag.h"

extern Serial pc;
extern vector<string> cmdbuffer;

CN0357_Diag::CN0357_Diag(CN0357& cn) : dut(cn)
{

}
void CN0357_Diag::set_RDAC()
{
    float res = strtof(cmdbuffer[1].c_str(), NULL);
    dut.set_RDAC_value(res);
    pc.printf("Wrote %f", res);

}
void CN0357_Diag::read_ppm(void)
{
    pc.printf("Wrote %f", dut.read_ppm());
}

void CN0357_Diag::set_sensor_param(void)
{
    float range = strtof(cmdbuffer[1].c_str(), NULL);
    float sens = strtof(cmdbuffer[2].c_str(), NULL);
    sens = sens * pow(10, -9);
    pc.printf("Suggested RDAC val: %f ", dut.set_sensor_parameters(range, sens));
}