Using ChibiOS's I2C driver standalone
Using ChibiOS's I2C driver standalone
I discovered that ChibiOS's I2C driver is much better than the one I'm currently using in my project. I am investigating whether it's feasible to convert my entire project to use ChibiOS, but I would like to start using its I2C driver immediately because it's so good. What modifications would I need to make to it in order to make it work without the rest of ChibiOS?
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Using ChibiOS's I2C driver standalone
Hi, e_l_tang
I thinks the starting point to use is the low device driver (hal_i2c_lld.h and hal_i2c_lld.c). You would then have a lot of dependencies from other files to resolve.
Just a recommendation, for me, it would be better to use the whole chibios in your project, why just use i2c driver?
I thinks the starting point to use is the low device driver (hal_i2c_lld.h and hal_i2c_lld.c). You would then have a lot of dependencies from other files to resolve.
Just a recommendation, for me, it would be better to use the whole chibios in your project, why just use i2c driver?
regards,
Theo.
Theo.
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: Using ChibiOS's I2C driver standalone
Ok, thanks for all those details.
I sow that Giovanni give you a lot of advice about how to manage your project . So now just go on and import your project to ChibiOS step by step.
I sow that Giovanni give you a lot of advice about how to manage your project . So now just go on and import your project to ChibiOS step by step.
regards,
Theo.
Theo.
Re: Using ChibiOS's I2C driver standalone
Another question: would it be possible to use an Arduino library with ChibiOS, if it does things like accessing peripherals directly, enabling and disabling interrupts, etc.? For your information the library I'm thinking of is FastLED.
- 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: Using ChibiOS's I2C driver standalone
Hi,
Usually Arduino libraries are not written with an RTOS in mind, disabling/enabling interrupts can create anomalies in scheduling if not done properly. Polling is another issue.
The answer is: it depends. You need to find out for each library.
Giovanni
Usually Arduino libraries are not written with an RTOS in mind, disabling/enabling interrupts can create anomalies in scheduling if not done properly. Polling is another issue.
The answer is: it depends. You need to find out for each library.
Giovanni
Re: Using ChibiOS's I2C driver standalone
Seeing that even the maintainer of the library does not know I guess my only choice is to try it and find out. Is there still a possibility for issues if my application has only a single thread?
- 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: Using ChibiOS's I2C driver standalone
A single thread is usually fine, the only problem could arise from disabling interrupts.
There is an approach for using code in a single thread that is then used by other threads:
You can encapsulate your library in a server thread, this thread receives messages from other threads, perform an action on the library then returns an answer. Using synchronous messages this is pretty simple. This works because the code is used only by the server so it works even if it is not reentrant.
Giovanni
There is an approach for using code in a single thread that is then used by other threads:
You can encapsulate your library in a server thread, this thread receives messages from other threads, perform an action on the library then returns an answer. Using synchronous messages this is pretty simple. This works because the code is used only by the server so it works even if it is not reentrant.
Giovanni
Re: Using ChibiOS's I2C driver standalone
I've done it! Would it be okay if I shared the driver on GitHub for the benefit of the AVR community?
- 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:
Who is online
Users browsing this forum: No registered users and 5 guests