-
Notifications
You must be signed in to change notification settings - Fork 1k
request: Implement getters for internal HAL handle structures or make it public #1035
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
Comments
@stas2z it is already possible to use all HAL module without any Arduino api function by enabled the HAL module Only definition: |
Sure i know about using HAL without arduino api, but it's not a case im talking about here.
here the example how i use it, to allow such link i need an access to internal _spi handle. |
Well, this need to be studied deeply. |
Its working as its a paste from working project, im using dma to write framebuffer to spi lcd |
maybe it can be available as special define with comment 'at own risk' |
yes, it will be reasonable solution |
Yes, look at say Boost.ASIO, where you can get the underlying platform handle using |
i think this including the referenced issue basically is similar However, in addition it turns out i realized where is part of that difficulty, take for instance |
@ag88 |
@stas2z i think those are good ideas, but in the same way i'd guess it'd take an 'api design' somewhat. but this approach actually works and is successful if you observe the design pattern of Adafruit GFX CustomSPI myspi = CustomSPI() and CustomSPI inherits SPIClass along this idea, eventual apis that can be formalized could be declared as virtual functions that needs to be overridden |
Aeduino SPI API compatibility have to be kept. |
hi i think stas2z's ideas is sound and can be considered.
then for methods such as
they can be declared virtual. the notion is so that SPIClass can be overridden with a custom class to provide features that's not otherwise bundled in the 'standard' SPIClass (e.g. dma etc). i think inherited classes probably has various overheads, including more sram use, additional over heads every call etc. but i'd think this may be worth trying so that 'experiments' can be started for additional features with spi.h, spi.cpp such as dma. eventually designs that works across most/all socs can eventually be merged back to the original spi.h, spi.cpp |
I faced the same situation when I needed to access _spi to implement DMA transfer. I did not want to rewrite all the basic SPI code so I followed @ag88 idea and modified the SPIClass to allow derived class, in which I implemented the DMA. @fpistm @ABOSTM, if it is of any interest, you can find the patch to apply this change here If the client code of the library wants to set the SPI global variable to it's own implementation (derived class), then pass The following header and code files demonstrate an example on how to derive SPIClass to implement such DMA feature. |
@ag88 , @jefflessard , |
Could be used for example to mix Arduino API and STM32Cube HAL API. For example to configure DMA. Warning: Use at your own risk Fixes stm32duino#1035 Signed-off-by: Alexandre Bourdiol <[email protected]>
Could be used for example to mix Arduino API and STM32Cube HAL API. For example to configure DMA. Warning: Use at your own risk Fixes stm32duino#1035 Signed-off-by: Alexandre Bourdiol <[email protected]>
Could be used for example to mix Arduino API and STM32Cube HAL API. For example to configure DMA. Warning: Use at your own risk Fixes #1035 Signed-off-by: Alexandre Bourdiol <[email protected]>
For some hardware advanced features (like DMA) it's impossible to combine core code and pure HAL/LL calls cuz internal handles are hidden inside core code and used only internally.
For example, for my current project i need to redefine serial rx handler to do some logic without polling, so i have to edit core to access serial_t.
Or, for example, for SPI DMA implementing i need to fetch internal spi init handle to link it with DMA, ive just moved spi handle to public section, but it's a rough way and also requires modifying core code and make core updating task more complex.
What do you think?
The text was updated successfully, but these errors were encountered: