added software timer instantiation + config (unused)
This commit is contained in:
@@ -109,6 +109,11 @@
|
|||||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
#define configENABLE_BACKWARD_COMPATIBILITY 0
|
#define configENABLE_BACKWARD_COMPATIBILITY 0
|
||||||
|
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
#define configTIMER_TASK_PRIORITY 4 // above normal
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH 128
|
||||||
|
#define configTIMER_QUEUE_LENGTH 4
|
||||||
|
|
||||||
#define configTOTAL_HEAP_SIZE 4096
|
#define configTOTAL_HEAP_SIZE 4096
|
||||||
|
|
||||||
/* Co-routine definitions. */
|
/* Co-routine definitions. */
|
||||||
|
|||||||
+15
@@ -125,6 +125,21 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackTy
|
|||||||
}
|
}
|
||||||
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
|
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
||||||
|
static StaticTask_t xTimersTaskTCBBuffer;
|
||||||
|
static StackType_t xTimersStack[configTIMER_TASK_STACK_DEPTH];
|
||||||
|
|
||||||
|
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimersTaskTCBBuffer, StackType_t **ppxTimersTaskStackBuffer, uint32_t *pulTimersTaskStackSize )
|
||||||
|
{
|
||||||
|
*ppxTimersTaskTCBBuffer = &xTimersTaskTCBBuffer;
|
||||||
|
*ppxTimersTaskStackBuffer = &xTimersStack[0];
|
||||||
|
*pulTimersTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||||
|
/* place for user code */
|
||||||
|
}
|
||||||
|
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
/* Init FreeRTOS */
|
/* Init FreeRTOS */
|
||||||
|
|
||||||
void MX_FREERTOS_Init(void) {
|
void MX_FREERTOS_Init(void) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ struct priv {
|
|||||||
|
|
||||||
GPIO_TypeDef *port;
|
GPIO_TypeDef *port;
|
||||||
uint32_t ll_pin;
|
uint32_t ll_pin;
|
||||||
|
TimerHandle_t busyWaitTimer; // timer used to wait for ds1820 measurement completion
|
||||||
};
|
};
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
|
|||||||
@@ -76,12 +76,21 @@ static void U1WIRE_writeIni(Unit *unit, IniWriter *iw)
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void U1WIRE_TimerCb(TimerHandle_t xTimer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** Allocate data structure and set defaults */
|
/** Allocate data structure and set defaults */
|
||||||
static error_t U1WIRE_preInit(Unit *unit)
|
static error_t U1WIRE_preInit(Unit *unit)
|
||||||
{
|
{
|
||||||
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
|
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
|
||||||
if (priv == NULL) return E_OUT_OF_MEM;
|
if (priv == NULL) return E_OUT_OF_MEM;
|
||||||
|
|
||||||
|
// the timer is not started until needed
|
||||||
|
priv->busyWaitTimer = xTimerCreate("1w_tim", 750, false, unit, U1WIRE_TimerCb);
|
||||||
|
if (priv->busyWaitTimer == NULL) return E_OUT_OF_MEM;
|
||||||
|
|
||||||
// some defaults
|
// some defaults
|
||||||
priv->pin_number = 0;
|
priv->pin_number = 0;
|
||||||
priv->port_name = 'A';
|
priv->port_name = 'A';
|
||||||
@@ -122,6 +131,9 @@ static void U1WIRE_deInit(Unit *unit)
|
|||||||
// Release all resources
|
// Release all resources
|
||||||
rsc_teardown(unit);
|
rsc_teardown(unit);
|
||||||
|
|
||||||
|
// Delete the software timer
|
||||||
|
assert_param(pdPASS == xTimerDelete(priv->busyWaitTimer, 1000));
|
||||||
|
|
||||||
// Free memory
|
// Free memory
|
||||||
free_ck(unit->data);
|
free_ck(unit->data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user