On Sat, Aug 12, 2023 at 8:54 PM Mark Stevens wrote: > What I am trying to do is attach a generic ISR to some GPIO pins. I’m not a > great fan of having to modify the OS source in order to set up simple things > like ISRs to handle button presses. I’d like to be able to do this from the > user application rather than the board files which from what I have read > seems to be the way to do it.
Long story short: Copy a generic board definition, use it as a template for your own custom board definition, add your own gpio devices, see apps/examples/gpio on how to handle gpio read/write/irq and play with your custom board code, if all works fine then you will probably want to create your own custom application :-) Short story long: NuttX uses its own drivers code that makes it independent of various rapidly changing external dependencies. Not all peripherals may be supported, but then driver code needs to be created directly in-and-for the NuttX based on the chip Technical Specification. See: https://nuttx.apache.org/docs/latest/guides/drivers.html Generic develkit board files are rather generic templates for your own design because each GPIO can be used for something else by other people. You can copy your develkit board files and extend them according to your needs as "Custom Board" (i.e. add /dev/my_button). Here is an example on how to build a firmware using your custom board definition: https://nuttx.apache.org/docs/latest/guides/customboards.html Here is an example how to handle /dev/gpio from application level (you can use this application to test your own board definition): https://github.com/apache/nuttx-apps/blob/master/examples/gpio/gpio_main.c Here is an example on how to create your own custom application: https://nuttx.apache.org/docs/latest/guides/customapps.html Note that at application level signals are used to talk with interrupt drivers (see example above). You can also create a low level driver code that will perform the work and provide the results for the application and that driver code should be contained in the board definition itself and then exposed to the application in a form of device (/dev/something), then you can expose read/write/signal access to the application. Here is a documentation on how drivers are organized in NuttX: https://nuttx.apache.org/docs/latest/components/drivers/index.html Have fun :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info