/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F103xG 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(); /* Configure the system clock to 72 MHz */ SystemClock_Config(); /* Initialize the LEDs */ BSP_LED_Init(LED_GREEN); BSP_LED_Init(LED_ORANGE); BSP_LED_Init(LED_RED); BSP_LED_Init(LED_BLUE); /* Configure the Key push-button in GPIO Mode */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); Display_DemoDescription(); /* Wait For User inputs */ while (1) { if(BSP_PB_GetState(BUTTON_KEY) == GPIO_PIN_RESET) { while (BSP_PB_GetState(BUTTON_KEY) == GPIO_PIN_RESET); BSP_examples[DemoIndex++].DemoFunc(); if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { NbLoop++; DemoIndex = 0; } Display_DemoDescription(); } } }
/** * @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 LED3 and LED4 */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure the system clock to 180 Mhz */ SystemClock_Config(); /* Configure the User Button in EXTI Mode */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); /* Initialise the LCD Layers */ BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER); Display_DemoDescription(); /* Wait For User inputs */ while (1) { if(BSP_PB_GetState(BUTTON_KEY) == RESET) { while (BSP_PB_GetState(BUTTON_KEY) == RESET); BSP_examples[DemoIndex++].DemoFunc(); if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { #ifdef EE_M24LR64 /* Increment number of loops which be used by EEPROM example */ NbLoop++; #endif /* EE_M24LR64 */ DemoIndex = 0; } Display_DemoDescription(); } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint8_t lcd_status = LCD_OK; CPU_CACHE_Enable(); /* STM32F7xx 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 200 Mhz */ SystemClock_Config(); BSP_LED_Init(LED1); /* Configure the User Button in GPIO Mode */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ lcd_status = BSP_LCD_Init(); ASSERT(lcd_status != LCD_OK); /* Initialize the LCD Layers */ BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FRAME_BUFFER); Display_DemoDescription(); /* Wait For User inputs */ while (1) { if (BSP_PB_GetState(BUTTON_KEY) != RESET) { HAL_Delay(10); while (BSP_PB_GetState(BUTTON_KEY) != RESET); BSP_examples[DemoIndex++].DemoFunc(); if (DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { /* Increment number of loops which be used by EEPROM example */ NbLoop++; DemoIndex = 0; } Display_DemoDescription(); } } /* of while (1) */ }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Configure the MPU attributes as Write Through */ MPU_Config(); /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - 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(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); BSP_LED_Init(LED_GREEN); BSP_LED_Init(LED_ORANGE); BSP_LED_Init(LED_RED); BSP_LED_Init(LED_BLUE); /* 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); /* Configure the Tamper push-button in GPIO Mode */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); Display_DemoDescription(); /* Wait For User inputs */ while (1) { if ( mfx_toggle_led == 1) /* Toggle LED */ { BSP_LED_Toggle(LED_GREEN); mfx_toggle_led = 0; } if(BSP_PB_GetState(BUTTON_TAMPER) == GPIO_PIN_SET) { while (BSP_PB_GetState(BUTTON_TAMPER) == GPIO_PIN_SET); BSP_examples[DemoIndex++].DemoFunc(); if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { NbLoop++; DemoIndex = 0; } Display_DemoDescription(); } } }
/** * @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(); BSP_IO_Init(); /* Set camera sensor in Power Down mode */ BSP_CAMERA_PwrDown(); BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); BSP_LED_Toggle(LED4); /* Configure the User Button in GPIO Mode */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* temporary for debugging MFX */ /* BSP_MFX_reg_access_for_debug(); */ /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); Display_DemoDescription(); /* Wait For User inputs */ while (1) { if ( MfxToggleLed == 1) { BSP_LED_Toggle(LED4); MfxToggleLed = 0; } if(BSP_PB_GetState(BUTTON_KEY) != RESET) { HAL_Delay(10); while (BSP_PB_GetState(BUTTON_KEY) != RESET); BSP_examples[DemoIndex++].DemoFunc(); if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { /* Increment number of loops which be used by EEPROM example */ NbLoop++; DemoIndex = 0; } Display_DemoDescription(); } } }
/** * @brief Main program. * @param None * @retval None */ int main(void) { uint8_t count = 0; /* Init HAL */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Retrieve System Core Clock */ SystemCoreClock = HAL_RCC_GetHCLKFreq(); /* Initialize User_Button on STM32F4xx-Nucleo ------------------*/ BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI); /* Check the availability of adafruit 1.8" TFT shield on top of STM32NUCLEO board. This is done by reading the state of IO PF.03 pin (mapped to JoyStick available on adafruit 1.8" TFT shield). If the state of PF.03 is high then the adafruit 1.8" TFT shield is available. */ if(TFT_ShieldDetect() == SHIELD_DETECTED) { #ifdef ADAFRUIT_TFT_JOY_SD_ID802 BSP_LED_Init(LED2); BSP_LED_Init(LED3); /* Initialize the LCD */ BSP_LCD_Init(); Display_DemoDescription(); while (1) { BSP_LED_Toggle(LED2); HAL_Delay(100); if(BSP_PB_GetState(BUTTON_USER) != RESET) { HAL_Delay(10); while (BSP_PB_GetState(BUTTON_USER) != RESET); BSP_examples[DemoIndex++].DemoFunc(); if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples)) { DemoIndex = 0; } Display_DemoDescription(); } } #endif /* ADAFRUIT_TFT_JOY_SD_ID802 */ } else /* there is no AdaFruit shield 802 connected */ { /* Initialize Led1 on STM32F4xx-Nucleo ------------------*/ BSP_LED_Init(LED1); /* this is in conflict with Adafruit shield */ BSP_LED_Init(LED2); BSP_LED_Init(LED3); /* 0. Wait for User button to be pressed -------------------------------------*/ while (BSP_PB_GetState(BUTTON_USER) != KEY_PRESSED) { /* Toggle LED3 */ BSP_LED_Toggle(LED2); HAL_Delay(200); } /* Wait for User button is released */ while (BSP_PB_GetState(BUTTON_USER) != KEY_NOT_PRESSED) {} BSP_LED_Off(LED3); /* Infinite loop */ while (1) { if(UserButtonPressed==0x01) { count++; LedToggleDelay += 20*count; UserButtonPressed = 0x00; if(LedToggleDelay>500) { LedToggleDelay = 20; count = 0; } } /* Toggle LED1 & LED2 */ BSP_LED_Toggle(LED1); HAL_Delay(LedToggleDelay); BSP_LED_Toggle(LED2); HAL_Delay(LedToggleDelay); } } }