0

I am novice to freeRTOS. I am currently working on a project that uses cerebot Mx7ck(PIC32) running freeRTOS. I need to read buttons using some events(i.e using button input as input event)? But I am not allowed to use polling technique or ISR available in freeRTOS.

Professor suggested to use event handler. I do not know anything about event management in freeRTOS. It looks like there is no event handler and management in freeRTOS without using interrupt service routines.

Please help. I got stuck in this for quite a while.

Main
  • 1,804
  • 3
  • 20
  • 28
  • 1
    Perhaps you can associate the button with an interrupt and use the interrupt handler to signal the event. – kkrambo Jan 31 '15 at 03:21

1 Answers1

2
  1. Configure the button to generate an interrupt.

  2. Write an interrupt handler as described on the documentation page for the FreeRTOS PIC32 port (see the "interrupt service routines" section on the following page: http://www.freertos.org/port_PIC32_MIPS_MK4.html )

  3. Have the interrupt service routine do whatever you want to happen when the button is pushed.

If you want the interrupt to unblock a task then you can use a task notification as demonstrated on this page: http://www.freertos.org/RTOS-task-notifications.html or more precisely http://www.freertos.org/RTOS_Task_Notification_As_Binary_Semaphore.html

If you are not using a version of FreeRTOS that supports task notifications then you can use a binary semaphore instead - that is documented also on the FreeRTOS.org website.

Étienne
  • 4,773
  • 2
  • 33
  • 58
Richard
  • 3,081
  • 11
  • 9
  • Thanks for your suggestion. I too thought about interrupt handler like ISR routine. But upon asking my professor asked me to use event handler. I could not find any solution related to event management in freeRTOS. Maybe I am wrong and the professor is right. He described interrupt is for Non RTOS embedded development. – Main Jan 31 '15 at 09:48
  • 1
    @main: That does not make any sense to avoid ISR and polling, you need either an ISR or polling. There is no other solution. – Étienne Feb 04 '15 at 13:22