Digital pressure sensor Driver

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

Digital pressure sensor Driver

Postby tfAteba » Sun May 22, 2016 9:05 pm

Hello Marco,

I made a small library to read pressure and temperature of the BMP085 Digital pressure sensor from Bosch.

Now I want to write a driver for the new ex/ part of ChibiOS.

Never did a driver before so I need some general advices for implementation. Is there a guide line to follow?

I will take a look on your work for the lsm303dlhc and use it as a base.

Thanks in advance

Theo.

User avatar
RoccoMarco
Posts: 585
Joined: Wed Apr 24, 2013 4:11 pm
Location: Salerno (Italy)
Has thanked: 70 times
Been thanked: 52 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Sun May 22, 2016 10:58 pm

Hi,
currently there is no guide. ChibiOS/EX is still in a early stage, definitely not consolidated. We will improve this part.
Ciao,
RM

User avatar
tfAteba
Posts: 478
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 68 times
Been thanked: 40 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon May 23, 2016 9:26 am

Hi,

It will then be interesting to follow this improvement and even participate if it is possible?


Thanks, Theo

User avatar
RoccoMarco
Posts: 585
Joined: Wed Apr 24, 2013 4:11 pm
Location: Salerno (Italy)
Has thanked: 70 times
Been thanked: 52 times
Contact:

Re: Digital pressure sensor Driver

Postby RoccoMarco » Mon May 23, 2016 9:34 am

Before to create any driver it is required to have the class implementation.

For MEMS as example you have in HAL the basegyroscope, baseaccelerometer and basecompass classes: these class are provided by Giovanni which oversees the whole work. Even more most likely these classes and the implementation could receive future improvement according to user requests/feedbacks.
So it is currently difficult for me to provide a guide about a problem which hasn't been faced yet. Anyway, it is great receive contributions. Do you have an idea about how should be implement a basebarometer class? We can discuss this.
Ciao,
RM

User avatar
Giovanni
Site Admin
Posts: 10818
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 318 times
Been thanked: 268 times
Contact:

Re: Digital pressure sensor Driver

Postby Giovanni » Mon May 23, 2016 9:37 am

Hi,

Feel free to propose a base class along the lines of the existing ones.

Giovanni

User avatar
tfAteba
Posts: 478
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 68 times
Been thanked: 40 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon May 23, 2016 10:22 am

Hi,

Do you have an idea about how should be implement a basebarometer class? We can discuss this.


For the moment I was thinking as Giovanni suggest,
Feel free to propose a base class along the lines of the existing ones.


Create a base class for exemple hal_barometer by looking at an existing one. I saw that all existing refer to hal_sensors but the implemented methods are not suitable for a barometer. So this class will not refer to this file or do I have also to modify this files or make an independent class?

But I'm not sure that it is possible to make a driver for all barometer.

Is the class have to be as generic as possible?

Theo

User avatar
Giovanni
Site Admin
Posts: 10818
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 318 times
Been thanked: 268 times
Contact:

Re: Digital pressure sensor Driver

Postby Giovanni » Mon May 23, 2016 10:29 am

The idea is to abstract peripherals, so you have to invent an abstract interface for barometers.

In general, try to keep it simple.

Giovanni

User avatar
tfAteba
Posts: 478
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 68 times
Been thanked: 40 times

Re: Digital pressure sensor Driver

Postby tfAteba » Mon May 23, 2016 10:53 am

Thanks for the advices, I will start to work on that to night

Theo.

User avatar
tfAteba
Posts: 478
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 68 times
Been thanked: 40 times

Re: Digital pressure sensor Driver

Postby tfAteba » Tue May 24, 2016 9:45 am

Hi,

Before starting the hal_barometer class, I've decided to read some barometer datasheet to try to see if they all have something in common.

Here are some of datasheet for exemple:

https://cdn-shop.adafruit.com/datasheet ... 000-09.pdf

http://www.st.com/content/ccc/resource/ ... 141379.pdf

http://cache.nxp.com/files/sensors/doc/ ... leExt=.pdf

http://cache.nxp.com/files/sensors/doc/ ... leExt=.pdf

So I thinks I will have to implement three methods in the hal_barometer class for the moment :
    read_calibration_data
    read_temperature
    read_pressure
I then need to know if i'm going to a right direction? or if i'm missing something important before to start

Thanks Theo.

User avatar
Giovanni
Site Admin
Posts: 10818
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 318 times
Been thanked: 268 times
Contact:

Re: Digital pressure sensor Driver

Postby Giovanni » Tue May 24, 2016 10:25 am

The approach is correct: gather info first :)

Don't be afraid to get it wrong, probably it will go through several iterations, it always happens. Now I am in my second cycle on the flash driver and I am still not fully satisfied.

Giovanni


Return to “ChibiOS/EX”

Who is online

Users browsing this forum: No registered users and 2 guests