Skip to content

Create some examples which demonstrate realistic use-cases #284

Open
@johnnyegel

Description

@johnnyegel

All examples seems to put all code in the main() function, and demonstrate some static condition happening once. However, this does not reflect any real use cases, and I struggle really hard to implement anything actually useful using the HAL (unless of course I would put all logic into the main() function). There should be some examples which shows actual useful use-cases, and not just PoCs.

For example, one thing I failed to implement: Create a simple "driver struct", which takes an SPI instance with DMA support (WriteDma trait) and a viable buffer (static mut!) via the new() function. Then implement a send() function for this struct which generate a new byte sequence in the buffer, and transmit it using DMA. The send function returns the "Transmit" instance. Then, in the main loop, call send() once every second (or similar).

This would be an actual useful example, as dynamically filling a buffer with data and then transmitting it with DMA is something you would do in a real-life application (compared to sending some static data once in the main function). Further, using Peripherals in driver structs (in separate driver modules) is also typically something you would want to do when creating libraries.
(I would love to provide such examples myself, but I am simply not remotely capable of making anything work except in said main() function).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions