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
Diff: examples/drvdiag/driver_wrapper/cn0357_diag.cpp
- Revision:
- 7:b62398a1d17a
- Child:
- 8:6e96c6b3c83f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/drvdiag/driver_wrapper/cn0357_diag.cpp Wed Apr 20 16:35:44 2016 +0300 @@ -0,0 +1,32 @@ +#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)); +}