Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To get a GPIO pin ready for use, we need to do 3 things.

  1. Call gpio_init() at the start of your main program.

  2. Call gpio_init_pin() for the specific pin you want to use. You need to pass into this function the settings you are trying to configure your pin with, and the address of the pin you are trying to configure.

  3. Call the function to interact with the GPIO pin. This could be gpio_get_state() if the pin is configured as an input, or gpio_<set/toggle>_state() if the pin is setup as an output.

Task 1 - GPIO toggle program

...

(If you are doing the training remote or cannot access hardware, you can use the function gpio_it_trigger_interrupt() to mock the button behaviour. By adding this function call and a delay_ms() to your while true loop, it will trigger the interrupt periodically.

...