ABP: Making driver generic

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Abhishek Malik
2017-04-04 13:38:28 -07:00
parent 336251740d
commit 8d43c431f2
19 changed files with 544 additions and 354 deletions

View File

@ -151,7 +151,7 @@ add_example (enc03r)
add_example (nunchuck)
add_example (bno055)
add_example (bmp280)
add_example (abpdrrt005pg2a5)
add_example (abp)
add_example (lcdks)
add_example (bmg160)
add_example (bma250e)

View File

@ -27,29 +27,24 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "abpdrrt005pg2a5.h"
#include "abp.h"
#include "upm_utilities.h"
int main()
{
abpdrrt005pg2a5_context dev = abpdrrt005pg2a5_init(0, ABPDRRT005PG2A5_ADDRESS);
abp_context dev = abp_init(0, ABP_DEFAULT_ADDRESS);
if(dev == NULL) {
printf("Unable to initialize sensor\n");
return 0;
}
float psi = 0;
float pascal = 0;
while(1){
if(abpdrrt005pg2a5_get_pressure_psi(dev, &psi) != UPM_SUCCESS){
printf("error in retrieving the psi value\n");
}
if(abpdrrt005pg2a5_get_pressure_pascal(dev, &pascal) != UPM_SUCCESS){
printf("error in retrieving the pascal value\n");
}
abp_update(dev);
printf("Retrieved pressure value: %f\n", abp_get_pressure(dev));
printf("Retrieved temperature value: %f\n", abp_get_temperature(dev));
upm_delay(1);
printf("PSI Value: %f and Pascal Value: %f\n", psi, pascal);
}
return 0;
}
}