I have the NXP TWR-K22F120M board that I am working with to see how FreeRTOS works. I would like to setup Sw1 and SW3 they are both on PORTC. How would I write code to have an interrupt triggered if either one of these switches is pressed. I have looked at code which has SW2 wake up on interrupt but when trying to duplicate the code for SW1 I recieve an error that PORTC is being redefined.
I don't think this is a FreeRTOS question, but a hardware question. Do
Freescale provide drivers for the inputs? Or even board level drivers?
It would be unusual for drivers that do things like set pins as inputs,
and set them up to generate interrupts, etc., not to be provided.
I believe that this is a freeRTOS question becauase I would like to configure RTOS to interrupt the application when either Switch 1 or 3 is pressed. Both of these switches are on PORTC and I am not sure how to configure PORTC interrupt to use both of these items and how I know which switch was pressed causing the interrupt.
As you said you have to configure PORTC hardware that the switches generate PORTC interrupts as desired (edge vs. level triggered, etc.).
Then in the associated ISR you have to implement (and add to your exception vector table) you need to handle PORTC_ISFR register accordingly to detect (and clear) the individual PORTC pin interrupt(s).
FreeRTOS related stuff/code might start inside your ISR e.g. concerning signalling a FreeRTOS task about the switches pressed etc.
So it's not really a FreeRTOS question ;)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.