lkml.org 
[lkml]   [2024]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v4 2/6] iio: pressure: bmp280: Refactorize reading functions
    On Sun,  7 Apr 2024 19:29:16 +0200
    Vasileios Amoiridis <vassilisamir@gmail.com> wrote:

    > For BMP18x, BMP28x, BME280, BMP38x the reading of the pressure
    > value requires an update of the t_fine variable which happens
    > through reading the temperature value.
    >
    > So all the bmpxxx_read_press() functions of the above sensors
    > are internally calling the equivalent bmpxxx_read_temp() function
    > in order to update the t_fine value. By just looking at the code
    > this functionality is a bit hidden and is not easy to understand
    > why those channels are not independent.
    >
    > This commit tries to clear these things a bit by splitting the
    > bmpxxx_{read/compensate}_{temp/press/humid}() to the following:
    >
    > i. bmpxxx_read_{temp/press/humid}_adc(): read the raw value from
    > the sensor.
    >
    > ii. bmpxx_calc_t_fine(): calculate the t_fine variable.
    >
    > iii. bmpxxx_get_t_fine(): get the t_fine variable.
    >
    > iv. bmpxxx_compensate_{temp/press/humid}(): compensate the adc
    > values and return the calculated value.
    >
    > v. bmpxxx_read_{temp/press/humid}(): combine calls of the
    > aforementioned functions to return the requested value.
    >
    > Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    > Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
    Looks good to me. Thanks for tidying this up.


    \
     
     \ /
      Last update: 2024-05-27 16:40    [W:2.268 / U:1.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site