| | |
| | | /* Shall implement delay in milliseconds*/ |
| | | void test_wait_ms(u8 delay) |
| | | { |
| | | printf("Waiting for %dms\n",delay); |
| | | // printf("Waiting for %dms\n",delay); |
| | | } |
| | | struct dps310_state drv_state; |
| | | f64 pressure,temperature; |
| | |
| | | */ |
| | | int ret = dps310_init(&drv_state,&cnn); |
| | | |
| | | printf("init ret val = %d\n",ret); |
| | | // printf("init ret val = %d\n",ret); |
| | | |
| | | /* once sensor is put into background mode |
| | | * pressure and temperature values are available and can be read |
| | |
| | | * and returns computed double precision pressure and temperature value |
| | | */ |
| | | ret = dps310_get_processed_data(&drv_state,&pressure,&temperature); |
| | | printf("get_processed_data ret val = %d, pressure = %lf, temp = %lf\n",ret,pressure,temperature); |
| | | GetPressAndHeight(); |
| | | |
| | | // printf("get_processed_data ret val = %d, pressure = %lf, temp = %lf\n",ret,pressure,temperature); |
| | | |
| | | /*To change configuration we first need to put sensor in |
| | | *idle mode by calling _standby |
| | |
| | | |
| | | return 0; |
| | | } |
| | | void GetPressAndTemp(void) |
| | | float Height; |
| | | float GetPressAndHeight(void) |
| | | { u8 ret; |
| | | |
| | | |
| | | |
| | | /*Instantiate driver state*/ |
| | | |
| | | ret = dps310_get_processed_data(&drv_state,&pressure,&temperature); |
| | | |
| | | Height = 44330 * (1.0 - pow((pressure / 1013.25), (1 / 5.255))); |
| | | if(pressure==0) |
| | | Height = 0; |
| | | return Height; |
| | | //height=PressToHeight(pressure,temperature); |
| | | // printf("get_processed_data ret val = %d, pressure = %lf, temp = %lf\n",ret,pressure,temperature); |
| | | } |