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

The type of "channel" in event module should be changed to std::string #39

Closed
pjueon opened this issue Jan 13, 2022 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@pjueon
Copy link
Owner

pjueon commented Jan 13, 2022

The library supports 4 pin numbering modes: BOARD, BCM, CVM and TEGRA_SOC.
CVM and TEGRA_SOC use strings instead of numbers which correspond to signal names on the CVM/CVB connector and the Tegra SoC respectively.

So the channel is NOT always convertible to type int.

But the event module is probably implemented with assumption that the channel is always convertible to int.

For example, in wait_for_edge, add_event_detect function, std::atoi is used to convert the channel to int .
If the user is using CVM or TEGRA_SOC, these functions will throw an exception.

And callback objects use the channel argument as int type. This should be fixed too.

@pjueon pjueon added the bug Something isn't working label Jan 13, 2022
@pjueon pjueon self-assigned this Jan 13, 2022
pjueon added a commit that referenced this issue Jan 13, 2022
- CVM and TEGRA_SOC use strings instead of numbers.
So the channel is NOT always convertible to int.
- in wait_for_edge, add_event_detect function,
std::atoi is used to convert the channel to int .
If the user is using CVM orTEGRA_SOC,
these functions will throw an exception.
- see #39
pjueon added a commit that referenced this issue Jan 16, 2022
- fix for the following issue(issue #39):
The library supports 4 pin numbering modes: 
BOARD, BCM, CVM and TEGRA_SOC.
The CVM and TEGRA_SOC mode use strings instead of numbers for the channels.
So the channel is NOT ALWAYS convertible to int.
If the user is using CVM or TEGRA_SOC mode,
the wait_for_edge and add_event_detect function 
will throw an exception. 

- by this fix, some part of the public API changed: 
1. the return type of wait_for_edge function changed
2. the signature of the callback object changed
@pjueon
Copy link
Owner Author

pjueon commented Jan 16, 2022

Fixed by pull request #40 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant