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.
Digital pressure sensor Driver
- 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
Hi,
currently there is no guide. ChibiOS/EX is still in a early stage, definitely not consolidated. We will improve this part.
Ciao,
RM
currently there is no guide. ChibiOS/EX is still in a early stage, definitely not consolidated. We will improve this part.
Ciao,
RM
- 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
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
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
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Digital pressure sensor Driver
Hi,
Feel free to propose a base class along the lines of the existing ones.
Giovanni
Feel free to propose a base class along the lines of the existing ones.
Giovanni
- 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
Hi,
For the moment I was thinking as Giovanni suggest,
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
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
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Digital pressure sensor Driver
The idea is to abstract peripherals, so you have to invent an abstract interface for barometers.
In general, try to keep it simple.
Giovanni
In general, try to keep it simple.
Giovanni
- 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
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 :
Thanks Theo.
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
Thanks Theo.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Digital pressure sensor Driver
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
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
Who is online
Users browsing this forum: No registered users and 16 guests