This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BUTTON_PULL in app_uart.c

Since I'm writing code for my own board, I decided to create my own board.h file to hold the board-specific definitions.

However, I can't do this without hacking the SDK, as app_uart.c includes boards.h, which is part of the sdk, and it won't pickup my board.h without hackery.

Call me a purist, but the SDK shouldn't depend on files that change with board-level configuration. I assume this is a bug, but please correct me if there's another appropriate way to have my own board.h file without modifying the SDK or masquerading as a PCA10001.

-Jim

Parents
  • To add your own board, the best way is to add an extra clause to the default boards.h and set the compile-time define you configure. This would limit your change to the SDK files to just boards.h, and I can't see any way to avoid the need for this.

    However, I do agree that this particular use of the define seems unnecessary, so I've reported it internally to change it to NRF_GPIO_PIN_PULLUP. Thanks for letting us know!

Reply
  • To add your own board, the best way is to add an extra clause to the default boards.h and set the compile-time define you configure. This would limit your change to the SDK files to just boards.h, and I can't see any way to avoid the need for this.

    However, I do agree that this particular use of the define seems unnecessary, so I've reported it internally to change it to NRF_GPIO_PIN_PULLUP. Thanks for letting us know!

Children
  • I think it's better to not have the SDK depend on my files, and better not to have to change the SDK at all. (Things that should change ought to be examples and not in the core source and includes directories).

    With this one change I no longer need boards.h (unless I run into it somewhere els) so I think that's the right fix. Thanks!

  • In general I do agree, SDK files should be changed only if absolutely needed. But if you don't want to change the includes of all the examples to make them work on your board, I do think that adding a clause to boards.h and changing the board define is an acceptable workaround.

    However, you do what you find easiest and best for your project! :)

  • So the examples should have a boards.h file like this, but I don't think that should be in the SDK; it should be part of the examples package.

    The other reason why the boards.h file is a pain has to do with Eclipse. Hard as I tried, I couldn't get the code analyzer to look at those board files. It has something to do with the way boards.h includes files with a path, but I'm not willing to debug the CDT plugin to figure it out. Eliminating this dependency makes code analysis work in Eclipse.

Related