本文整理汇总了C++中MX_GPIO_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ MX_GPIO_Init函数的具体用法?C++ MX_GPIO_Init怎么用?C++ MX_GPIO_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MX_GPIO_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startup_task
void startup_task (void *pvParameters)
{
(void) pvParameters;
MX_GPIO_Init();
/* Init Device Library */
USBD_Init(&hUsbDeviceFS, &VCP_Desc, 0);
/* Add Supported Class */
USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC);
/* Add CDC Interface Class */
USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS);
/* Start Device Process */
USBD_Start(&hUsbDeviceFS);
xdev_out(putchar);
MX_SDIO_SD_Init();
FATFS_LinkDriver(&SD_Driver, SD_Path);
fsInit();
vTaskDelete(NULL);
}
示例2: SleepMode
void SleepMode(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* Disable all GPIOs to reduce power */
MX_GPIO_Deinit();
/* Configure User push-button as external interrupt generator */
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
HAL_UART_DeInit(&huart2);
/* Suspend Tick increment to prevent wakeup by Systick interrupt.
Otherwise the Systick interrupt will wake up the device within 1ms (HAL time base) */
HAL_SuspendTick();
__HAL_RCC_PWR_CLK_ENABLE();
/* Request to enter SLEEP mode */
HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
/* Resume Tick interrupt if disabled prior to sleep mode entry*/
HAL_ResumeTick();
/* Reinitialize GPIOs */
MX_GPIO_Init();
/* Reinitialize UART2 */
MX_USART2_UART_Init();
}
示例3: main
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_CAN_Init();
MX_I2C1_Init();
MX_USART3_UART_Init();
MX_USART2_UART_Init();
MX_USART1_UART_Init();
MX_TIM1_Init();
USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
USBD_RegisterClass(&hUsbDeviceFS, &USBD_CUSTOM_HID);
USBD_CUSTOM_HID_RegisterInterface(&hUsbDeviceFS, &USBD_CustomHID_fops_FS);
USBD_Start(&hUsbDeviceFS);
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_1);
HAL_Delay(blinkingDelay);
}
/* USER CODE END 3 */
}
示例4: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_TIM1_Init();
HAL_TIM_Base_Start_IT(&htim1);
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
// uint32_t ticksPassed = 0;
// if (GPIOA->IDR & 0x01) {
// uint32_t ticksPassed = 0;
// while (GPIOA->IDR & 0x01) {
// ticksPassed++;
// }
// SysTick_Config(ticksPassed);
// }
// if (GPIOA->IDR & 0x01) {
//
// }
/* USER CODE END WHILE */
// GPIOE->ODR ^= 0x0000FF00;
// int i = 0;
// while (i < 1000000) {
// i++;
// }
// HAL_GPIO_TogglePin(GPIOE, 0xFF00);
// HAL_Delay(1000);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例5: main
int main(void)
{
/* USER CODE BEGIN 1 */
uint8_t Buf[0x10],Buf1[0x10];
uint16_t i;
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
trace_printf("Hello\n");
BSP_UART_Init(115200);
/* Initialize I2C */
ASK25_I2C1_Init();
/* Initialize virtual com port */
BSP_VCP_Init();
vgetche(BLOCKING); // Dummy read to get the VCP Connected
for(i=0;i<sizeof(Buf);i++)
{
Buf[i] = i;
}
/* Write Array to EEPROM */
ASK25_AT24C16_Write(0x106,Buf,sizeof(Buf));
/* Read from EEPROM */
ASK25_AT24C16_Read(0x106,Buf1,sizeof(Buf1));
/* Print to virtual Com port */
ASK25_AT24C16_Display_Array(Buf1,sizeof(Buf1));
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例6: Nucleo_BSP_Init
void Nucleo_BSP_Init() {
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
}
示例7: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
char ch;
ch = 'x';
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 100);
sprintf(strbuf,"Hello\n");
uint32_t adcvals[5];
HAL_ADC_Start(&hadc);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_ADC_Start(&hadc);
for (int i=0;i<3;i++){
while(HAL_IS_BIT_CLR(hadc.Instance->ISR, (ADC_FLAG_EOC|ADC_FLAG_EOS))){}
adcvals[i] = hadc.Instance->DR;
}
for (int i=0;i<5;i++){
sprintf(strbuf,"i:%d,adc:%4d ",i,adcvals[i]);
HAL_UART_Transmit(&huart1,strbuf,strlen(strbuf),1000);
}
sprintf(strbuf,"\n");
HAL_UART_Transmit(&huart1,strbuf,strlen(strbuf),1000);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
示例8: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
LCD_Init(2, 20);
LCD_PrintString(0, 0, "Damogran Labs");
Encoder_Init(&encoder1, ENC1_A_GPIO_Port, ENC1_A_Pin, ENC1_B_GPIO_Port, ENC1_B_Pin);
Encoder_Init(&encoder2, ENC2_A_GPIO_Port, ENC2_A_Pin, ENC2_B_GPIO_Port, ENC2_B_Pin);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
LCD_PrintNumber(1, 0, encoder1.abs_rot);
LCD_PrintNumber(1, 6, encoder2.abs_rot);
while (1)
{
if(Encoder_GetState(&encoder1)){
LCD_PrintString(1, 0, " ");
LCD_PrintNumber(1, 0, encoder1.abs_rot);
}
if(Encoder_GetState(&encoder2)){
LCD_PrintString(1, 6, " ");
LCD_PrintNumber(1, 6, encoder2.abs_rot);
}
if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0) == GPIO_PIN_SET){
Encoder_SetAbsToZero(&encoder1);
Encoder_SetAbsToZero(&encoder2);
}
HAL_Delay(100);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例9: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_I2C2_Init();
MX_RTC_Init();
MX_SPI1_Init();
MX_SPI3_Init();
MX_USB_OTG_FS_PCD_Init();
//HAL_SPI_MspInit(&hspi3);
/* USER CODE BEGIN 2 */
//begin();
//setWrap(false);
//fillRect(0,0,128,20,ColorHSV(1200,255,255));
// USART_TypeDef USB_UART;
// HAL_UART_MspInit(&USB_UART);
// HAL_UART_Init(&USB_UART);
/* USER CODE END 2 */
/* Infinite loop */
char test[5]= "test";
/* USER CODE BEGIN WHILE */
while (1)
{
// fillRect(0,0,128,128,ColorHSV(1200,255,255));
HAL_GPIO_WritePin(RED_GPIO_Port, RED_Pin, GPIO_PIN_SET);
HAL_Delay(500);
HAL_GPIO_WritePin(RED_GPIO_Port, RED_Pin, GPIO_PIN_RESET);
HAL_Delay(500);
}
/* USER CODE END 3 */
}
示例10: main
int main(void)
{
/* USER CODE BEGIN 1 */
uint8_t data1[0x10],data2[0x10],i;
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
trace_printf("Hello\n");
BSP_UART_Init(115200);
/* Initialize SPI */
ASK25_SPI1_Init();
/* Initialize virtual com port */
BSP_VCP_Init();
vgetche(BLOCKING); // Dummy read to get the VCP Connected
ASK25_25AA160A_Write_Status_Reg(0x00);
for(i=0;i<sizeof(data1);i++)
{
data1[i] = i;
}
/* Write Array to EEPROM */
ASK25_25AA160A_Write(0x0000,data1,sizeof(data1));
/* Read from EEPROM */
ASK25_25AA160A_Read(0x0000,data2,sizeof(data2));
/* Print to virtual Com port */
ASK25_25AA160A_Display_Array(data2,sizeof(data2));
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例11: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_I2C3_Init();
MX_TIM1_Init();
MX_TIM2_Init();
MX_TIM3_Init();
MX_TIM4_Init();
MX_TIM5_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
MX_TIM11_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_Base_Start_IT(&htim11); // 100 msec timer
initSonar( MAX_SONAR);
initSerOutput();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
// >>>>> Sonar reading
triggerSonar( COUPLE_0_2);
HAL_Delay(49);
triggerSonar( COUPLE_1_3);
HAL_Delay(49);
// <<<<< Sonar reading
// >>>>> Serial Output
convertMeasures();
sendMeasures();
// <<<<< Serial Output
}
/* USER CODE END 3 */
}
示例12: main
int main(void)
{
/* USER CODE BEGIN 1 */
USBD_StatusTypeDef result = USBD_OK;
uint32_t userSw_old = 0;
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);
userSw_old = BSP_PB_GetState(BUTTON_USER);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_Delay(40);
BSP_LED_Toggle(LED4);
if ((BSP_PB_GetState(BUTTON_USER) == GPIO_PIN_SET) && (userSw_old == GPIO_PIN_RESET))
{
result = CDC_Transmit_FS(USB_TxBufferFS, sizeof(USB_TxBufferFS));
}
userSw_old = BSP_PB_GetState(BUTTON_USER);
/* USB Error */
if (result != USBD_OK)
{
while (1)
{
BSP_LED_On(LED3);
HAL_Delay(100);
}
}
}
/* USER CODE END 3 */
}
示例13: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_I2S2_Init();
MX_SDIO_SD_Init();
MX_FATFS_Init();
/* USER CODE BEGIN 2 */
printf("Init complete");
//WavePlayerStartSample();
while((res=f_mount (&fatfs, SD_Path, 1))!=FR_OK)
{
printf("QQ");
}
WavePlayerStart_DMA("0:/akuno.wav");
//playindex=rand()%6;
/*switch(playindex)
{
case :
WavePlayerStart_DMA("0:/test.wav");
break;
case 1:
WavePlayerStart_DMA("0:/akuno.wav");
break;
default:
WavePlayerStart_DMA("0:/akuno.wav");
break;
}*/
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//WavePlayerStart_DMA("0:/test.wav");
}
/* USER CODE END 3 */
}
示例14: main
int main(void)
{
/* USER CODE BEGIN 1 */
trace_printf("Hello\n");
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
BSP_PB_Init(BUTTON_KEY,BUTTON_MODE_EXTI); // initialize on board switch
BSP_LED_Init(LED5); // initialize on baord LED 4 and LED 5
BSP_LED_Init(LED4);
/* Check if the system has resumed from WWDG reset */
if(__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET)
{
/* WWDGRST flag set: Turn LED1 on */
BSP_LED_On(LED5);
/* Clear reset flags */
__HAL_RCC_CLEAR_RESET_FLAGS();
}
else
{
/* WWDGRST flag is not set: Turn LED1 off */
BSP_LED_Off(LED5);
}
/* Initialize and start IWDG */
BSP_IWDG_Init(2000);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
BSP_LED_Toggle(LED4);
HAL_Delay(1850);
/* Refresh the IWDG reload count value */
HAL_IWDG_Refresh(&hiwdg_bsp);
}
/* USER CODE END 3 */
}
示例15: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_USART6_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_ADC_Start_IT(&hadc1);
//Zonder DMA (op interrupt)
// while(counter < 2)HAL_GPIO_WritePin(GPIOD,LD6_Pin,GPIO_PIN_SET);
//HAL_GPIO_WritePin(GPIOD,LD6_Pin,GPIO_PIN_RESET);
if(counter == BUFFER_LENGTH * 2) {
Uart_transmit(BufferPin1);
Uart_transmit(BufferPin2);
counter = 0;
}
/*if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0))
{
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOD,LD3_Pin,GPIO_PIN_SET);//GREEN
//zonder DMA Single Scan
sprintf(buffer,"pin a1: %05d ",val1);
HAL_UART_Transmit(&huart6,(uint8_t*) buffer,strlen(buffer),HAL_MAX_DELAY);
sprintf(buffer,"pin a2: %05d ",val2);
HAL_UART_Transmit(&huart6,(uint8_t*) buffer,strlen(buffer),HAL_MAX_DELAY);
HAL_UART_Transmit(&huart6,"\r\n",strlen("\r\n"),HAL_MAX_DELAY);
}*/
}
/* USER CODE END 3 */
}