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

question about passing driver data with Q_NEW api #49

Open
andy27182 opened this issue Mar 5, 2025 · 2 comments
Open

question about passing driver data with Q_NEW api #49

andy27182 opened this issue Mar 5, 2025 · 2 comments

Comments

@andy27182
Copy link

When my software needs to access the data of the same peripheral in multiple QActives, is it the best practice in the qp framework to use Q_NEW to pass these data?
The data of a certain peripheral may be dozens of bytes in size. When there are multiple peripherals, it is necessary to derive many event objects of different lengths from QEvt. After obtaining the data, allocate memory through Q_NEW and send it to the receiving object via the post interface. Then, inside the receiving object, these data are copied again. This process will generate multiple buffering processes.
If dont use the Q_NEW API, I use global variables, Its simple but then I will be back to the situation where I need to manually protect resource.
Could you please answer my question or provide a suitable example?

@quantum-leaps
Copy link
Contributor

Hi Andy,
Could you please repost your question to the Free QP/QM Support Forum? I want to answer your question, but such that this discussion will be available to the broader QP community. If I answer here, hardly anybody except you will see it. I hope this comment makes sense to you.
--MMS

@andy27182
Copy link
Author

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