日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

野火STM32学习(6)

發布時間:2024/1/1 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 野火STM32学习(6) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編寫置位/復位函數

#ifndef __STM32F4XX_GPIO_H #define __STM32F4XX_GPIO_H#include "stm32f4xx.h"#define GPIO_Pin_0 (1<<0) #define GPIO_Pin_1 (1<<1) #define GPIO_Pin_2 (1<<2) #define GPIO_Pin_3 (1<<3) #define GPIO_Pin_4 (1<<4) #define GPIO_Pin_5 (1<<5) #define GPIO_Pin_6 (1<<6) #define GPIO_Pin_7 (1<<7) #define GPIO_Pin_8 (1<<8) #define GPIO_Pin_9 (1<<9) #define GPIO_Pin_10 (1<<10) #define GPIO_Pin_11 (1<<11) #define GPIO_Pin_12 (1<<12) #define GPIO_Pin_13 (1<<13) #define GPIO_Pin_14 (1<<14) #define GPIO_Pin_15 (1<<15)void GPIO_SetBits( GPIO_TypeDef * GPIOx , uint16_t GPIO_Pin ); void GPIO_ResetBits( GPIO_TypeDef * GPIOx , uint16_t GPIO_Pin );#endif /* __STM32F4XX_GPIO_H */ #include "stm32f4xx_gpio.h"void GPIO_SetBits( GPIO_TypeDef * GPIOx , uint16_t GPIO_Pin ){GPIOx->BSRRL = GPIO_Pin;}void GPIO_ResetBits( GPIO_TypeDef * GPIOx , uint16_t GPIO_Pin ){GPIOx->BSRRH = GPIO_Pin;} #include "stm32f4xx.h" #include "stm32f4xx_gpio.h"int main(void){/* 打開GPIOE的時鐘 */RCC_AHB1ENR |= (1<<4); //寫入1/* GPIOE配置為輸出 */GPIOE->MODER &= ~(0X03<<(2*3)); //清0GPIOE->MODER |= (0X01<<(2*3)); //寫入1/* PE3輸出低電平 */GPIO_ResetBits(GPIOE, GPIO_Pin_3); }void SystemInit(void){}

置位/復位函數實際上與操作ODR寄存器相似,置位寫1,復位寫0

總結

以上是生活随笔為你收集整理的野火STM32学习(6)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。