/** * @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); } } } }
void BSP_InitIO (void) { #ifdef _TARGET_440H BSP_IO_Init(); LCD_Init(); Tmr_Init(); LED_Init(); /* Initialize LEDs */ LS2_UART_Init(); #else SYSTEMConfig(BSP_CLK_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); BSP_IO_Init(); #ifndef AX12_REG_PROGRAMMING // Initialize the board's I/Os Tmr_Init(); // Initialize the timers BSP_InitIntCtrl(); // Initialize the interrupt controller #endif LED_Init(); // Initialize LEDs //PB_Init(); // Initialize the push buttons ADC_Init(); PMP_Init(); LS2_UART_Init(); PWM_Init(); #endif }
/** * @brief Configures and enables the touch screen interrupts. * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_ITConfig(void) { uint8_t ts_status = TS_ERROR; uint8_t io_status = IO_ERROR; /* Initialize the IO */ io_status = BSP_IO_Init(); if(io_status != IO_OK) { return (ts_status); } /* Configure TS IT line IO : is active low on FT6206 (see data sheet) */ /* Configure TS_INT_PIN (MFX_IO_14) low level to generate MFX_IRQ_OUT in EXTI on MCU */ /* This will call HAL_GPIO_EXTI_Callback() that is setting variable 'mfx_exti_received' to 1b1' */ io_status = BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_LOW_LEVEL_PU); if(io_status != IO_OK) { return (ts_status); } /* Enable the TS in interrupt mode */ /* In that case the INT output of FT6206 when new touch is available */ /* is active low and directed on MFX IO14 */ ts_driver->EnableIT(I2C_Address); /* If arrived here : set good status on exit */ ts_status = TS_OK; return (ts_status); }
/** * @brief Initializes and configures the touch screen functionalities and * configures all necessary hardware resources (GPIOs, clocks..). * @param xSize: Maximum X size of the TS area on LCD * @param ySize: Maximum Y size of the TS area on LCD * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_Init(uint16_t xSize, uint16_t ySize) { uint8_t mfxstm32l152_id = 0; tsBundaryX = xSize; tsBundaryY = ySize; /* Initialize IO functionalities (MFX) used by TS */ BSP_IO_Init(); /* Read ID and verify if the IO expander is ready */ mfxstm32l152_id = mfxstm32l152_io_drv.ReadID(IO_I2C_ADDRESS); if((mfxstm32l152_id == MFXSTM32L152_ID_1) || (mfxstm32l152_id == MFXSTM32L152_ID_2)) { /* Initialize the TS driver structure */ ts_driver = &mfxstm32l152_ts_drv; AddressI2C = TS_I2C_ADDRESS; tsOrientation = TS_SWAP_NONE; } /* Initialize the TS driver */ ts_driver->Init(AddressI2C); ts_driver->Start(AddressI2C); return TS_OK; }
/** * @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(); /* Init HID Application */ HID_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Run Application (Blocking mode) */ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* HID Menu Process */ HID_MenuProcess(); } }
/** * @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 200 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Start task */ osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(USER_Thread), NULL); /* Create Application Queue */ osMessageQDef(osqueue, 1, uint16_t); AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
/** * @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(); /* Init Device Library */ USBD_Init(&USBD_Device, &MSC_Desc, 0); /* Add Supported Class */ USBD_RegisterClass(&USBD_Device, USBD_MSC_CLASS); /* Add Storage callbacks for MSC Class */ USBD_MSC_RegisterStorage(&USBD_Device, &USBD_DISK_fops); /* Start Device Process */ USBD_Start(&USBD_Device); /* Run Application (Interrupt mode) */ while (1) { } }
/** * @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(); /* Start task */ osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(USER_Thread), NULL); /* Create Application Queue */ osMessageQDef(osqueue, 1, uint16_t); AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
/** * @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(); /*Initialize the IO module*/ BSP_IO_Init (); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- Link the USB Host disk I/O driver ##################################*/ if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0) { /*##-2- Init Host Library ################################################*/ USBH_Init(&hUSB_Host, USBH_UserProcess, 0); /*##-3- Add Supported Class ##############################################*/ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /*##-4- Start Host Process ###############################################*/ USBH_Start(&hUSB_Host); /*##-5- Run Application (Blocking mode) ##################################*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host); /* Mass Storage Application State Machine */ switch(Appli_state) { case APPLICATION_START: MSC_Application(); Appli_state = APPLICATION_IDLE; break; case APPLICATION_IDLE: default: break; } } } /* Infinite loop */ while (1) { } }
/** * @brief Initializes the SD Detect pin MSP. * @param hsd: SD handle * @param Params * @retval None */ static void SD_Detect_MspInit(void) { if (BSP_IO_Init() == IO_ERROR) { BSP_ErrorHandler(); } BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU); }
/** * @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 Initializes the camera. * @param uint32_t Resolution : camera sensor requested resolution (x, y) : standard resolution * naming QQVGA, QVGA, VGA ... * * @retval Camera status */ uint8_t BSP_CAMERA_Init(uint32_t Resolution) { DCMI_HandleTypeDef *phdcmi; uint8_t status = CAMERA_ERROR; /* Get the DCMI handle structure */ phdcmi = &hDcmiEval; /*** Configures the DCMI to interface with the camera module ***/ /* DCMI configuration */ phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME; phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_HIGH; phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH; phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; phdcmi->Instance = DCMI; /* Configure IO functionalities for CAMERA detect pin */ BSP_IO_Init(); /* Apply Camera Module hardware reset */ BSP_CAMERA_HwReset(); /* Check if the CAMERA Module is plugged on board */ if(BSP_IO_ReadPin(CAM_PLUG_PIN) == BSP_IO_PIN_SET) { status = CAMERA_NOT_DETECTED; return status; /* Exit with error */ } /* Read ID of Camera module via I2C */ if (s5k5cag_ReadID(CAMERA_I2C_ADDRESS) == S5K5CAG_ID) { /* Initialize the camera driver structure */ camera_drv = &s5k5cag_drv; CameraHwAddress = CAMERA_I2C_ADDRESS; /* DCMI Initialization */ BSP_CAMERA_MspInit(&hDcmiEval, NULL); HAL_DCMI_Init(phdcmi); /* Camera Module Initialization via I2C to the wanted 'Resolution' */ camera_drv->Init(CameraHwAddress, Resolution); CameraCurrentResolution = Resolution; /* Return CAMERA_OK status */ status = CAMERA_OK; } else { /* Return CAMERA_NOT_SUPPORTED status */ status = CAMERA_NOT_SUPPORTED; } return status; }
/** * @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 Configures and enables the touch screen interrupts. * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_ITConfig(void) { /* Initialize the IO */ BSP_IO_Init(); /* Enable the TS ITs */ ts_driver->EnableIT(AddressI2C); return TS_OK; }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Unlock the Flash to enable the flash control register access */ FLASH_If_FlashUnlock(); /* Test if User button on the STM32446E_EVAL is pressed */ if (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_SET) { /* Check Vector Table: Test if user code is programmed starting from address "APPLICATION_ADDRESS" */ if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x20000000) { /* Jump to user application */ JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application(); } } /* STM32F446xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Init FW upgrade Application */ FW_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Run Application (Blocking mode)*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* FW Menu Process */ FW_UPGRADE_Process(); } }
/** * @brief Initializes the SD Detect pin MSP. * @param hsd: SD handle * @param Params * @retval None */ static void SD_Detect_MspDeInit(void) { /* Disable all interrupts */ /*HAL_NVIC_DisableIRQ(MFX_INT_EXTI_IRQn);*/ if (BSP_IO_Init() == IO_ERROR) { BSP_ErrorHandler(); } BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_ANALOG); }
/** * @brief Initializes the STM32469I-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize IO expander */ BSP_IO_Init(); /* Initialize STM32469I-EVAL's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); }
/** * @brief Initializes the camera. * @param Camera: Pointer to the camera configuration structure * @retval Camera status */ uint8_t BSP_CAMERA_Init(uint32_t Resolution) { DCMI_HandleTypeDef *phdcmi; uint8_t ret = CAMERA_ERROR; /* Get the DCMI handle structure */ phdcmi = &hdcmi_eval; /*** Configures the DCMI to interface with the camera module ***/ /* DCMI configuration */ phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME; phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_LOW; phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_LOW; phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; phdcmi->Instance = DCMI; /* Configure IO functionalities for camera detect pin */ BSP_IO_Init(); /* Set the camera STANDBY pin */ BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT); BSP_IO_WritePin(XSDN_PIN, SET); /* Check if the camera is plugged */ if(BSP_IO_ReadPin(CAM_PLUG_PIN)) { return CAMERA_ERROR; } /* DCMI Initialization */ DCMI_MspInit(); HAL_DCMI_Init(phdcmi); if(ov2640_ReadID(CAMERA_I2C_ADDRESS) == OV2640_ID) { /* Initialize the camera driver structure */ camera_drv = &ov2640_drv; /* Camera Init */ camera_drv->Init(CAMERA_I2C_ADDRESS, Resolution); /* Return CAMERA_OK status */ ret = CAMERA_OK; } current_resolution = Resolution; return ret; }
/** * @brief Initializes the STM324x9I-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Init IO Expander */ BSP_IO_Init(); /* Enable IO Expander interrupt for ETH MII pin */ BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE); }
/** * @brief Configures and enables the touch screen interrupts. * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_ITConfig(void) { /* Initialize the IO */ BSP_IO_Init(); /* Configure TS IT line IO */ BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_FALLING_EDGE); /* Enable the TS ITs */ tsDriver->EnableIT(I2cAddress); return TS_OK; }
/** * @brief Initializes the STM324x9I-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM324x9I-EVAL's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Init IO Expander */ BSP_IO_Init(); /* Enable IO Expander interrupt for ETH MII pin */ BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE); }
/** * @brief Initializes the SD card device. * @retval SD status */ uint8_t BSP_SD_Init(void) { uint8_t sd_state = MSD_OK; /* PLLSAI is dedicated to LCD periph. Do not use it to get 48MHz*/ /* uSD device interface configuration */ uSdHandle.Instance = SDIO; uSdHandle.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; uSdHandle.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; uSdHandle.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; uSdHandle.Init.BusWide = SDIO_BUS_WIDE_1B; uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE; uSdHandle.Init.ClockDiv = SDIO_TRANSFER_CLK_DIV; /* Configure IO functionalities for SD detect pin */ BSP_IO_Init(); /* Check if the SD card is plugged in the slot */ BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU); if(BSP_SD_IsDetected() != SD_PRESENT) { return MSD_ERROR_SD_NOT_PRESENT; } /* Msp SD initialization */ BSP_SD_MspInit(&uSdHandle, NULL); /* HAL SD initialization */ if(HAL_SD_Init(&uSdHandle, &uSdCardInfo) != SD_OK) { sd_state = MSD_ERROR; } /* Configure SD Bus width */ if(sd_state == MSD_OK) { /* Enable wide operation */ if(HAL_SD_WideBusOperation_Config(&uSdHandle, SDIO_BUS_WIDE_4B) != SD_OK) { sd_state = MSD_ERROR; } else { sd_state = MSD_OK; } } return sd_state; }
/** * @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(); /* Initialize IO expander */ #if defined(USE_IOEXPANDER) BSP_IO_Init(); #endif /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Creates the mutex */ osMutexDef(osMutex); osMutex = osMutexCreate(osMutex(osMutex)); if(osMutex != NULL) { /* Define and create the high priority thread */ osThreadDef(MutHigh, MutexHighPriorityThread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE); osHighPriorityThreadHandle = osThreadCreate(osThread(MutHigh), NULL); /* Define and create the medium priority thread */ osThreadDef(MutMedium, MutexMeduimPriorityThread, osPriorityLow, 0, configMINIMAL_STACK_SIZE); osMediumPriorityThreadHandle = osThreadCreate(osThread(MutMedium), NULL); /* Define and create the low priority thread */ osThreadDef(MutLow, MutexLowPriorityThread, osPriorityIdle, 0, configMINIMAL_STACK_SIZE); osThreadCreate(osThread(MutLow), NULL); } /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
/** * @brief Initializes the STM324x9I-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { #ifdef USE_LCD uint8_t lcd_status = LCD_OK; #endif /* USE_LCD */ /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Init MFX IO Expander */ BSP_IO_Init(); /* Enable MFX IO Expander interrupt for ETH MII pin */ BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE); #ifdef USE_LCD /* 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_SetFont(&LCD_DEFAULT_FONT); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Webserver Application Netconn API"); LCD_LOG_SetFooter((uint8_t *)"STM32469I-EVAL board"); LCD_UsrLog ((char *)" State: Ethernet Initialization ...\n"); #endif /* USE_LCD */ }
/** * @brief Initializes the STM32446E's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize IO expander */ BSP_IO_Init(); /* Initialize STM32446E-EVAL's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable the CRC Module */ __CRC_CLK_ENABLE(); }
/** * @brief Configures and enables the touch screen interrupts. * @param None * @retval TS_OK: if ITconfig is OK. Other value if error. */ uint8_t BSP_TS_ITConfig(void) { uint8_t ret = TS_ERROR; /* Initialize the IO */ ret = BSP_IO_Init(); /* Configure TS IT line IO */ BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_FALLING_EDGE); /* Enable the TS ITs */ TsDrv->EnableIT(TS_I2C_ADDRESS); return ret; }
/** * @brief Configures joystick GPIO and EXTI modes. * @param Joy_Mode: Button mode. * This parameter can be one of the following values: * @arg JOY_MODE_GPIO: Joystick pins will be used as simple IOs * @arg JOY_MODE_EXTI: Joystick pins will be connected to EXTI line * with interrupt generation capability * @retval IO_OK: if all initializations are OK. Other value if error. */ uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode) { uint8_t ret = 0; /* Initialize the IO functionalities */ ret = BSP_IO_Init(); /* Configure joystick pins in IT mode */ if(Joy_Mode == JOY_MODE_EXTI) { /* Configure joystick pins in IT mode */ BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_IT_FALLING_EDGE); } return ret; }
/** * @brief Configurates the BSP. * @param None * @retval None */ static void BSP_Config(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Set Systick Interrupt to the highest priority */ HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0); /* Init IO Expander */ BSP_IO_Init(); /* Enable IO Expander interrupt for ETH MII pin */ BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE); }
/** * @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 200 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Init MSC Application */ MSC_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Register the file system object to the FatFs module */ if(f_mount(&USBH_fatfs, "", 0) != FR_OK) { LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n"); } /* Run Application (Blocking mode) */ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* MSC Menu Process */ MSC_MenuProcess(); } }
/** * @brief Initializes the SD card device. * @param None * @retval SD status. */ uint8_t BSP_SD_Init(void) { uint8_t SD_state = MSD_OK; /* uSD device interface configuration */ uSdHandle.Instance = SDIO; uSdHandle.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; uSdHandle.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; uSdHandle.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; uSdHandle.Init.BusWide = SDIO_BUS_WIDE_1B; uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; uSdHandle.Init.ClockDiv = SDIO_TRANSFER_CLK_DIV; /* Configure IO functionalities for SD detect pin */ BSP_IO_Init(); /* Check if the SD card is plugged in the slot */ if(BSP_SD_IsDetected() != SD_PRESENT) { return MSD_ERROR; } /* HAL SD initialization */ SD_MspInit(); if(HAL_SD_Init(&uSdHandle, &SD_CardInfo) != SD_OK) { SD_state = MSD_ERROR; } /* Configure SD Bus width */ if(SD_state == MSD_OK) { /* Enable wide operation */ if(HAL_SD_WideBusOperation_Config(&uSdHandle, SDIO_BUS_WIDE_4B) != SD_OK) { SD_state = MSD_ERROR; } else { SD_state = MSD_OK; } } return SD_state; }