__HAL_RCC_GPIOB_CLK_ENABLE();/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOF...
清屏 HAL_GPIO_WritePin(GPIOA, OLED_DC_PIN, GPIO_PIN_RESET); // 选择命令模式 HAL_GPIO_WritePin(GPIOA, OLED_CS_PIN, GPIO_PIN_RESET); // 选中 OLED uint8_t clear_cmd[] = {0x20, 0x00, 0x00}; // 清屏命令(假设) HAL_SPI_Transmit(&hspi1, clear_cmd, sizeof(clear_cmd), ...
#define LED_PIN GPIO_PIN_5 #define LED_PORT GPIOA // GPIO初始化代码 void MX_GPIO_Init(void) { // GPIOA时钟使能 __HAL_RCC_GPIOA_CLK_ENABLE(); // 配置GPIOA Pin5为输出模式 GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitStruct.Pin = LED_PIN; GPIO_InitStruct.Mode = GPIO_MODE...
__HAL_RCC_GPIOB_CLK_ENABLE();/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOF...
= GPIO_MODE_OUTPUT_PP; HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct); } int main(void) { HAL_Init(); MX_GPIO_Init(); while (1) { HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_SET); HAL_Delay(500); HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET); HAL_Delay(500); }...
stm32中断挂起函数 void NVIC_SetPendingIRQ (IRQn_t IRQn)?6.1 NVIC简介 中断是一个非常重要...