예제 #1
0
static void sj_timer_callback(TimerHandle_t t) {
  v7_val_t *cb = (v7_val_t *) pvTimerGetTimerID(t);
  xTimerDelete(t, 0);
  sj_invoke_cb0(s_v7, *cb);
  v7_disown(s_v7, cb);
  free(cb);
}
예제 #2
0
static void prvTimerCallback( TimerHandle_t xExpiredTimer )
{
UBaseType_t *puxVariableToIncrement;
BaseType_t xReturned;

	/* The timer callback just demonstrates it is executing by incrementing a
	variable - the address of which is passed into the timer as its ID.  Obtain
	the address of the variable to increment. */
	puxVariableToIncrement = ( UBaseType_t * ) pvTimerGetTimerID( xExpiredTimer );

	/* Increment the variable to show the timer callback has executed. */
	( *puxVariableToIncrement )++;

	/* If this callback has executed the required number of times, stop the
	timer. */
	if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS )
	{
		/* This is called from a timer callback so must not block.  See
		http://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
		xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK );

		if( xReturned != pdPASS )
		{
			xErrorOccurred = pdTRUE;
		}
	}
}
예제 #3
0
파일: lwip_eth.c 프로젝트: GMUCERG/xbh
static void poll_ip6_addr(TimerHandle_t pxTimer){
    struct netif *netif_arg = (struct netif *) pvTimerGetTimerID( pxTimer ); 
    bool slaac_done = false;

    //0th  address is link local, assume 1th address is SLAAC
    for(int i = 0; i < 4; i++){
        if(netif_arg->ip6_addr[1].addr[i] != 0){
            slaac_done = true;
            break;
        }
    }
    if(slaac_done){
        for(int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++){
            uart_printf("IPv6 Address %d of interface %c%c set "
                    "to %04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx\n",
                    i,
                    netif_arg->name[0], netif_arg->name[1],
                    IP6_ADDR_BLOCK1(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK2(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK3(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK4(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK5(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK6(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK7(&netif_arg->ip6_addr[i]),
                    IP6_ADDR_BLOCK8(&netif_arg->ip6_addr[i]));
        }
        xTimerStop( pxTimer, 0 );
    }
}
예제 #4
0
void IIS328DQ::measure_trampoline(xTimerHandle xTimer)
{
    void *timer_id = pvTimerGetTimerID(xTimer);
	IIS328DQ *dev = (IIS328DQ *)timer_id;

	/* make another measurement */
	dev->measure();
}
예제 #5
0
void
PX4FMU::cycle_trampoline(void* xTimer)
{
    void *timer_id = pvTimerGetTimerID(xTimer);
	PX4FMU *dev = reinterpret_cast<PX4FMU *>(timer_id);

	dev->cycle();
}
예제 #6
0
static void download_timer_cb(TimerHandle_t xTimer)
{
    int socket_id = (int) pvTimerGetTimerID(xTimer);
    g_ota_timeout = true;
    if (socket_id != -1) {
        close(socket_id);
    }
}
예제 #7
0
static void timer_callback( xTimerHandle handle )
{
    wiced_timer_t* timer = (wiced_timer_t*) pvTimerGetTimerID( handle );

    if ( timer->function )
    {
        timer->function( timer->arg );
    }
}
예제 #8
0
/**
 * @brief Internal callback function for the system timer
 *
 * Internal function that is called from the system timer.
 * It gets our parameter from timer data and sends it to user function.
 * @param[in] xTimer Timer handler
 */
static void app_timer_callback(TimerHandle_t xTimer)
{
    app_timer_info_t * pinfo = (app_timer_info_t*)(pvTimerGetTimerID(xTimer));
    ASSERT(pinfo->osHandle == xTimer);
    ASSERT(pinfo->func != NULL);

    if (pinfo->active)
        pinfo->func(pinfo->argument);
}
예제 #9
0
	void *MPU_pvTimerGetTimerID( const TimerHandle_t xTimer )
	{
	void * pvReturn;
	BaseType_t xRunningPrivileged = xPortRaisePrivilege();

		pvReturn = pvTimerGetTimerID( xTimer );
		vPortResetPrivilege( xRunningPrivileged );

		return pvReturn;
	}
예제 #10
0
파일: main-full.c 프로젝트: Eclo/FreeRTOS
static void prvLEDTimerCallback( TimerHandle_t xTimer )
{
unsigned long ulLED;

	/* This callback is shared by two timers, so the parameter is used to
	determine which LED to toggle.  The LED number is stored in the ID of the
	timer. */
	ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer );
	vParTestToggleLED( ulLED );
}
예제 #11
0
static void prvLEDTimerCallback( xTimerHandle xTimer )
{
portBASE_TYPE xTimerID;

	/* The timer ID is used to identify the timer that has actually expired as
	each timer uses the same callback.  The ID is then also used as the number
	of the LED that is to be toggled. */
	xTimerID = ( portBASE_TYPE ) pvTimerGetTimerID( xTimer );
	vParTestToggleLED( xTimerID );
}
예제 #12
0
파일: main-full.c 프로젝트: bookie/freertos
static void prvFlashTimerCallback( xTimerHandle xTimer )
{
unsigned long ulLED;

	/* This callback function is assigned to three separate software timers.
	Each timer toggles a different LED.  Obtain the number of the LED that
	this timer is toggling. */
	ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer );

	/* Toggle the LED. */
	vParTestToggleLED( ulLED );	
}
예제 #13
0
파일: main.c 프로젝트: sean93park/freertos
static void prvTimerCallback( TaskHandle_t xExpiredTimer )
{
uint32_t ulCount;

	/* The count of the number of times this timer has expired is saved in the
	timer's ID.  Obtain the current count. */
	ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer );

	/* Increment the count, and save it back into the timer's ID. */
	ulCount++;
	vTimerSetTimerID( xTimer, ( void * ) ulCount );
}
예제 #14
0
void vTimerCallback ( xTimerHandle pxTimer )
{
	configASSERT( pxTimer );

	// Which timer expired?
	long lTimerID = ( long ) pvTimerGetTimerID ( pxTimer );

	if ( lTimerID < LED_NUM_TIMER ) LedTimerCallback ( lTimerID );
	else switch ( lTimerID )
	{
	case 4:
		disk_timerproc ( );
		return;
	};
};
예제 #15
0
파일: main.c 프로젝트: Eclo/FreeRTOS
static void prvTimerCallback( TaskHandle_t xExpiredTimer )
{
uint32_t ulCount;

	/* The count of the number of times this timer has expired is saved in the
	timer's ID.  Obtain the current count. */
	ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer );

	/* Increment the count, and save it back into the timer's ID. */
	ulCount++;
	vTimerSetTimerID( xTimer, ( void * ) ulCount );

	/* Let the check task know the timer is still running. */
	vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING );
}
예제 #16
0
파일: myTimers.c 프로젝트: nbjones/RTOSDemo
// Callback function that is called by the LCDTimer
//   Sends a message to the queue that is read by the LCD Task
void LCDTimerCallback(xTimerHandle pxTimer)
{
	if (pxTimer == NULL) {
		VT_HANDLE_FATAL_ERROR(0);
	} else {
		// When setting up this timer, I put the pointer to the 
		//   LCD structure as the "timer ID" so that I could access
		//   that structure here -- which I need to do to get the 
		//   address of the message queue to send to 
		vtLCDStruct *ptr = (vtLCDStruct *) pvTimerGetTimerID(pxTimer);
		// Make this non-blocking *but* be aware that if the queue is full, this routine
		// will not care, so if you care, you need to check something
		if (SendLCDTimerMsg(ptr,lcdWRITE_RATE_BASE,0) == errQUEUE_FULL) {
			// Here is where you would do something if you wanted to handle the queue being full
			VT_HANDLE_FATAL_ERROR(0);
		}
	}
}
예제 #17
0
static void prvUIPTimerCallback( TimerHandle_t xTimer )
{
static const unsigned long ulARPTimerExpired = uipARP_TIMER_EVENT;
static const unsigned long ulPeriodicTimerExpired = uipPERIODIC_TIMER_EVENT;

	/* This is a time callback, so calls to xQueueSend() must not attempt to
	block. */
	switch( ( int ) pvTimerGetTimerID( xTimer ) )
	{
		case uipARP_TIMER		:	xQueueSend( xEMACEventQueue, &ulARPTimerExpired, uipDONT_BLOCK );
									break;

		case uipPERIODIC_TIMER	:	xQueueSend( xEMACEventQueue, &ulPeriodicTimerExpired, uipDONT_BLOCK );
									break;

		default					:  	/* Should not get here. */
									break;
	}
}
예제 #18
0
파일: myTimers.c 프로젝트: nbjones/RTOSDemo
// Callback function that is called by the TemperatureTimer
//   Sends a message to the queue that is read by the Temperature Task
void adcTimerCallback(xTimerHandle pxTimer)
{
	if (pxTimer == NULL) {
		VT_HANDLE_FATAL_ERROR(0);
	} else {
		// When setting up this timer, I put the pointer to the 
		//   Temperature structure as the "timer ID" so that I could access
		//   that structure here -- which I need to do to get the 
		//   address of the message queue to send to 
		adcStruct *ptr = (adcStruct *) pvTimerGetTimerID(pxTimer);
		// Make this non-blocking *but* be aware that if the queue is full, this routine
		// will not care, so if you care, you need to check something
		GPIO_SetValue(0,0x8000);
		if (SendadcTimerMsg(ptr) == errQUEUE_FULL) {
			// Here is where you would do something if you wanted to handle the queue being full
			VT_HANDLE_FATAL_ERROR(0);
		}
		GPIO_ClearValue(0,0x8000);
	}
}
예제 #19
0
파일: uIP_Task.c 프로젝트: ammarkham/moos
static void prvUIPTimerCallback( xTimerHandle xTimer )
{
static const unsigned long ulARPTimerExpired = uipARP_TIMER_EVENT;
static const unsigned long ulPeriodicTimerExpired = uipPERIODIC_TIMER_EVENT;

	/* This is a time callback, so calls to xQueueSend() must not attempt to
	block.  As this callback is assigned to both the ARP and Periodic timers, the
	first thing to do is ascertain which timer it was that actually expired. */
	switch( ( int ) pvTimerGetTimerID( xTimer ) )
	{
		case uipARP_TIMER		:	xQueueSend( xEMACEventQueue, &ulARPTimerExpired, uipDONT_BLOCK );
									break;

		case uipPERIODIC_TIMER	:	xQueueSend( xEMACEventQueue, &ulPeriodicTimerExpired, uipDONT_BLOCK );
									break;

		default					:  	/* Should not get here. */
									break;
	}
}
예제 #20
0
/* Center of the led sequence machine. This function is executed by the FreeRTOS
 * timer and runs the sequences
 */
static void runLedseq( xTimerHandle xTimer )
{
  led_t led = (led_t)pvTimerGetTimerID(xTimer);
  const ledseq_t *step;
  bool leave=false;

  if (!ledseqEnabled)
    return;

  while(!leave) {
    int prio = activeSeq[led];

    if (prio == LEDSEQ_STOP)
      return;

    step = &sequences[prio][state[led][prio]];

    state[led][prio]++;

    xSemaphoreTake(ledseqSem, portMAX_DELAY);
    switch(step->action)
    {
      case LEDSEQ_LOOP:
        state[led][prio] = 0;
        break;
      case LEDSEQ_STOP:
        state[led][prio] = LEDSEQ_STOP;
        updateActive(led);
        break;
      default:  //The step is a LED action and a time
        ledSet(led, step->value);
        if (step->action == 0)
          break;
        xTimerChangePeriod(xTimer, M2T(step->action), 0);
        xTimerStart(xTimer, 0);
        leave=true;
        break;
    }
    xSemaphoreGive(ledseqSem);
  }
}
예제 #21
0
//-------------------------------------------------------//
// Task synchronnizer - 
// callback function for FreeRTOS software timers task
//-------------------------------------------------------//
static void vTimerCallback(xTimerHandle pxTimer)
{
	uint8_t timer_id = (uint8_t)pvTimerGetTimerID(pxTimer);
	switch (timer_id)
	{
		case TIMER_CONVERTER:
			xQueueSendToBack(xQueueConverter, &converter_tick_message, 0);	// do not wait
			break;
		case TIMER_SOUND:
			xQueueSendToBack(xQueueSound, &sound_driver_sync_msg, 0);	// do not wait
			break;
		case TIMER_GUI:
			xQueueSendToBack(xQueueGUI, &gui_msg_redraw, 0);	
			break;
		case TIMER_BUTTONS:
			xQueueSendToBack(xQueueButtons, &buttons_tick_msg, 0);	
			break;
		case TIMER_UART_RX:
			xQueueSendToBack(xQueueUART1RX, &uart_rx_tick_msg, 0);	
			xQueueSendToBack(xQueueUART2RX, &uart_rx_tick_msg, 0);	
			break;
	}
}
예제 #22
0
static void prvTimerCallback( TimerHandle_t xExpiredTimer )
{
UBaseType_t *puxVariableToIncrement;
BaseType_t xReturned;

	/* Obtain the address of the variable to increment from the timer ID. */
	puxVariableToIncrement = ( UBaseType_t * ) pvTimerGetTimerID( xExpiredTimer );

	/* Increment the variable to show the timer callback has executed. */
	( *puxVariableToIncrement )++;

	/* If this callback has executed the required number of times, stop the
	timer. */
	if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS )
	{
		/* This is called from a timer callback so must not block. */
		xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK );

		if( xReturned != pdPASS )
		{
			xErrorOccurred = pdTRUE;
		}
	}
}
예제 #23
0
파일: mqtt.c 프로젝트: resetnow/esp_mqtt
void ICACHE_FLASH_ATTR mqtt_timer(xTimerHandle timer)
{
	MQTT_Client* client = (MQTT_Client*) pvTimerGetTimerID(timer);

	if (client->connState == MQTT_DATA) {
		client->keepAliveTick ++;
		if (client->keepAliveTick > client->mqtt_state.connect_info->keepalive) {
			client->connState = MQTT_KEEPALIVE_SEND;
			xSemaphoreGive(client->mqttTaskSem);
		}

	} else if (client->connState == TCP_RECONNECT_REQ) {
		client->reconnectTick ++;
		if (client->reconnectTick > MQTT_RECONNECT_TIMEOUT) {
			client->reconnectTick = 0;
			client->connState = TCP_RECONNECT;
			xSemaphoreGive(client->mqttTaskSem);
			if (client->timeoutCb)
				client->timeoutCb((uint32_t*)client);
		}
	}
	if (client->sendTimeout > 0)
		client->sendTimeout --;
}
예제 #24
0
파일: charging.c 프로젝트: evchar/charging
void vTimerCallback( xTimerHandle pxTimer )
{

  long lArrayIndex;
  uint8 temp = 0;
  // Optionally do something if the pxTimer parameter is NULL.
  configASSERT( pxTimer );

  // Which timer expired?
  lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer );

  if(0 == lArrayIndex)
  {
    LED_READY_TOGGLE();
    temp = Q_CHECK_SERVER_SIG;
    xQueueSend(msgQueue, &temp, 0);
  }
  if(1 == lArrayIndex)
  {
    LED_CHARGE_TOGGLE();
    temp = Q_CHECK_SERVER_SIG;
    xQueueSend(msgQueue, &temp, 0);
  }
}
예제 #25
0
파일: log.c 프로젝트: jannson/crazypony
/* This function is called by the timer subsystem */
void logBlockTimed(xTimerHandle timer)
{
  workerSchedule(logRunBlock, pvTimerGetTimerID(timer));
}
예제 #26
0
static void sdcard_timer_handler(xTimerHandle tmr)
{
    esp_periph_handle_t periph = (esp_periph_handle_t) pvTimerGetTimerID(tmr);
    esp_periph_send_cmd(periph, SDCARD_STATUS_CARD_DETECT_CHANGE, NULL, 0);
}
예제 #27
0
	static void softTimerCallback( xTimerHandle pxTimer )
	{
		SoftTimer *t = (SoftTimer*) pvTimerGetTimerID(pxTimer);
		t->executeCallback();
	}
예제 #28
0
int os_timer_get_id(os_timer_t timer, void** timer_id)
{
    *timer_id = pvTimerGetTimerID(timer);
    return 0;
}
예제 #29
0
// static required so we can marshall the method for the callback
void StatusScreen::statusTimerCallback( TimerHandle_t pxTimer )
{
	StatusScreen *ss = (StatusScreen*)pvTimerGetTimerID( pxTimer );
	ss->update();
}
예제 #30
0
void LedTimerCallback(xTimerHandle pxTimer)
{
	signalLED((uint32_t) pvTimerGetTimerID(pxTimer), LEDMODE_OFF);
}