stm单片机c语言编译,用C++写单片机程序STM32F103+自建固件库+FreeRTOS gcc编译器

本文介绍了一种在STM32F103单片机上使用C++封装RCC寄存器的方法,包括设置时钟源、中断连接和内存管理。通过FreeRTOS操作系统,重载new和delete操作符,并讨论了面向对象编程在嵌入式开发中的应用,以及使用Visual Studio 2019和VisualGDB的开发体验。
摘要由CSDN通过智能技术生成

分享一个

#ifndef RCC_HPP_

#define RCC_HPP_

#include "STM32F103.h"

namespace MCU

{

namespace STM32F103

{

struct RegisterRCC

{

volatile union

{

volatile uint32_t Value;

volatile struct

{

volatile uint32_t HSION : 1;

volatile const uint32_t HSIRDY : 1;

volatile uint32_t RESERVED1 : 1;

volatile uint32_t HSITRIM : 5;

volatile const uint32_t HSICAL : 8;

volatile uint32_t HSEON : 1;

volatile const uint32_t HSERDY : 1;

volatile uint32_t HSEBYP : 1;

volatile uint32_t CSSON : 1;

volatile uint32_t RESERVDE2 : 4;

volatile uint32_t PLLON : 1;

volatile const uint32_t PLLRDY : 1;

volatile uint32_t RESERVDE3 : 6;

}Bit;

}CR;

volatile union

{

volatile uint32_t Value;

volatile struct

{

volatile uint32_t SW : 2;

volatile const uint32_t SWS : 2;

volatile uint32_t HPRE : 4;

volatile uint32_t PPRE1 : 3;

volatile uint32_t PPRE2 : 3;

volatile uint32_t ADCPRE : 2;

volatile uint32_t PLLSRC : 1;

volatile uint32_t PLLXTPRE : 1;

volatile uint32_t PLLMUL : 4;

volatile uint32_t USBPRE : 1;

volatile uint32_t RESERVED1 : 1;

volatile uint32_t MCO : 3;

volatile uint32_t RESERVED2 : 5;

}Bit;

}CFGR;

volatile union

{

volatile uint32_t Value;

volatile struct

{

volatile const uint32_t LSIRDYF : 1;

volatile const uint32_t LSERDYF : 1;

volatile const uint32_t HSIRDYF : 1;

volatile const uint32_t HSERDYF : 1;

volatile const uint32_t PLLRDYF : 1;

volatile const uint32_t PLL2RDYF : 1;

volatile const uint32_t PLL3RDYF : 1;

volatile const uint32_t CSSF : 1;

volatile uint32_t LSIRDYIE : 1;

volatile uint32_t LSERDYIE : 1;

volatile uint32_t HSIRDYIE : 1;

volatile uint32_t HSERDYIE : 1;

volatile uint32_t PLLRDYIE : 1;

volatile const uint32_t PLL2RDYE : 1;

volatile const uint32_t PLL3RDYE : 1;

volatile uint32_t RESERVED1 : 1;

volatile uint32_t LSIRDYC : 1;

volatile uint32_t LSERDYC : 1;

volatile uint32_t HISRDYC : 1;

volatile uint32_t HSERDYC : 1;

volatile uint32_t PLLRDYC : 1;

volatile uint32_t PLL2RDYC : 1;

volatile uint32_t PLL3RDYC : 1;

volatile uint32_t CSSC : 1;

volatile uint32_t RESERVED2 : 8;

}Bit;

}CIR;

volatile union

{

volatile uint32_t Value;

volatile struct

{

volatile uint16_t AFIORST : 1;

volatile uint16_t RESERVED1 : 1;

volatile uint16_t IOPARST : 1;

volatile uint16_t IOPBRST : 1;

volatile uint16_t IOPCRST : 1;

volatile uint16_t IOPDRST : 1;

volatile uint16_t IOPERST : 1;

volatile uint16_t IOPFRST : 1;

volatile uint16_t IOPGRST : 1;

volatile uint16_t ADC1RST : 1;

volatile uint16_t AD

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值