Esempio n. 1
0
/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Chip errata */
  CHIP_Init();

  /* If first word of user data page is non-zero, enable eA Profiler trace */
  BSP_TraceProfilerSetup();

  /* Initialize SLEEP driver, no calbacks are used */
  SLEEP_Init(NULL, NULL);
#if (configSLEEP_MODE < 3)
  /* do not let to sleep deeper than define */
  SLEEP_SleepBlockBegin((SLEEP_EnergyMode_t)(configSLEEP_MODE+1));
#endif

  /* Initialize the LCD driver */
  SegmentLCD_Init(false);

  /* Create standard binary semaphore */
  vSemaphoreCreateBinary(sem);

  /* Create two task to show numbers from 0 to 15 */
  xTaskCreate(Count, (const signed char *) "Count", STACK_SIZE_FOR_TASK, NULL, TASK_PRIORITY, NULL);
  xTaskCreate(LcdPrint, (const signed char *) "LcdPrint", STACK_SIZE_FOR_TASK, NULL, TASK_PRIORITY, NULL);

  /* Start FreeRTOS Scheduler */
  vTaskStartScheduler();

  return 0;
}
Esempio n. 2
0
/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Chip errata */
  CHIP_Init();
  /* If first word of user data page is non-zero, enable eA Profiler trace */
  BSP_TraceProfilerSetup();

  /* Initialize LED driver */
  BSP_LedsInit();
  /* Setting state of leds*/
  BSP_LedSet(0);
  BSP_LedSet(1);

  /* Initialize SLEEP driver, no calbacks are used */
  SLEEP_Init(NULL, NULL);
#if (configSLEEP_MODE < 3)
  /* do not let to sleep deeper than define */
  SLEEP_SleepBlockBegin((SLEEP_EnergyMode_t)(configSLEEP_MODE+1));
#endif

  /* Parameters value for taks*/
  static TaskParams_t parametersToTask1 = { pdMS_TO_TICKS(1000), 0 };
  static TaskParams_t parametersToTask2 = { pdMS_TO_TICKS(500), 1 };

  /*Create two task for blinking leds*/
  xTaskCreate( LedBlink, (const char *) "LedBlink1", STACK_SIZE_FOR_TASK, &parametersToTask1, TASK_PRIORITY, NULL);
  xTaskCreate( LedBlink, (const char *) "LedBlink2", STACK_SIZE_FOR_TASK, &parametersToTask2, TASK_PRIORITY, NULL);

  /*Start FreeRTOS Scheduler*/
  vTaskStartScheduler();

  return 0;
}
Esempio n. 3
0
/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Chip errata */
  CHIP_Init();

  /* Enable clock for GPIO */
  CMU_ClockEnable(cmuClock_GPIO, true);

  /* Configure LED_PORT pin LED_PIN (User LED) as push/pull outputs */
  GPIO_PinModeSet(LED_PORT,         /* Port */
                  LED_PIN,          /* Pin */
                  gpioModePushPull, /* Mode */
                  0 );              /* Output value */

  /* Initialize SLEEP driver, no calbacks are used */
  SLEEP_Init(NULL, NULL);
#if (configSLEEP_MODE < 3)
  /* do not let to sleep deeper than define */
  SLEEP_SleepBlockBegin((SLEEP_EnergyMode_t)(configSLEEP_MODE+1));
#endif

  /*Create two task for blinking leds*/
  xTaskCreate( LedBlink, (const char *) "LedBlink", STACK_SIZE_FOR_TASK,  NULL, TASK_PRIORITY, NULL);

  /* Start FreeRTOS Scheduler */
  vTaskStartScheduler();

  return 0;
}
Esempio n. 4
0
static void prvSetupHardware( void )
{
	/* Library initialisation routines. */
	CHIP_Init();
	BSP_TraceProfilerSetup();
	SLEEP_Init( NULL, NULL );
	BSP_LedsInit();

	SLEEP_SleepBlockBegin( configENERGY_MODE );
}
Esempio n. 5
0
/**************************************************************************//**
 * @brief main - the entrypoint after reset.
 *****************************************************************************/
int main( void )
{
    CHIP_Init();
    /* If first word of user data page is non-zero, enable eA Profiler trace */
    BSP_TraceProfilerSetup();

    CMU_ClockSelectSet( cmuClock_HF, cmuSelect_HFXO );
    CMU_OscillatorEnable(cmuOsc_LFXO, true, false);

    /* Initialize LCD driver */
    SegmentLCD_Init(false);
    SegmentLCD_Write("usbcomp");
    SegmentLCD_Symbol(LCD_SYMBOL_GECKO, true);

    /* Initialize LED driver */
    BSP_LedsInit();

    /* Initialize SLEEP driver, no calbacks are used */
    SLEEP_Init(NULL, NULL);
#if (configSLEEP_MODE < 3)
    /* do not let to sleep deeper than define */
    SLEEP_SleepBlockBegin((SLEEP_EnergyMode_t)(configSLEEP_MODE + 1));
#endif

    /* Parameters value for taks*/
    static LedTaskParams_t parametersToTask1 = { 1000 / portTICK_RATE_MS, 0 };
    static LedTaskParams_t parametersToTask2 = { 500 / portTICK_RATE_MS, 1 };

    static AdcTaskParams_t parametersToAdc =
    {
        .adcChannelsMask = 0x32,
        .uPrsChannel = 5,
        .uSampleRate = 1,
        .uTimer = 3
    };

    /*Create two task for blinking leds*/
    xTaskCreate( UsbCDCTask, "UsbCDC", STACK_SIZE_FOR_TASK, NULL, TASK_PRIORITY, NULL);
//   xTaskCreate( LedTask, (const char *) "LedBlink1", STACK_SIZE_FOR_TASK, &parametersToTask1, TASK_PRIORITY, NULL);
//   xTaskCreate( LedTask, (const char *) "LedBlink2", STACK_SIZE_FOR_TASK, &parametersToTask2, TASK_PRIORITY, NULL);
    xTaskCreate( vAdcTask, "ADC", STACK_SIZE_FOR_TASK, &parametersToAdc, TASK_PRIORITY + 1, NULL);
    xTaskCreate( vDacTask, "DAC", STACK_SIZE_FOR_TASK, NULL, TASK_PRIORITY, NULL);
    xTaskCreate( vEchoTask, "echo", STACK_SIZE_FOR_TASK, NULL, TASK_PRIORITY, NULL);

    NVIC_SetPriority(USB_IRQn, 7);
    NVIC_SetPriority(ADC0_IRQn, 7);
    vTaskStartScheduler();
}
/*****************************************************************************
 函 数 名  : WuepsSleepPidInit
 功能描述  : SLEEP PID 初始化函数
 输入参数  : enum VOS_INIT_PHASE_DEFINE ip
 输出参数  : 无
 返 回 值  : VOS_UINT32 PID 初始化结果
 调用函数  :
 被调函数  :
*****************************************************************************/
VOS_VOID Sleep_InitGlobal(VOS_VOID)
{
    VOS_UINT32 ulRecordAddr = VOS_NULL_PTR;

    SLEEP_Init();

    ulRecordAddr = DRV_EXCH_MEM_MALLOC(VOS_DUMP_MEM_TOTAL_SIZE);

    if (VOS_NULL_PTR != ulRecordAddr)
    {
        g_pstDrxStateSlice      = (DRX_STATE_SLICE_STRU*)ulRecordAddr;

        ulRecordAddr += ((PWC_COMM_MODE_GSM + 1)*sizeof(DRX_STATE_SLICE_STRU));

        g_pstLowPowerState      = (LOWPOWER_STATE_STRU*)ulRecordAddr;

        ulRecordAddr += sizeof(LOWPOWER_STATE_STRU);

        g_pstHifiStateSlice     = (HIFI_STATE_STRU*)ulRecordAddr;

        ulRecordAddr += sizeof(HIFI_STATE_STRU);

        g_pstSlaveLowPowerState = (SLAVE_LOW_POWER_STATE_STRU*)ulRecordAddr;
    }
    else
    {
        g_pstDrxStateSlice = (DRX_STATE_SLICE_STRU*)VOS_MemAlloc(WUEPS_PID_OM, STATIC_MEM_PT,
                             ((PWC_COMM_MODE_GSM + 1)*sizeof(DRX_STATE_SLICE_STRU)));

        if (VOS_NULL_PTR == g_pstDrxStateSlice)
        {
            LogPrint("Sleep_InitGlobal:VOS_MemAlloc DRX_STATE_SLICE_STRU Fail!\n");
            return;
        }

        g_pstLowPowerState = (LOWPOWER_STATE_STRU*)VOS_MemAlloc(WUEPS_PID_OM, STATIC_MEM_PT,
                             sizeof(LOWPOWER_STATE_STRU));

        if (VOS_NULL_PTR == g_pstLowPowerState)
        {
            LogPrint("Sleep_InitGlobal:VOS_MemAlloc LOWPOWER_STATE_STRU Fail!\n");
            return;
        }

        g_pstHifiStateSlice = (HIFI_STATE_STRU*)VOS_MemAlloc(WUEPS_PID_OM, STATIC_MEM_PT,
                              sizeof(HIFI_STATE_STRU));

        if (VOS_NULL_PTR == g_pstHifiStateSlice)
        {
            LogPrint("Sleep_InitGlobal:VOS_MemAlloc HIFI_STATE_STRU Fail!\n");
            return;
        }

        g_pstSlaveLowPowerState = (SLAVE_LOW_POWER_STATE_STRU*)VOS_MemAlloc(WUEPS_PID_OM, STATIC_MEM_PT,
                                  sizeof(SLAVE_LOW_POWER_STATE_STRU));

        if (VOS_NULL_PTR == g_pstSlaveLowPowerState)
        {
            LogPrint("Sleep_InitGlobal:VOS_MemAlloc SLAVE_LOW_POWER_STATE_STRU Fail!\n");
            return;
        }
    }

    VOS_MemSet(g_pstDrxStateSlice, 0, ((PWC_COMM_MODE_GSM + 1)*sizeof(DRX_STATE_SLICE_STRU)));
    VOS_MemSet(g_pstLowPowerState, 0, sizeof(LOWPOWER_STATE_STRU));
    VOS_MemSet(g_pstHifiStateSlice, 0, sizeof(HIFI_STATE_STRU));
    VOS_MemSet(g_pstSlaveLowPowerState, 0, sizeof(SLAVE_LOW_POWER_STATE_STRU));

    return;
}