日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當前位置:首頁 > 單片機 > 單片機
[導讀] 這幾天看了下 mbed 的源碼,給上層應用調用的接口封裝的還是不錯的。代碼質量比較高,注釋也很詳細,文檔和例程比較全。但是驅動層的程序全是 C 語言編寫的,代碼質量就沒有那么高了,注釋比較少而且不

這幾天看了下 mbed 的源碼,給上層應用調用的接口封裝的還是不錯的。代碼質量比較高,注釋也很詳細,文檔和例程比較全。但是驅動層的程序全是 C 語言編寫的,代碼質量就沒有那么高了,注釋比較少而且不規(guī)范,比較懷疑 mbed 的穩(wěn)定性。mbed 的實時內(nèi)核是用的 RTX5 ,文件系統(tǒng)用的 FatFs ,還有一些開源的協(xié)議棧,整套系統(tǒng)比較繁雜。mbed 框架是為物聯(lián)網(wǎng)設備開發(fā)的,工業(yè)控制級別的產(chǎn)品可以考慮用 RTE 框架。RTE 框架目前驅動層程序還不太完善,有好多需要自己去實現(xiàn),可能在過一段時間會好一些吧??傊锫?lián)網(wǎng)產(chǎn)品可以用 mbed ,工業(yè)控制產(chǎn)品可以用 RTE 。這幾天封裝了 EXTI ,距離整套系統(tǒng)可以產(chǎn)生生產(chǎn)力還有很長的距離要走,我也不知道整個系統(tǒng)會成什么樣子,我能堅持多久,不管了先做再說。在這里分享我的 STM32F4 C++ 封裝之旅。今天分享《STM32F4 C++ 封裝庫 之 EXTI》,直接上代碼了~

stm32f4xx_xexti.h 文件

/**

******************************************************************************

* file stm32f4xx_xexti.h

* author XinLi

* version v1.0

* date 20-March-2018

* brief Header file for external interrupt/event controller module.

******************************************************************************

* attention

*

*

Copyright © 2018 XinLi

*

* This program is free software: you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation, either version 3 of the License, or

* (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program. If not, see .

*

******************************************************************************

*/

#ifndef STM32F4XX_XEXTI_H

#define STM32F4XX_XEXTI_H

#include "stm32f4xx_ll_exti.h"

/*! External interrupt/event controller module. */

class XExti

{

public:

/*! Enumerate of EXTI lines. */

enum ExtiLine

{

Line0 = LL_EXTI_LINE_0, /*!< EXTI line 0. */

Line1 = LL_EXTI_LINE_1, /*!< EXTI line 1. */

Line2 = LL_EXTI_LINE_2, /*!< EXTI line 2. */

Line3 = LL_EXTI_LINE_3, /*!< EXTI line 3. */

Line4 = LL_EXTI_LINE_4, /*!< EXTI line 4. */

Line5 = LL_EXTI_LINE_5, /*!< EXTI line 5. */

Line6 = LL_EXTI_LINE_6, /*!< EXTI line 6. */

Line7 = LL_EXTI_LINE_7, /*!< EXTI line 7. */

Line8 = LL_EXTI_LINE_8, /*!< EXTI line 8. */

Line9 = LL_EXTI_LINE_9, /*!< EXTI line 9. */

Line10 = LL_EXTI_LINE_10, /*!< EXTI line 10. */

Line11 = LL_EXTI_LINE_11, /*!< EXTI line 11. */

Line12 = LL_EXTI_LINE_12, /*!< EXTI line 12. */

Line13 = LL_EXTI_LINE_13, /*!< EXTI line 13. */

Line14 = LL_EXTI_LINE_14, /*!< EXTI line 14. */

Line15 = LL_EXTI_LINE_15, /*!< EXTI line 15. */

#ifdef LL_EXTI_LINE_16

Line16 = LL_EXTI_LINE_16, /*!< EXTI line 16. */

#endif

#ifdef LL_EXTI_LINE_17

Line17 = LL_EXTI_LINE_17, /*!< EXTI line 17. */

#endif

#ifdef LL_EXTI_LINE_18

Line18 = LL_EXTI_LINE_18, /*!< EXTI line 18. */

#endif

#ifdef LL_EXTI_LINE_19

Line19 = LL_EXTI_LINE_19, /*!< EXTI line 19. */

#endif

#ifdef LL_EXTI_LINE_20

Line20 = LL_EXTI_LINE_20, /*!< EXTI line 20. */

#endif

#ifdef LL_EXTI_LINE_21

Line21 = LL_EXTI_LINE_21, /*!< EXTI line 21. */

#endif

#ifdef LL_EXTI_LINE_22

Line22 = LL_EXTI_LINE_22, /*!< EXTI line 22. */

#endif

#ifdef LL_EXTI_LINE_23

Line23 = LL_EXTI_LINE_23, /*!< EXTI line 23. */

#endif

#ifdef LL_EXTI_LINE_24

Line24 = LL_EXTI_LINE_24, /*!< EXTI line 24. */

#endif

#ifdef LL_EXTI_LINE_25

Line25 = LL_EXTI_LINE_25, /*!< EXTI line 25. */

#endif

#ifdef LL_EXTI_LINE_26

Line26 = LL_EXTI_LINE_26, /*!< EXTI line 26. */

#endif

#ifdef LL_EXTI_LINE_27

Line27 = LL_EXTI_LINE_27, /*!< EXTI line 27. */

#endif

#ifdef LL_EXTI_LINE_28

Line28 = LL_EXTI_LINE_28, /*!< EXTI line 28. */

#endif

#ifdef LL_EXTI_LINE_29

Line29 = LL_EXTI_LINE_29, /*!< EXTI line 29. */

#endif

#ifdef LL_EXTI_LINE_30

Line30 = LL_EXTI_LINE_30, /*!< EXTI line 30. */

#endif

#ifdef LL_EXTI_LINE_31

Line31 = LL_EXTI_LINE_31, /*!< EXTI line 31. */

#endif

};

/*! Enumerate of EXTI modes. */

enum ExtiMode

{

ModeInterrupt = LL_EXTI_MODE_IT, /*!< EXTI interrupt mode. */

ModeEvent = LL_EXTI_MODE_EVENT, /*!< EXTI event mode. */

ModeInterruptEvent = LL_EXTI_MODE_IT_EVENT, /*!< EXTI interrupt and event mode. */

};

/*! Enumerate of EXTI triggers. */

enum ExtiTrigger

{

TriggerNone = LL_EXTI_TRIGGER_NONE, /*!< EXTI none trigger. */

TriggerRising = LL_EXTI_TRIGGER_RISING, /*!< EXTI rising trigger. */

TriggerFalling = LL_EXTI_TRIGGER_FALLING, /*!< EXTI falling trigger. */

TriggerRisingFalling = LL_EXTI_TRIGGER_RISING_FALLING, /*!< EXTI rising and falling trigger. */

};

XExti(ExtiLine line, ExtiMode mode, ExtiTrigger trigger = TriggerNone);

virtual ~XExti();

void setLine(ExtiLine line);

ExtiLine getLine() const;

void setMode(ExtiMode mode);

ExtiMode getMode() const;

void setTrigger(ExtiTrigger trigger);

ExtiTrigger getTrigger() const;

void setFlag();

void clearFlag();

bool isFlagSet() const;

bool open();

void close();

bool isOpen() const;

private:

ExtiLine line;

ExtiMode mode;

ExtiTrigger trigger;

bool openFlag;

XExti(const XExti &) = delete;

XExti & operator = (const XExti &) = delete;

};

#endif // STM32F4XX_XEXTI_H


stm32f4xx_xexti.cpp 文件

/**

******************************************************************************

* file stm32f4xx_xexti.cpp

* author XinLi

* version v1.0

* date 20-March-2018

* brief External interrupt/event controller module driver.

******************************************************************************

* attention

*

*

Copyright © 2018 XinLi

*

* This program is free software: you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation, either version 3 of the License, or

* (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program. If not, see .

*

******************************************************************************

*/

本站聲明: 本文章由作者或相關機構授權發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內(nèi)容真實性等。需要轉載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權益,請及時聯(lián)系本站刪除。
換一批
延伸閱讀

Sept. 10, 2025 ---- 根據(jù)TrendForce集邦咨詢最新發(fā)布的《全球電動車逆變器市場數(shù)據(jù)》,2025年第二季受惠純電動車(BEV)銷售成長,全球電動車(注1)牽引逆變器裝機量達766萬臺,年增19%。...

關鍵字: 增程式電動車 SiC 牽引逆變器

Sept. 8, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調查,2025年第二季NVIDIA(英偉達) Blackwell平臺規(guī)?;鲐?,以及北美CSP業(yè)者持續(xù)擴大布局General Server(通用型...

關鍵字: SSD DDR4 服務器

Sept. 4, 2025 ---- Apple(蘋果)即將發(fā)布iPhone 17、iPhone 17 Air(暫名)、iPhone 17 Pro及Pro Max四款旗艦新機,除了外觀辨識度升級,處理器性能、散熱和拍攝功...

關鍵字: iPhone 16 A19處理器 折疊機

Sept. 3, 2025 ---- 根據(jù)TrendForce集邦咨詢最新發(fā)布的《2025近眼顯示市場趨勢與技術分析》報告,2025年隨著國際品牌陸續(xù)推出AR眼鏡原型,以及Meta預計在近期發(fā)布AR眼鏡Celeste,市...

關鍵字: AR眼鏡 OLED

Sept. 2, 2025 ---- TrendForce集邦咨詢表示,2025年第二季DRAM產(chǎn)業(yè)因一般型DRAM (Conventional DRAM)合約價上漲、出貨量顯著增長,加上HBM出貨規(guī)模擴張,整體營收為3...

關鍵字: DRAM 智能手機 ASP

Sept. 1, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調查,2025年第二季因中國市場消費補貼引發(fā)的提前備貨效應,以及下半年智能手機、筆電/PC、Server新品所需帶動,整體晶圓代工產(chǎn)能利用率與出貨...

關鍵字: 晶圓代工 智能手機 筆電

Aug. 28, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調查,2025年第二季NAND Flash產(chǎn)業(yè)雖面臨平均銷售價格(ASP)小幅下滑,所幸原廠減產(chǎn)策略緩解供需失衡,疊加中、美兩大市場政策推動,整體...

關鍵字: NAND Flash SSD AI

Aug. 26, 2025 ---- NVIDIA(英偉達)近日推出的Jetson Thor被視為機器人的物理智慧核心,以Blackwell GPU、128 GB記憶體堆疊出2070 FP4 TFLOPS AI算力,是前...

關鍵字: 機器人 大型語言模型 AI算力

Aug. 21, 2025 ---- 根據(jù)TrendForce集邦咨詢最新液冷產(chǎn)業(yè)研究,隨著NVIDIA GB200 NVL72機柜式服務器于2025年放量出貨,云端業(yè)者加速升級AI數(shù)據(jù)中心架構,促使液冷技術從早期試點邁...

關鍵字: AI 數(shù)據(jù)中心 服務器

除了充電電路外,鋰電池的放電過程也需要保護。鋰電池的放電電壓不能低于3.0V,否則電池壽命會大幅縮短。為了實現(xiàn)這一保護,工程師們設計了DW01芯片與8205 MOS管的電路組合。DW01芯片能夠監(jiān)控鋰電池的放電電壓和電流...

關鍵字: 鋰電池 電池
關閉