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

Portability improvements #14

Open
DzmitryStryzhevich opened this issue Jan 19, 2024 · 3 comments
Open

Portability improvements #14

DzmitryStryzhevich opened this issue Jan 19, 2024 · 3 comments

Comments

@DzmitryStryzhevich
Copy link

DzmitryStryzhevich commented Jan 19, 2024

Is your feature request related to a problem? Please describe.

No response

Describe the idea you'd like

Hello! I think it would be useful to pass a customizable user handle like void* const hwHandle to all SPI interface functions declared in driver_w25qxx_interface.h. This pointer should be assigned by a setter in w25qxx_handle_t structure like that
uint8_t w25qxx_set_hw_handle(w25qxx_handle_t *handle, void *hwHandle). A getter
uint8_t w25qxx_get_hw_handle(w25qxx_handle_t *handle, void **hwHandle) may be useful, too.
image

Rationale: modern MCUs may have several SPI/QSPI hardware interfaces. In this handle approach, we can assign the particular SPI interface to the device. We may simultaneously have several w25qxx devices on the same bus and/or on different buses.
In my opinion, this approach can lead to the significant improvement of the device driver portability for different platforms, because all MCUs chip vendors have incompatible CSP

Describe alternatives you've considered

No response

Additional context

No response

@libdriver
Copy link
Owner

Thank you very much for using LibDriver and providing valuable feedback. Your idea is a good idea, and we believe that the addition of customized handles will greatly improve the flexibility of driver development. We will incorporate your idea in future updates. It should be noted that a very small number of drivers that include state machine management need to be controlled through different driver handles. For example, some drivers have registers that are only written and require the handle to store the current register configuration internally(https://github.com/libdriver/wm8978), while others require the driver handle to record the current driver's state(https://github.com/libdriver/ir_remote).

@DzmitryStryzhevich
Copy link
Author

Thanks a lot for lightning reaction. You are doing a great job. Today, there are not many high-quality platform-agnostic drivers for all kinds of peripherals ICs. Chip manufacturers very often do not provide them. This project is great.

@libdriver
Copy link
Owner

Thank you very much.

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

No branches or pull requests

2 participants