We will now make use of the GPIO Drivers that we have built to make applications.
In the Board user manual, we have the schematic that shows how current limiting resistors and LED are connected & to which pin of which port.
Simply using, the driver layer API's that we have built,
1. Push-Pull Config : Don't forget to RESET the board as you program.
2. Open-Drain Config : Have to use a pull up, yet it is of 40 k ohms and hence we see the intensity of LED is too less.
3. Handling On-Board LED and BUTTON : As we press the button, PA0 finds the path to VDD to be less resistive and hence, current flows from VDD to PA0. When not pushed, GND. Thus, button pressed : HIGH & Not Pressed : LOW.
4. External LED and Button : Don't use any pin, use the ones that support GPIO.
After having configured the edge trigger, we need to again look at this diagram. So, which out of all the pin0 pins of different ports, which port will take the charge of EXTI0, this is decided by SysConfig Register. For instance, if i want to generate interrupt using PD3 that we know would be done using EXTI3. So we have to insert the code word for Port D at EXTI3. Code word are defined as MACROS. With that done, we have done interrupt coding for the peripheral side, now we will enable the IRQ pin numbers on the processor side as by default they are disabled. For this we first define which IRQ Number corresponds to which EXTI line and then enable that.
For that, we have to look into the ARM Cortex M4 general guide which guides us to the registers of the processors which can be used to enable or disable certain IRQs.
The register details are found here. All the EXTI lines go to the NVIC, that's we refer to the NVIC registes.
To enable the interrupt on certain IRQ Number, we just set the bit of the corresponding register. 8 such register each helps to enable interrupt for a set of IRQ Pin Numbers.