Skip to content

lib: dk_buttons_and_leds: Include nrfx.h to make GPIO defines available #180

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

Merged
merged 1 commit into from
Oct 30, 2018

Conversation

jtguggedal
Copy link
Contributor

This patch adds include of nrfx.h to make necessary GPIO defines for
available for the DK buttons and LEDs library.

Signed-off-by: Jan Tore Guggedal [email protected]

This patch adds include of nrfx.h to make necessary GPIO defines for
available for the DK buttons and LEDs library.

Signed-off-by: Jan Tore Guggedal <[email protected]>
@jtguggedal
Copy link
Contributor Author

cc @jhn-nordic @barsok @joakimtoe

This is to make the define CONFIG_GPIO_P0_DEV_NAME available to the library and make it compile.
An alternative way is to use CONFIG_GPIO_0_LABEL instead, which is still available without including any additional files. I can update the PR with the alternative solution if you want to.

@pdunaj
Copy link
Contributor

pdunaj commented Oct 29, 2018

@jtguggedal I think it would be better to use macros defined in fixups (i.e. CONFIG_GPIO_P0_DEV_NAME. This is what is used in other places.

@pdunaj pdunaj self-requested a review October 29, 2018 14:36
@@ -10,6 +10,7 @@
#include <gpio.h>
#include <misc/util.h>
#include <logging/sys_log.h>
#include <nrfx.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONFIG_GPIO_P0_DEV_NAME is really unavailable? It should be included from fixups brought by soc.h. I think all boards include this file in their board.h file. Maybe this is missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when compiling for nRF91, CONFIG_GPIO_P0_DEV_NAME is currently not defined. I need to refer to @barsok for an explanation of why this is. I agree that using CONFIG_GPIO_P0_DEV_NAME without the need of any extra header file would be the preferred solution, but as of now I don't think it's possible. CONFIG_GPIO_0_LABEL is defined, but my understanding is that CONFIG_GPIO_P0_DEV_NAME is the preferred way to get the device name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that somebody forgot to include a header but in such case it would be better to fix the actual problem. Otherwise people will have to make sure they add this additional include.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point was to reduce dts_fixup.h to a minimum. In each compilation autoconfig.h is available (injected in gcc command line). A lot of other includes also include generated_dts_board.h and there are all necessary labels etc. The legacy kconfig names have been moved to nrfx.h. Some discussion may be needed if there is a need to duplicate DTS definitions, ie CONFIG_GPIO_P0_DEV_NAME with CONFIG_GPIO_0_LABEL. If you think so we can discuss what is really needed short-term and long-term

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I have seen in zephyr code base then CONFIG_GPIO_P0_DEV_NAME is very often used.

Copy link
Contributor Author

@jtguggedal jtguggedal Oct 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have strong opinions on this, other than that we need a fix for this as soon as possible so samples using this library can compile.

I'll leave it up to you as the author of the lib to decide which solution to use @jhn-nordic , I will update the PR accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtguggedal I think you should include nrfx.h and then we can remove it when CONFIG_GPIO_P0_DEV_NAME gets available again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then this PR is merge-ready I think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barsok I have created a ticket in Zephyr to improve the way labels are defined. Maybe there will be some further discussion regarding this.
zephyrproject-rtos/zephyr#10938

Copy link
Contributor

@joakimtoe joakimtoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I'm fine with both suggestions!

@lemrey
Copy link
Contributor

lemrey commented Oct 30, 2018

A side comment, has there been any discussion about upstreaming this library?
It has quite generic functionality, debouncing and getting a PIN mask..

@jhn-nordic
Copy link
Contributor

A side comment, has there been any discussion about upstreaming this library?
It has quite generic functionality, debouncing and getting a PIN mask..

It has not been discussed as far as I know. If we are going to use it more extensively there are some things that should be added like support for going to sleep and use interrupt together with the polling that is used now. It also would need to support not only using GPIO_P0

@jtguggedal
Copy link
Contributor Author

jtguggedal commented Oct 30, 2018

@carlescufi This one is ready to be merged, and is needed for samples (like nRF Cloud) to compile without errors. The inclusion of nrfx.h introduced in this patch will be removed when there is a way to make these defines available otherwise.

@carlescufi carlescufi merged commit 7e6d7a4 into nrfconnect:master Oct 30, 2018
@jtguggedal jtguggedal deleted the dk_leds_buttons_lib_fix branch December 6, 2018 07:18
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 2, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 2, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 2, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 2, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 3, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 3, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 3, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 3, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Nov 3, 2022
    This commit is automatically created as result of
Pull request nrfconnect#180 to nrfconnect/sdk-nrfxlib.

Signed-off-by: Nordic Builder <[email protected]>
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

Successfully merging this pull request may close these issues.

7 participants