added software timer instantiation + config (unused)

sipo
Ondřej Hruška 6 years ago
parent c9aa39af80
commit 55816fc810
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 5
      FreeRTOSConfig.h
  2. 15
      freertos.c
  3. 1
      units/1wire/_ow_internal.h
  4. 12
      units/1wire/unit_1wire.c

@ -109,6 +109,11 @@
#define configCHECK_FOR_STACK_OVERFLOW 2
#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
/* Co-routine definitions. */

@ -125,6 +125,21 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackTy
}
/* 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 */
void MX_FREERTOS_Init(void) {

@ -19,6 +19,7 @@ struct priv {
GPIO_TypeDef *port;
uint32_t ll_pin;
TimerHandle_t busyWaitTimer; // timer used to wait for ds1820 measurement completion
};
// 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 */
static error_t U1WIRE_preInit(Unit *unit)
{
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
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
priv->pin_number = 0;
priv->port_name = 'A';
@ -122,6 +131,9 @@ static void U1WIRE_deInit(Unit *unit)
// Release all resources
rsc_teardown(unit);
// Delete the software timer
assert_param(pdPASS == xTimerDelete(priv->busyWaitTimer, 1000));
// Free memory
free_ck(unit->data);
}

Loading…
Cancel
Save