Add Adacallback as part of the repo and initial task
This commit is contained in:
1 parent
89a3de8a05
commit
509d55f9a5
5 files changed
+9
-8
No files matched your search
@@ -63,6 +63,7 @@ uint32_t setLoopStacksize(void);
|
||||
#include "debug.h"
|
||||
#include "common_inc.h"
|
||||
#include "utility/utilities.h"
|
||||
#include "utility/AdaCallback.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "Uart.h"
|
||||
|
||||
@@ -95,6 +95,9 @@ int main( void )
|
||||
TaskHandle_t _loopHandle;
|
||||
xTaskCreate( loop_task, "loop", _loopStacksize, NULL, TASK_PRIO_NORMAL, &_loopHandle);
|
||||
|
||||
// Initialize callback task
|
||||
ada_callback_init();
|
||||
|
||||
// Start FreeRTOS scheduler.
|
||||
vTaskStartScheduler();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "AdaCallback.h"
|
||||
#include "Arduino.h"
|
||||
|
||||
static QueueHandle_t _cb_queue = NULL;
|
||||
|
||||
@@ -48,7 +48,6 @@ void adafruit_callback_task(void* arg)
|
||||
if ( xQueueReceive(_cb_queue, (void*) &cb_data, portMAX_DELAY) )
|
||||
{
|
||||
// PRINT_HEX(cb_data);
|
||||
// PRINT_INT(cb_data->callback_type);
|
||||
// PRINT_HEX(cb_data->malloced_data);
|
||||
|
||||
void* func = cb_data->callback_func;
|
||||
@@ -75,7 +74,7 @@ void adafruit_callback_task(void* arg)
|
||||
|
||||
void ada_callback_queue(ada_callback_t* cb_data)
|
||||
{
|
||||
xQueueSend(_cb_queue, (void*) &cb_data, BLE_GENERIC_TIMEOUT);
|
||||
xQueueSend(_cb_queue, (void*) &cb_data, CFG_CALLBACK_TIMEOUT);
|
||||
}
|
||||
|
||||
void ada_callback_init(void)
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
#ifndef ADACALLBACK_H_
|
||||
#define ADACALLBACK_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "bluefruit.h"
|
||||
#include "common_inc.h"
|
||||
|
||||
#define CFG_CALLBACK_TASK_STACKSIZE (512*2)
|
||||
#define CFG_CALLBACK_QUEUE_LENGTH 20
|
||||
#define CFG_CALLBACK_TIMEOUT 100
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
@@ -58,7 +58,7 @@ typedef struct
|
||||
uint32_t arguments[1]; // flexible array holder
|
||||
}ada_callback_t;
|
||||
|
||||
static_assert(sizeof(ada_callback_t) == 16, "Incorrect Size");
|
||||
VERIFY_STATIC( sizeof(ada_callback_t) == 16 );
|
||||
|
||||
/*------------- Defer callback type, determined by number of arguments -------------*/
|
||||
typedef void (*adacb_0arg_t) (void);
|
||||
|
||||
@@ -214,8 +214,6 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
|
||||
TaskHandle_t soc_task_hdl;
|
||||
xTaskCreate( adafruit_soc_task, "SD SOC", CFG_SOC_TASK_STACKSIZE, NULL, TASK_PRIO_HIGH, &soc_task_hdl);
|
||||
|
||||
ada_callback_init();
|
||||
|
||||
NVIC_SetPriority(SD_EVT_IRQn, 6);
|
||||
NVIC_EnableIRQ(SD_EVT_IRQn);
|
||||
|
||||
|
||||
Reference in new issue
Block a user