Ejemplo n.º 1
0
/**
 * [gui_pedometer_DestroyTasks description]
 * @param param [description]
 */
void gui_pedometer_DestroyTasks( void* param )
{
    OSA_TaskDestroy( gui_pedometer_taskHandler );
    OSA_TaskDestroy( gui_pedometer_step_counter_taskHandler );
    OSA_MsgQDestroy( gui_pedometer_queueHnd );

    pedometer_Deinit();

    OLED_DestroyDynamicArea();

    GuiDriver_LabelDestroy( &gui_pedometer_stepCounter_label );
    GuiDriver_LabelDestroy( &gui_pedometer_stepText_label );

    GuiDriver_LabelDestroy( &gui_pedometer_calCounter_label );
    GuiDriver_LabelDestroy( &gui_pedometer_calText_label );

    GuiDriver_UnregisterFromNavigation( GUI_NAVIGATION_RIGHT );

    isPedometerActive = false;

    power_EnablePowerSave();

    if ( false  == gui_sensorTag_IsActive() )
    {
      GuiDriver_NotifyKW40( GUI_CURRENT_APP_IDLE );
    }
}
Ejemplo n.º 2
0
/**
 * destroy current running tasks in the watch screen
 * @param param optional parameter
 */
void watch_DestroyTasks( void *param )
{
  osa_status_t status = kStatus_OSA_Success;

  if ( kStatus_OSA_Success != status )
  {
    catch( CATCH_INIT );
  }

  GuiDriver_UnregisterFromSensors( PACKET_BAT, false );
  GuiDriver_UnregisterFromSensors( PACKET_TEMP, true );

  OLED_DestroyDynamicArea();

  GuiDriver_LabelDestroy(&watch_labelTime);
  GuiDriver_LabelDestroy(&watch_labelDate);
  GuiDriver_LabelDestroy(&watch_labelTemp);

  status = OSA_TaskDestroy(watch_timeUpdate_handler);
  status |= OSA_TaskDestroy(watch_getPackets_handler);
  status |= OSA_TaskDestroy(watch_guiUpdate_handler);

  if ( kStatus_OSA_Success != status )
  {
    catch( CATCH_DEINIT );
  }
}
Ejemplo n.º 3
0
/**
 * destroy sensor tag mode task
 * @param param optional parameter
 */
void gui_sensorTag_DestroyTasks( void* param )
{
    OSA_TaskDestroy( gui_sensorTag_taskHandler );
    OSA_MsgQDestroy( gui_sensorTag_queueHnd );
    GuiDriver_UnregisterFromNavigation( GUI_NAVIGATION_RIGHT );
    OLED_DestroyDynamicArea();
}
Ejemplo n.º 4
0
/**
 * [gui_motionControl_DestroyTasks description]
 * @param param [description]
 */
void gui_motionControl_DestroyTasks( void* param )
{
    OSA_TaskDestroy( gui_motionControl_taskHandler );

    if ( active_acc == activeScreen )
    {
//	  if ( false == gui_sensorTag_IsActive() )
//	  {
//		  sensor_SetPushTargets( PACKET_ACC, sensor_GetPushTargets( PACKET_ACC ) & ~PACKET_PUSH_KW40, false );
//	  }
      GuiDriver_UnregisterFromSensors( PACKET_ACC, true );
    }

    else
    {
//	  if ( false == gui_sensorTag_IsActive() )
//	  {
//		  sensor_SetPushTargets( PACKET_GYRO, sensor_GetPushTargets( PACKET_GYRO ) & ~PACKET_PUSH_KW40, false );
//	  }
      GuiDriver_UnregisterFromSensors( PACKET_GYRO, true );
    }

    OLED_DestroyDynamicArea();

    GuiDriver_LabelDestroy( &gui_motionControl_labelX );
    GuiDriver_LabelDestroy( &gui_motionControl_labelY );
    GuiDriver_LabelDestroy( &gui_motionControl_labelZ );

    HEXIWEAR_SetBackupList( NULL );
    HEXIWEAR_SetTargetApp ( PACKET_PUSH_NONE );
}
Ejemplo n.º 5
0
static void Task_Start(void *arg)
{
#if (USE_RTOS)
    APP_init();
#endif
    OSA_TaskDestroy (OSA_TaskGetHandler());
    }
Ejemplo n.º 6
0
/**
 * [gui_notifications_DestroyTasks]
 * @param param [description]
 */
void gui_notifications_DestroyTasks( void* param )
{
	OSA_TaskDestroy( gui_notifications_taskHandler );
    OLED_DestroyDynamicArea();

    GuiDriver_LabelDestroy( &gui_notifications_labelMail );
    GuiDriver_LabelDestroy( &gui_notifications_labelSms );
    GuiDriver_LabelDestroy( &gui_notifications_labelCall );
}
uint32_t OS_Task_delete(uint32_t task_id)
{
#if ((defined (FSL_RTOS_UCOSII)) || (defined (FSL_RTOS_UCOSIII)))
    usb_adapter_task_struct* task_struct = (usb_adapter_task_struct*)task_id;

    if (kStatus_OSA_Success != OSA_TaskDestroy(task_struct->handler))
    {
        return (uint32_t)OS_TASK_ERROR;
    }
#if defined (FSL_RTOS_UCOSIII)
    OSA_MemFree(task_struct->handler);  // Free TCB
#endif
    OSA_MemFree(task_struct->stack_mem);  // Free stack memory
    OSA_MemFree(task_struct);
    return (uint32_t)OS_TASK_OK;
#else
    return (kStatus_OSA_Success == OSA_TaskDestroy((task_handler_t) task_id)) ? (uint32_t) OS_TASK_OK : (uint32_t) OS_TASK_ERROR;
#endif
}
Ejemplo n.º 8
0
/**
 * [info_DestroyTasks description]
 * @param param [description]
 */
void info_DestroyTasks( void* param )
{
    OSA_TaskDestroy( info_taskHandler );

    OLED_DestroyDynamicArea();

    GuiDriver_UnregisterFromNavigation( GUI_NAVIGATION_UP );
    GuiDriver_UnregisterFromNavigation( GUI_NAVIGATION_DOWN );

    GuiDriver_LabelDestroy(&info_labelTitle);
    GuiDriver_LabelDestroy(&info_labelData);
}
Ejemplo n.º 9
0
void bluetooth_DestroyTasks( void *param )
{
	osa_status_t status;


	status = OSA_TaskDestroy(bluetooth_AdvModeToggleHandler);

	if ( kStatus_OSA_Success != status )
	{
		catch( CATCH_INIT );
	}

	status = OSA_TaskDestroy(bluetooth_AdvModeUpdateHandler);

	if ( kStatus_OSA_Success != status )
	{
		catch( CATCH_INIT );
	}

	OLED_DestroyDynamicArea();
	GuiDriver_UnregisterFromNavigation( GUI_NAVIGATION_RIGHT );
}
Ejemplo n.º 10
0
/**
 * destroy the app task
 * @param param optional parameter
 */
void gui_motionControl_DestroyTasks( void* param )
{
    OSA_TaskDestroy( gui_motionControl_taskHandler );

    if ( active_acc == activeScreen )
    {
      GuiDriver_UnregisterFromSensors( PACKET_ACC, true );
    }

    else
    {
      GuiDriver_UnregisterFromSensors( PACKET_GYRO, true );
    }

    OLED_DestroyDynamicArea();

    GuiDriver_LabelDestroy( &gui_motionControl_labelX );
    GuiDriver_LabelDestroy( &gui_motionControl_labelY );
    GuiDriver_LabelDestroy( &gui_motionControl_labelZ );

    HEXIWEAR_SetBackupList( NULL );
    HEXIWEAR_SetTargetApp ( PACKET_PUSH_NONE );
}
Ejemplo n.º 11
0
/**
 * [gui_weatherStation_DestroyTasks description]
 * @param param [description]
 */
void gui_weatherStation_DestroyTasks( void* param )
{
    OSA_TaskDestroy( gui_weatherStation_taskHandler );

//    if ( false == gui_sensorTag_IsActive() )
//    {
//        sensor_SetPushTargets( PACKET_PRES, sensor_GetPushTargets( PACKET_PRES ) & ~PACKET_PUSH_KW40, false );
//        sensor_SetPushTargets( PACKET_TEMP, sensor_GetPushTargets( PACKET_TEMP ) & ~PACKET_PUSH_KW40, false );
//        sensor_SetPushTargets( PACKET_HUM,  sensor_GetPushTargets( PACKET_HUM )  & ~PACKET_PUSH_KW40, false );
//    }

    GuiDriver_UnregisterFromSensors( PACKET_PRES, false );
    GuiDriver_UnregisterFromSensors( PACKET_TEMP, false );
    GuiDriver_UnregisterFromSensors( PACKET_HUM,  true );

    OLED_DestroyDynamicArea();

    GuiDriver_LabelDestroy( &gui_weatherStation_labelTemp );
    GuiDriver_LabelDestroy( &gui_weatherStation_labelHum );
    GuiDriver_LabelDestroy( &gui_weatherStation_labelPress );

    HEXIWEAR_SetBackupList( NULL );
    HEXIWEAR_SetTargetApp ( PACKET_PUSH_NONE );
}
Ejemplo n.º 12
0
void HEXIWEAR_startup( task_param_t param )
{
    uint8_t
    status = 0;

    /** output GPIO config */

    GPIO_DRV_Init( NULL, OLED_cfg );
    GPIO_DRV_Init( NULL, FLASH_cfg );
    GPIO_DRV_Init( NULL, PWR_cfg );
    GPIO_DRV_Init( NULL, VIBRO_cfg );
    GPIO_DRV_Init( NULL, RGB_cfg );
    GPIO_DRV_Init( NULL, KW40_GPIO_cfg );
    GPIO_DRV_Init( NULL, REL_GPIO_cfg );


    /** input GPIO config */

    GPIO_DRV_Init( BAT_CHG_cfg, NULL );
    GPIO_DRV_Init( TAP_cfg, NULL );

    // lajkatest
    // GPIO_DRV_Init( GPIO_TEST_CFG, NULL );

#if defined( HEXIWEAR_DEBUG )
    GPIO_DRV_Init( NULL, DEBUG_cfg );
#endif

    power_ResetKW40();
    timer_Init( HEXIWEAR_TIMER_SENSOR );

    status |= RTC_Init();
    status |= FLASH_Init( &flashModule, &flashSettings );

    // intern flash initialization
    INTFLASH_Init();

    // enable power save by default
    // power_EnablePowerSave();
    power_DisablePowerSave();

    // set to deep sleep by default
    // power_SetSleepMode( POWER_SLEEP_TYPE_DEEP );

    // RGB off
    FLASH_SetOFF();

    // visual indication for testing HR sensor
//  MAXIM_Test();

    /** create basic tasks */
    status |= Notification_Init();
    status |= HostInterface_Init();
    status |= sensor_Init();
    status |= power_Init();
    status |= GuiDriver_Init();

    haptic_MutexCreate();

    sensor_InitAcc();

    /** set GPIO interrupt for the tap function */
    PORT_HAL_SetPinIntMode( PORTC, 1, kPortIntFallingEdge );

    /** set charging battery interrupt */
    PORT_HAL_SetPinIntMode( PORTC, 12, kPortIntEitherEdge );
    NVIC_SetPriority( PORTC_IRQn, HEXIWEAR_CHG_IRQ_PRIO );
    INT_SYS_EnableIRQ( PORTC_IRQn );

    // status |= Run_USB_Task();

    if ( HEXIWEAR_STATUS_SUCCESS != status )
    {
        catch( CATCH_INIT );
    }

    /** check for settings in flash at startup */
    gui_sensorTag_CheckAtStartup();
    haptic_CheckAtStartup();

    CLOCK_SYS_Init( g_clockManConfigsArr, FSL_CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, FSL_CLOCK_MANAGER_CALLBACK_CNT );
    POWER_SYS_Init( powerConfigsArr, 2U, powerStaticCallbacksConfigsArr , 2U );

    // make battery readings regular
    sensor_SetPacketTargets( PACKET_BAT, sensor_GetPacketTargets( PACKET_BAT) | PACKET_PUSH_POWER_MGMT, true );

    volatile uint32_t
    foo = CLOCK_SYS_GetSystemClockFreq();

    while (1)
    {
        OSA_TaskDestroy( NULL );
    }
}
Ejemplo n.º 13
0
void HEXIWEAR_startup( task_param_t param )
{
  uint8_t
    status = 0;

  /** output GPIO configuration */

  GPIO_DRV_Init( NULL, OLED_cfg );
  GPIO_DRV_Init( NULL, FLASH_cfg );
  GPIO_DRV_Init( NULL, PWR_cfg );
  GPIO_DRV_Init( NULL, VIBRO_cfg );
  GPIO_DRV_Init( NULL, RGB_cfg );
  GPIO_DRV_Init( NULL, KW40_GPIO_cfg );


  /** input GPIO configuration */

  GPIO_DRV_Init( BAT_CHG_cfg, NULL );
  GPIO_DRV_Init( TAP_cfg, NULL );

#if defined( HEXIWEAR_DEBUG )
  GPIO_DRV_Init( NULL, DEBUG_cfg );
#endif

  power_ResetKW40();
  timer_Init( HEXIWEAR_TIMER_SENSOR );

  status |= RTC_Init();
  status |= FLASH_Init( &flashModule, &flashSettings );

  // intern flash initialization
  INTFLASH_Init();

  // RGB off
  FLASH_SetOFF();

  /** create basic tasks */
  status |= Notification_Init();
  status |= HostInterface_Init();
  status |= sensor_Init();
  status |= GuiDriver_Init();

  haptic_MutexCreate();

  sensor_InitAcc();

  /** set GPIO interrupt for the tap function */
  PORT_HAL_SetPinIntMode( PORTC, 1, kPortIntFallingEdge );

  /** set charging battery interrupt */
  PORT_HAL_SetPinIntMode( PORTC, 12, kPortIntEitherEdge );
  NVIC_SetPriority( PORTC_IRQn, HEXIWEAR_CHG_IRQ_PRIO );
  INT_SYS_EnableIRQ( PORTC_IRQn );

  if ( HEXIWEAR_STATUS_SUCCESS != status )
  {
    catch( CATCH_INIT );
  }

  /** check for settings in flash at startup */
  gui_sensorTag_CheckAtStartup();
  haptic_CheckAtStartup();

  CLOCK_SYS_Init( g_clockManConfigsArr, FSL_CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, FSL_CLOCK_MANAGER_CALLBACK_CNT );
  POWER_SYS_Init( powerConfigsArr, 2U, powerStaticCallbacksConfigsArr , 2U );

  // turn on regular battery readings
  sensor_SetPacketTargets( PACKET_BAT, sensor_GetPacketTargets( PACKET_BAT) | PACKET_PUSH_POWER_MGMT, true );

  while (1)
  {
    power_Init();
    OSA_TaskDestroy( NULL );
  }
}