/* Standard includes. */
#include <stdio.h>
/* Kernel includes. */
#include "Arduino_FreeRTOS.h"
#include "task.h"
#include "enviaserial.h"
#include "piscaled.h"
/*
Set up the hardware
*/
static void setupHardware(void);
void setup()
{
/* Initialize serial communication at 9600 bits per second: */
Serial.begin(9600, SERIAL_8N1);
// while (!Serial) {
// ; /* Wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards. */
// }
Serial.println("Creating task");
pisca_led();
envia_serial();
/* Inicia as tasks */
vTaskStartScheduler();
/* Se tudo correu bem, o scheduler deve estar rodando, e a seguinte linha
nunca vai ser executada. Se a linha seguinte for executada, então não houve
memória heap suficiente para o FreeRTOS ou para as tasks criadas. Veja
a seção sobre gerenciamento de memória no site da FreeRTOS para mais
detalhes.*/
}
void loop()
{
}
/*-----------------------------------------------------------*/
/* Tratamento de falhas */
/* ----------------------------------------------------------*/
void vApplicationMallocFailedHook(void)
{
/* vApplicationMallocFailedHook() will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c or heap_2.c are used, then the size of the
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
taskDISABLE_INTERRUPTS();
for (;;)
;
}
/*-----------------------------------------------------------*/
void vApplicationIdleHook(void)
{
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
task. It is essential that code added to this hook function never attempts
to block in any way (for example, call xQueueReceive() with a block time
specified, or call vTaskDelay()). If the application makes use of the
vTaskDelete() API function (as this demo application does) then it is also
important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
}
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName)
{
(void)pcTaskName;
(void)pxTask;
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
for (;;)
;
}
/*-----------------------------------------------------------*/
void vApplicationTickHook(void)
{
/* This function will be called by each tick interrupt if
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
added here, but the tick hook is called from an interrupt context, so
code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */
}
/*-----------------------------------------------------------*/