Digital pressure sensor Driver

Discussions and support about ChibiOS/EX, the External Peripherals Abstraction Layer.
User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Sun Jun 05, 2016 3:12 pm

Hi Giovanni, RM, all,

Here is a patch for the BMP085 Digital pressure sensor ex sub-project support.
To resume the action of the patch:
- Creation of two HAL classes: hal_barometer and hal_thermometer. Those classes are a bit different to the zip a send last time.
- Creation of the os/ex/Bosch folder with the driver files (bmp085.c, bmp085.h and bmp085.mk)
- Creation of a demo in testhal/STM32/STM32F4xx/I2C-BMP085/

There is still a lot of work :mrgreen: , but I need your point of view to improve my current work. All comment are welcome
Attachments
01-bmp085-patch.zip
(16.91 KiB) Downloaded 279 times

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Sun Jun 05, 2016 3:39 pm

In barometer and temperature class there are missed calibration methods (set_bias, reset_bias, set_sensitivity, reset_sensitivity).

Code: Select all

/**
 * @name    Macro Functions (BaseBarometer)
 * @{
 */
/**
 * @brief   Barometer get axes number.
 *
 * @param[in] ip        pointer to a @p BaseBarometer class.
 * @return              The number of axes of the BaseSensor
 *
 * @api
 */
#define barometerGetAxesNumber(ip)                                           \
        (ip)->vmt_basebarometer->get_axes_number(ip)

Now it is get_channels_number

Code: Select all

/**
 * @brief   BaseBarometer specific methods.
 */
#define _base_barometer_methods_alone                                        \
  /* Invoke the get pressure data.*/                                         \
  msg_t (*get_pressure)(void *instance, int32_t pressure[]);

This is redundant. You already have the read_raw and read_cooked methods in the basesensor class and barometer/thermometer extend this class.

Take a look to LSM303DLHC. Here I have 3 VMT

Code: Select all

/**
 * @brief   LSM303DLHC 6-axis accelerometer/compass class.
 */
struct LSM303DLHCDriver {
  /** @brief BaseSensor Virtual Methods Table. */
  const struct BaseSensorVMT *vmt_basesensor;
  /** @brief BaseAccelerometer Virtual Methods Table. */
  const struct BaseAccelerometerVMT *vmt_baseaccelerometer;
  /** @brief BaseCompass Virtual Methods Table. */
  const struct BaseCompassVMT *vmt_basecompass;
  /** @brief LSM303DLHC Accelerometer Virtual Methods Table. */
  const struct LSM303DLHCACCVMT *vmt_lsm303dlhcacc;
  /** @brief LSM303DLHC Compass Virtual Methods Table. */
  const struct LSM303DLHCCOMPVMT *vmt_lsm303dlhccomp;
  _lsm303dlhc_data
};


using vmt_lsm303dlhcacc->read_raw I am able to read raw data from accelermeter only
using vmt_lsm303dlhccomp->read_raw I am able to read raw data from compass only
using vmt_basesensor->read_raw I am able to read raw data from both subsystems

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Sun Jun 05, 2016 5:53 pm

Hi RM,

Thanks for those details, i will correct that tomorrow and send back a patch when ready.

regards,

Theo.

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Sun Jun 05, 2016 5:56 pm

I will edit and commit both classes for barometer and thermometer by the end of the day.
Is this ok to you?
Ciao,
RM

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon Jun 06, 2016 12:33 am

Hi RM,

Yes it is ok for me :mrgreen: .

Please tell me when commited. I will get the last version and work with.

ciao,

Theo

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Mon Jun 06, 2016 7:59 pm

Hi Theo,
I have added three new classes on trunk: hygrometer, barometer and thermometer. They are completely identical on accelerometer/magnetometer classes except for that convention already discussed (axes/channels).

I am intentioned to restyle current MEMS implementation simplifying code, optimizing code in certain points and improving configuration structures (enabling user to set-up interrupt registers). Even more I will introduce support for a barometer (LPS25H) and for a hygrometer/thermometer (HTS221) both from ST.

I will make these edits in the next 48h. I suggest you to take a look to new version of device driver before to develop your own driver.
Ciao,
RM

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon Jun 06, 2016 8:42 pm

Hi RM,

Thanks for your feedback. I will then wait the new version of the driver and port and update what I have done according to the new implementation.

Did you take a look at my driver code?

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Mon Jun 06, 2016 8:45 pm

Honestly last time I saw only sensor classes. I will take a look to driver implementation as soon I have some spare time. Fore sure I will take a deep look into before to add it to trunk.
Thanks a lot for your contribution and your patience.
Ciao,
RM

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon Jun 06, 2016 9:05 pm

ok, I will send another patch for the driver and a demo after new port. It will be interesting to have a look at the last version maybe.

It is a pleasure to contribute to the project, it is my way to say thank you.

I'm also learning at the same time :D

regards,

Theo

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon Jun 06, 2016 10:20 pm

I just remark that in the trunk the readme file don't show the existace of the ex repository for the moment.
It shows rt, nil hal but not ex.

regads

Theo


Return to “ChibiOS/EX”

Who is online

Users browsing this forum: No registered users and 14 guests