/** * @brief Enter in stop mode and exit by an alarm * @param None * @note This example enter in stop mode. * @retval None */ void LowPowerStopRTCAlarm(void) { kWindow_Popup("STOP Alarme", LCD_COLOR_WHITE, LCD_COLOR_BLUE,\ "\nset delay time\n", \ LCD_COLOR_BLUE, LCD_COLOR_WHITE ); /* set the alarm */ LowPowerHandleAlarm(); kWindow_Popup("STOP Alarm", LCD_COLOR_WHITE, LCD_COLOR_BLUE, \ "\n\nstop mode\nstarted\nwait alarm\nto exit\n", \ LCD_COLOR_BLUE, LCD_COLOR_WHITE ); BSP_JOY_Init(JOY_MODE_GPIO); /* Enter Stop Mode */ HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE); /* Restore the clock configuration */ SystemClock_STOPExit(); HAL_RTC_DeactivateAlarm(&RtcHandle, RTC_ALARM_A); /* Clear the Alarm interrupt pending bit */ __HAL_RTC_ALARM_CLEAR_FLAG(&RtcHandle,RTC_FLAG_ALRAF); /* Clear the EXTI's line Flag for RTC Alarm */ __HAL_RTC_EXTI_CLEAR_FLAG(RTC_EXTI_LINE_ALARM_EVENT); BSP_JOY_Init(JOY_MODE_EXTI); }
/** * @brief Enter in stop mode and exit by pressingf the tamper button * @param None * @note This example enter in stop mode. * @retval None */ void LowPowerStopEXTI(void) { kWindow_Popup("STOP EXTI", LCD_COLOR_WHITE, LCD_COLOR_BLUE, \ "\n\nPres JOY sel to\nstart\nstop mode\n", \ LCD_COLOR_WHITE, LCD_COLOR_BLUE ); HAL_Delay(100); user_event = JOY_UP; while(user_event != JOY_SEL) { user_action = 0; }; kWindow_Popup("STOP EXTI", LCD_COLOR_WHITE, LCD_COLOR_BLUE, \ "\n\nstop mode\nstarted\npress tamper\nto exit\n", \ LCD_COLOR_BLUE, LCD_COLOR_WHITE ); /* User push-button (EXTI_Line0) will be used to wakeup the system from STOP mode */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI); /* avoid wakeup from JOY event */ BSP_JOY_Init(JOY_MODE_GPIO); /* Clear PWR wake up Flag */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /* Enter Stop Mode */ HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); /* Restore the clock configuration */ SystemClock_STOPExit(); /* User push-button (EXTI_Line0) will be used to wakeup the system from STOP mode */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); BSP_JOY_Init(JOY_MODE_EXTI); }
/** * @brief DUALCORE application Init. * @param None * @retval None */ static void DUAL_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG DualCore Host"); LCD_UsrLog("USB Host library started.\n"); /* Start DualCore Interface */ USBH_UsrLog("Initializing hardware...."); DUAL_MenuInit(); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F469xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Initialize IO expander (MFX) */ BSP_IO_Init(); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize IO expander */ BSP_IO_Init(); /* Initialize Joystick */ if (BSP_JOY_Init(JOY_MODE_GPIO) == 0) { JoyButtonInitialized = 1; } /* Init CDC Application */ USBD_Init(&USBD_Device_HS, &VCP_Desc, 1); /* Init HID Application */ USBD_Init(&USBD_Device_FS, &HID_Desc, 0); /* Add Supported Classes */ USBD_RegisterClass(&USBD_Device_HS, &USBD_CDC); USBD_RegisterClass(&USBD_Device_FS, &USBD_HID); /* Add CDC Interface Class */ USBD_CDC_RegisterInterface(&USBD_Device_HS, &USBD_CDC_fops); /* Start Device Process */ USBD_Start(&USBD_Device_FS); USBD_Start(&USBD_Device_HS); /* Run Application (Interrupt mode) */ while (1) { Toggle_Leds(); if(HID_SendReport == 1) { HID_SendReport = 0; GetPointerData(HID_Buffer); /* Send data though IN endpoint*/ if((HID_Buffer[1] != 0) || (HID_Buffer[2] != 0)) { USBD_HID_SendReport(&USBD_Device_FS, HID_Buffer, 4); } } } }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MSC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Initialize menu and MSC process */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief DS application Init. * @param None * @retval None */ static void DynamicSwitch_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB HS DynamicSwitch Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB FS DynamicSwitch Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start Dynamic Switch Interface */ LCD_UsrLog("Starting DynamicSwitch Demo\n"); LCD_UsrLog("Plug your device To Continue...\n"); }
/** * @brief HID application Init * @param None * @retval None */ static void HID_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the LCD */ BSP_LCD_Init(); /* Init the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS HID Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS HID Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start HID Interface */ HID_MenuInit(); }
/** * @brief Joystick Gpio demo * @param None * @retval None */ void Joystick_demo (void) { uint8_t status = 0; Joystick_SetHint(); status = BSP_JOY_Init(); if (status != HAL_OK) { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 70, (uint8_t *)"ERROR", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 55, (uint8_t *)"Joystick cannot", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 40, (uint8_t *)"be initialized", CENTER_MODE); } while (1) { if (status == HAL_OK) { /* Get the Joystick State */ JoyState = BSP_JOY_GetState(); Joystick_SetCursorPosition(); } if(CheckForUserInput() > 0) { return; } HAL_Delay(6); } }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); LCD_UsrLog("USB Host library started.\n"); /* Start MSC Interface */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MSC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Initialize menu and MSC process */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Initialize LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure the system clock to 72 MHz */ SystemClock_Config(); /* Initialize Joystick */ BSP_JOY_Init(JOY_MODE_GPIO); /* Configure Key push-button for remote wakeup */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Init Device Library */ USBD_Init(&USBD_Device, &HID_Desc, 0); /* Register the HID class */ USBD_RegisterClass(&USBD_Device, &USBD_HID); /* Start Device Process */ USBD_Start(&USBD_Device); /* Infinite loop */ while (1) { } }
/** * @brief HID application Init. * @param None * @retval None */ static void HID_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS HID Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS HID Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start HID Interface */ USBH_UsrLog("Starting HID Demo"); HID_MenuInit(); }
/** * @brief LCD Log demo * @param None * @retval None */ void Log_demo(void) { JOYState_TypeDef JoyState = JOY_NONE; uint8_t i = 0; /* Wait For User inputs */ while(CheckForUserInput() == 0); BSP_JOY_Init(JOY_MODE_GPIO); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Log Example"); LCD_LOG_SetFooter((uint8_t *)"Use Joystick to scroll up/down"); /* Output User logs */ for (i = 0; i < 10; i++) { LCD_UsrLog ("This is Line %d \n", i); } HAL_Delay(2000); /* Clear Old logs */ LCD_LOG_ClearTextZone(); /* Output new user logs */ for (i = 0; i < 30; i++) { LCD_UsrLog ("This is Line %d \n", i); } /* Check for joystick user input for scroll (back and forward) */ while (1) { JoyState = BSP_JOY_GetState(); switch(JoyState) { case JOY_UP: LCD_LOG_ScrollBack(); break; case JOY_DOWN: LCD_LOG_ScrollForward(); break; default: break; } if(CheckForUserInput() > 0) { return; } HAL_Delay (10); } }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { uint8_t lcd_status = LCD_OK; /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure the LED1, LED2, LED3 and LED4 */ BSP_IO_Init(); BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the SDRAM */ if (BSP_SDRAM_Init() != SDRAM_OK) { /* User can add here some code to deal with this error */ while (1) { } } /* Initialize and start the LCD display in mode 'lcd_mode' * Using LCD_FB_START_ADDRESS as frame buffer displayed contents. * This buffer is modified by the BSP (draw fonts, objects depending on BSP calls). */ /* Set Portrait orientation if needed, by default orientation is set to Landscape */ /* Initialize DSI LCD */ // BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT); /* uncomment if Portrait orientation is needed */ BSP_LCD_Init(); /* Uncomment if default config (landscape orientation) is needed */ while(lcd_status != LCD_OK); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure IO and LED1 */ BSP_IO_Init(); BSP_LED_Init(LED1); BSP_LED_Init(LED4); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Camera has to be powered down as some signals use same GPIOs between * I2S signals and camera bus. Camera drives its signals to low impedance * when powered ON. So the camera is powered off to let its signals * in high impedance */ /* Camera power down sequence */ BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT); BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT); /* De-assert the camera STANDBY pin (active high) */ BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET); /* Assert the camera RSTI pin (active low) */ BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief Joystick Exti demo * @param None * @retval None */ void Joystick_exti_demo (void) { uint8_t status = 0; uint32_t ITstatus = 0; Joystick_SetHint(1); status = BSP_JOY_Init(JOY_MODE_EXTI); if (status != IO_OK) { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 95, (uint8_t *)"ERROR", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 80, (uint8_t *)"Joystick cannot be initialized", CENTER_MODE); } if (status == IO_OK) { Joystick_SetCursorPosition(); } while (1) /* pull for USER button in GPIO mode */ { if (status == IO_OK) { if (MfxExtiReceived == 1) { MfxExtiReceived = 0; ITstatus = BSP_IO_ITGetStatus(JOY_ALL_PINS); if (ITstatus) { /* Get the Joystick State */ JoyState = BSP_JOY_GetState(); Joystick_SetCursorPosition(); } BSP_IO_ITClear(); /* poll if joystick is still pressed until it is released*/ while ( BSP_JOY_GetState() != JOY_NONE) { Joystick_SetCursorPosition(); HAL_Delay(5); } } } if(CheckForUserInput() > 0) { return; } HAL_Delay(5); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 168 Mhz */ SystemClock_Config(); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /*Initialize Joystick */ BSP_JOY_Init(JOY_MODE_GPIO); /* Init MSC Application */ USBD_Init(&USBD_Device_HS, &MSC_Desc, 1); /* Init HID Application */ USBD_Init(&USBD_Device_FS, &HID_Desc, 0); /* Add Supported Classes */ USBD_RegisterClass(&USBD_Device_HS, &USBD_MSC); USBD_RegisterClass(&USBD_Device_FS, &USBD_HID); /* Add Storage callbacks for MSC Class */ USBD_MSC_RegisterStorage(&USBD_Device_HS, &USBD_DISK_fops); /* Start Device Process */ USBD_Start(&USBD_Device_FS); USBD_Start(&USBD_Device_HS); /* Run Application (Interrupt mode)*/ while (1) { GetPointerData(HID_Buffer); if((HID_Buffer[1] != 0) || (HID_Buffer[2] != 0)) { USBD_HID_SendReport(&USBD_Device_FS, HID_Buffer, 4); } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /* Configure Key Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI); /* Configure Joystick using MFX in IT mode in order to wakeup system after standby */ BSP_JOY_Init(JOY_MODE_EXTI); /* RTC configuration */ RTC_Config(); /* Turn on LED1 */ BSP_LED_On(LED1); /* Enable WKUP pin */ HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1); /* Infinite loop */ while (1) { if (AuthorizeToggle) { /* Toggle LED1 */ BSP_LED_Toggle(LED1); AuthorizeToggle = 0; } if (MfxExtiReceived) { /* Clear MFX IT */ BSP_IO_ITClear(); MfxExtiReceived = 0; } } }
/** * @brief CDC application Init. * @param None * @retval None */ static void CDC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Selects the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enables the display */ BSP_LCD_DisplayOn(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS CDC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS CDC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start CDC Interface */ USBH_UsrLog("Starting CDC Demo"); Menu_Init(); /* Initialize microSD */ if (SD_StorageInit() == 0) { SD_StorageParse(); } }
/** * @brief MTP application Init. * @param None * @retval None */ static void MTP_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialisation */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /*Selects the LCD Layer*/ BSP_LCD_SelectLayer(1); /*Enables the display*/ BSP_LCD_DisplayOn(); /*Init the LCD Log module*/ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MTP Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MTP Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start MTP Interface */ USBH_UsrLog("Starting MTP Demo"); /* Init Audio interface */ AUDIO_Init(); /* Start MTP Interface */ MTP_MenuInit(); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F3xx HAL library initialization: - Configure the Flash prefetch - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Initialize LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure the system clock to 72 MHz */ SystemClock_Config(); /* Change Systick priority: should be higher than Key button interrupt */ HAL_NVIC_SetPriority(SysTick_IRQn,0,0); /* Initialize Joystick */ BSP_JOY_Init(JOY_MODE_GPIO); /* Configure Key button for remote wakeup */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Init Device Library */ USBD_Init(&USBD_Device, &HID_Desc, 0); /* Register the HID class */ USBD_RegisterClass(&USBD_Device, &USBD_HID); /* Start Device Process */ USBD_Start(&USBD_Device); while (1) { } }
/** * @brief Run the Lowpower Standby mode RTC Alarm * @param None. * @note run and display information about the lowpower feature. * @retval None. */ void LowPowerStandbyRTCAlarm(void) { kWindow_Popup("STANDBY Alarm", LCD_COLOR_WHITE, LCD_COLOR_BLUE,\ "\nset delay time\n", \ LCD_COLOR_BLUE, LCD_COLOR_WHITE ); /* Set the alarm */ LowPowerHandleAlarm(); kWindow_Popup("", LCD_COLOR_WHITE, LCD_COLOR_WHITE, \ "\n\nstandby mode\nstarted\nwait alarm\nto exit\nand reset\n", \ LCD_COLOR_BLUE, LCD_COLOR_WHITE ); BSP_JOY_Init(JOY_MODE_GPIO); /*#### Enter StandBy mode ####*/ HAL_PWR_EnterSTANDBYMode(); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 168 Mhz */ SystemClock_Config(); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /*Initialize Joystick */ BSP_JOY_Init(JOY_MODE_GPIO); /* Init MSC Application */ USBD_Init(&USBD_Device_HS, &VCP_Desc, 1); /* Init HID Application */ USBD_Init(&USBD_Device_FS, &HID_Desc, 0); /* Add Supported Classes */ USBD_RegisterClass(&USBD_Device_HS, &USBD_CDC); USBD_RegisterClass(&USBD_Device_FS, &USBD_HID); /* Add CDC Interface Class */ USBD_CDC_RegisterInterface(&USBD_Device_HS, &USBD_CDC_fops); /* Start Device Process */ USBD_Start(&USBD_Device_FS); USBD_Start(&USBD_Device_HS); /* Run Application (Interrupt mode)*/ while (1) { } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Configure the System clock to have a frequency of 216 MHz */ SystemClock_Config(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /* Initialize Joystick */ if (BSP_JOY_Init(JOY_MODE_GPIO) == 0) { JoyButtonInitialized = 1; } /* Configure Key button for remote wakeup */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI); /* Init Device Library */ USBD_Init(&USBD_Device, &HID_Desc, 0); /* Add Supported Class */ USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS); /* Start Device Process */ USBD_Start(&USBD_Device); /* Run Application (Interrupt mode) */ while (1) { } }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F446xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); LEDsInitialized = 1; /* Initialize Joystick */ if (BSP_JOY_Init(JOY_MODE_GPIO) == 0) { JoyButtonInitialized = 1; } /* Configure Key button for remote wakeup */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI); /* Init Device Library */ USBD_Init(&USBD_Device, &HID_Desc, 0); /* Add Supported Class */ USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS); /* Start Device Process */ USBD_Start(&USBD_Device); /* Run Application (Interrupt mode) */ while (1) { } }
/** * @brief DS application Init. * @param None * @retval None */ static void DynamicSwitch_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialisation */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /*Selects the LCD Layer*/ BSP_LCD_SelectLayer(1); /*Enables the display*/ BSP_LCD_DisplayOn(); /*Init the LCD Log module*/ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB HS DynamicSwitch Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB FS DynamicSwitch Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start Dynamic Switch Interface */ LCD_UsrLog("Starting DynamicSwitch Demo\n"); LCD_UsrLog("Plug your device To Continue...\n"); }
/** * @brief LCD Log demo * @param None * @retval None */ void Log_demo(void) { uint8_t i = 0; /* Wait For User inputs */ while(CheckForUserInput() == 0); BSP_JOY_Init(JOY_MODE_GPIO); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Log Example"); /* Output User logs */ for (i = 0; i < 10; i++) { LCD_UsrLog ("This is Line %d \n", i); } HAL_Delay(2000); /* Clear Old logs */ LCD_LOG_ClearTextZone(); /* Output new user logs */ for (i = 0; i < 30; i++) { LCD_UsrLog ("This is Line %d \n", i); } while (1) { if(CheckForUserInput() > 0) { return; } HAL_Delay (10); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F2xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 120 MHz */ SystemClock_Config(); /* Change Systick priority: should be higher than Key button interrupt */ HAL_NVIC_SetPriority(SysTick_IRQn,0,0); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize Joystick */ BSP_JOY_Init(JOY_MODE_GPIO); /* Configure Key button for remote wakeup */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Init Device Library */ USBD_Init(&USBD_Device, &HID_Desc, 0); /* Add Supported Class */ USBD_RegisterClass(&USBD_Device, &USBD_HID); /* Start Device Process */ USBD_Start(&USBD_Device); while (1); }
/** * @brief Test HDMI CEC Hardware. * @param None * @retval None */ void HDMI_CEC_demo(void) { /* Display the demo description */ HdmiCec_SetHint(); /* Configuration of the joystick in GPIO mode */ BSP_JOY_Init(JOY_MODE_GPIO); /* Select the device type of the board */ HdmiCec_SelectDevice(); /* Initialization of the HDMI CEC */ if (BSP_HDMI_CEC_Init() != HDMI_CEC_OK) { Error_Handler(); } /* Display informations after initialization */ HdmiCec_DisplayInitInfo(); /* Display connected devices */ HdmiCec_DisplayConnectedDevices(); /* Infinite loop */ while(!CheckForUserInput()) { if(ReceivedFrame != 0) { /* Display received message */ HdmiCec_DisplayReceivedMsg(); /* Handle the received messages */ BSP_HDMI_CEC_CommandCallBack(); /* Display connected devices */ HdmiCec_DisplayConnectedDevices(); } } }