Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino abstraction layer #22

Open
10 of 16 tasks
noah1510 opened this issue Jan 13, 2021 · 4 comments
Open
10 of 16 tasks

Arduino abstraction layer #22

noah1510 opened this issue Jan 13, 2021 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@noah1510
Copy link
Owner

noah1510 commented Jan 13, 2021

One of the features that could increase compatibility to almost 100% would be to write a custom SPI Arduino layer.
Except for Arduino.h and SPI.h are the only dependencies, but they do not exist for a lot of board (eq. raspberry PI).
A custom Arduino layer would always use 'software' SPI if there is no hardware support or try to use another SPI implementation.
Like the rest of the LedController v2+, it should be implemented as header only code, maybe even as singleton.
This Layer should be the only place that is depended on Hardware specific code.
In the future this layer may be used to allow more frameworks/boards to work with this library.

The header of this layer should define a generic interface, while the source files handle the platform specific implementation of that generic interface.
The library will not be portable from one platform to the next without recompiling but this makes a lot of code simpler

The features it needs to implement are the following:

  • have a generic Arduino header which provides all of the functions of Arduino.h
  • provide a generic interface to output SPI data with the following functions
    • initilize SPI
    • start transmission
    • send data
    • receive data
    • end transmission
    • uninitilize SPI
    • check for non 0 MOSI and MISO, to have read-only or write only functionality
  • enable hardware SPI if possible
  • provide software SPI as fallback
  • use software SPI for custom pins
  • support raspberry pi
  • write documentation
  • write unit tests
  • move this layer into a separate library and use it as dependency

Help with this appreciated.

@noah1510 noah1510 added the enhancement New feature or request label Jan 13, 2021
@noah1510 noah1510 added this to the v2.1.0 milestone Jan 26, 2021
@noah1510 noah1510 pinned this issue Feb 19, 2021
noah1510 added a commit that referenced this issue May 30, 2021
 This commit starts the work on the Arduino Abstraction by moving
 all of the platform specific includes into separate header files.

 Because of this support for new platforms can be added without
 the need to change anything on the controller. It also cleans up
 a lot of duplicate code, because several places had to check if
 the Arduino platform is available.
@noah1510 noah1510 changed the title SPI abstraction layer Arduino abstraction layer May 30, 2021
@noah1510
Copy link
Owner Author

This feature is developed on the abstraction-layer branch. Look there for the latest state of the code.

noah1510 added a commit that referenced this issue May 30, 2021
 The LedController now uses the SPI abstraction layer.
 Everything should work as before but the code is not
 tested on real hardwawre yet.

 Next up is getting this working on a raspberry pi.
noah1510 added a commit that referenced this issue May 31, 2021
 This commit adds the meson build system and support
 for the raspberry pi using the ArduioRaspi library.

 That library was developed for this specific case so
 there shouldn't be any problems with the LedController
 and it.

 At the moment there is no support for hardware SPI for
 the raspberry pi but that will be added in the near future.
@noah1510
Copy link
Owner Author

LedController now works on the raspberry pi but hardware SPI is not supported yet (it will come soon)

@noah1510
Copy link
Owner Author

noah1510 commented Jun 6, 2021

The abstraction layer is now a separate library.
I will push those changes once the library is accepted in the Arduino Library Manager and can be added as a dependency.

@noah1510
Copy link
Owner Author

noah1510 commented Jun 7, 2021

The changes are now on the abstraction-layer branch.
For some reason the platform io dependencyc manager ignores the dependency on generic-Arduino when pio ci or pio test are used.
Compiling the examples using the build command works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant