[chore] 初始化16DOF分支目录结构
This commit is contained in:
+26
-19
@@ -1,30 +1,37 @@
|
|||||||
# Local third-party references (not published)
|
# Local reference material
|
||||||
/00_reference/
|
/00_reference/
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
|
||||||
|
# Build outputs
|
||||||
|
build/
|
||||||
|
install/
|
||||||
|
devel/
|
||||||
|
log/
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
*.a
|
||||||
|
*.elf
|
||||||
|
*.hex
|
||||||
|
*.bin
|
||||||
|
*.axf
|
||||||
|
|
||||||
|
# Training outputs
|
||||||
|
logs/
|
||||||
|
checkpoints/
|
||||||
|
wandb/
|
||||||
|
|
||||||
# IDE and operating system files
|
# IDE and operating system files
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.trae/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Keil generated output and user state
|
|
||||||
**/Project/output/
|
|
||||||
**/Project/RoboMentors_Board/
|
|
||||||
**/Project/DebugConfig/
|
|
||||||
**/Project/.trae/
|
|
||||||
04_firmware/**/*.axf
|
|
||||||
04_firmware/**/*.crf
|
|
||||||
04_firmware/**/*.d
|
|
||||||
04_firmware/**/*.dep
|
|
||||||
04_firmware/**/*.lnp
|
|
||||||
04_firmware/**/*.map
|
|
||||||
04_firmware/**/*.htm
|
|
||||||
04_firmware/**/*.log
|
|
||||||
04_firmware/**/*.uvoptx
|
|
||||||
04_firmware/**/*.uvguix.*
|
|
||||||
04_firmware/**/JLinkSettings.ini
|
|
||||||
04_firmware/**/JLinkLog.txt
|
|
||||||
|
|
||||||
# Temporary and backup files
|
# Temporary and backup files
|
||||||
*.Bak
|
*.Bak
|
||||||
~$*
|
~$*
|
||||||
|
|||||||
+8
-6
@@ -1,12 +1,14 @@
|
|||||||
# 项目文档
|
# 项目文档
|
||||||
|
|
||||||
本目录保存 RC_WheelLeg 8DOF 版本自身的详细说明,即不适合全部放入顶层 README 的内容。
|
本目录用于保存 16DOF 轮足项目自身的技术文档和使用说明。
|
||||||
|
|
||||||
|
后续建议按主题组织:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
01_doc/
|
01_doc/
|
||||||
├─ control/ # 运动学、姿态、运动和力控分析
|
├─ architecture/ # 系统架构和数据流
|
||||||
├─ firmware/ # CAN、DBUS、电机协议和工程结构
|
├─ control/ # 控制与强化学习原理
|
||||||
└─ user_guide/ # 本机器人使用说明
|
├─ deployment/ # Sim2Sim 和 Sim2Real 部署
|
||||||
|
├─ hardware/ # 接线、标定和硬件兼容性
|
||||||
|
└─ user_guide/ # 安装、运行和调试说明
|
||||||
```
|
```
|
||||||
|
|
||||||
本目录只保存当前项目自身的技术文档和使用说明。
|
|
||||||
|
|||||||
@@ -1,362 +0,0 @@
|
|||||||
# 四足机器人从位控转为力控的建议与实施方案
|
|
||||||
|
|
||||||
## 1. 当前系统本质上是什么控制
|
|
||||||
|
|
||||||
你现在这套程序不是“纯位控”,而是**位置主导 + 力矩辅助**。
|
|
||||||
|
|
||||||
从代码上看:
|
|
||||||
|
|
||||||
- `User/app/lingzu_task.c` 负责状态机、站立/趴下/行走切换
|
|
||||||
- `User/driver/Movement.c` 负责步态、IK、VMC 力矩计算
|
|
||||||
- `User/driver/leg.c` 已经有正逆运动学、Jacobian 对应关系
|
|
||||||
- `User/driver/lingzu_motor.c` 发送给 RS02 的指令包含:
|
|
||||||
- `position`
|
|
||||||
- `speed`
|
|
||||||
- `kp`
|
|
||||||
- `kd`
|
|
||||||
- `torque`
|
|
||||||
|
|
||||||
这说明你当前已经具备了向力控过渡的基础,不是从零开始。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. 你说的“力控”要先明确是哪一种
|
|
||||||
|
|
||||||
建议先区分三类目标:
|
|
||||||
|
|
||||||
### 2.1 关节力矩控制
|
|
||||||
直接控制每个关节输出的力矩 `tau`。
|
|
||||||
|
|
||||||
特点:
|
|
||||||
- 最底层
|
|
||||||
- 柔顺性强
|
|
||||||
- 最难调
|
|
||||||
- 风险最大
|
|
||||||
|
|
||||||
### 2.2 足端力控制
|
|
||||||
控制足端对地的作用力,例如支撑力、推进力。
|
|
||||||
|
|
||||||
特点:
|
|
||||||
- 更适合四足
|
|
||||||
- 需要 Jacobian:
|
|
||||||
|
|
||||||
\[
|
|
||||||
\tau = J^T F
|
|
||||||
\]
|
|
||||||
|
|
||||||
### 2.3 力位混合 / 阻抗控制 / VMC
|
|
||||||
仍然保留目标位置,但不再靠高刚度死跟位置,而是通过虚拟弹簧阻尼计算力,再映射成关节力矩。
|
|
||||||
|
|
||||||
特点:
|
|
||||||
- 最适合你当前项目
|
|
||||||
- 最稳妥
|
|
||||||
- 最容易逐步落地
|
|
||||||
|
|
||||||
### 结论
|
|
||||||
**建议优先做“力位混合控制”,而不是一步切到纯力矩控制。**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. 你现在已经有的基础
|
|
||||||
|
|
||||||
### 3.1 电机接口已经支持 torque
|
|
||||||
`User/driver/lingzu_motor.c` 中,发送控制时已经把 `torque` 编码进 CAN 指令。
|
|
||||||
|
|
||||||
### 3.2 已有反馈量
|
|
||||||
你已经能读到:
|
|
||||||
- 位置 `current_position_f`
|
|
||||||
- 速度 `current_speed_f`
|
|
||||||
- 力矩 `current_torque_f`
|
|
||||||
- 温度 `current_temp_f`
|
|
||||||
|
|
||||||
### 3.3 已有运动学模型
|
|
||||||
`User/driver/leg.c` 已经提供:
|
|
||||||
- `Inverse_Calculation()`
|
|
||||||
- `FK_LegPosition()`
|
|
||||||
- `FK_LegVelocity()`
|
|
||||||
|
|
||||||
### 3.4 已有初步 VMC 框架
|
|
||||||
`User/driver/Movement.c` 中已经有:
|
|
||||||
- `vmc_legacy_torque()`
|
|
||||||
- `vmc_full_torque()`
|
|
||||||
|
|
||||||
也就是说,你已经有:
|
|
||||||
- 电机力矩入口
|
|
||||||
- 状态反馈
|
|
||||||
- Jacobian 所需模型
|
|
||||||
- 初步足端力控制框架
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. 真正切换前必须收集的信息
|
|
||||||
|
|
||||||
## 4.1 电机 torque 通道真实性
|
|
||||||
这是最重要的。
|
|
||||||
|
|
||||||
你必须确认 RS02 的 `torque` 到底是什么:
|
|
||||||
|
|
||||||
1. 真正关节输出力矩?
|
|
||||||
2. 电流等效量?
|
|
||||||
3. 只是内部位置环的前馈项?
|
|
||||||
|
|
||||||
### 你必须验证的问题
|
|
||||||
当你设置:
|
|
||||||
- `kp = 0`
|
|
||||||
- `kd = 0`
|
|
||||||
- `speed = 0`
|
|
||||||
- `position = 0`
|
|
||||||
- `torque = 非0`
|
|
||||||
|
|
||||||
电机是否仍能稳定输出可控力矩?
|
|
||||||
|
|
||||||
如果答案是否定的,那么就不能做真正纯 torque 控制,只能做力位混合。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4.2 torque 反馈是否可信
|
|
||||||
你还要确认:
|
|
||||||
|
|
||||||
- `current_torque_f` 单位是不是 Nm
|
|
||||||
- 是估算值还是直接测得
|
|
||||||
- 噪声有多大
|
|
||||||
- 延迟有多大
|
|
||||||
- 正负号是否一致
|
|
||||||
|
|
||||||
如果反馈不可靠,闭环力控会很难做。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4.3 机械参数是否足够准确
|
|
||||||
力控对模型更敏感,所以要重新确认:
|
|
||||||
|
|
||||||
1. `L1`、`L2`
|
|
||||||
2. 大腿/小腿零点
|
|
||||||
3. 左右腿符号方向
|
|
||||||
4. 同步带耦合关系
|
|
||||||
5. 力矩正方向对应真实腿部运动方向
|
|
||||||
6. 机械摩擦、死区、间隙
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4.4 控制频率和总延迟
|
|
||||||
力控对频率要求更高。
|
|
||||||
|
|
||||||
必须明确:
|
|
||||||
- 控制循环周期是多少
|
|
||||||
- 电机反馈周期是多少
|
|
||||||
- CAN 总线延迟是多少
|
|
||||||
- 从“采样反馈”到“发出新 torque”总共延迟多少
|
|
||||||
|
|
||||||
如果实际闭环频率偏低,纯力控会很难稳定。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4.5 接触判断能力
|
|
||||||
四足做支撑腿力控时,需要知道哪条腿真正接地。
|
|
||||||
|
|
||||||
你现在没有足底力传感器,所以至少要有估计方法:
|
|
||||||
- 关节力矩突变
|
|
||||||
- 足端速度突然降低
|
|
||||||
- 足端高度达到接地阈值
|
|
||||||
- IMU 机身姿态/加速度辅助判断
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. 我建议你按什么路线做
|
|
||||||
|
|
||||||
## 第一阶段:低刚度位控 + 力矩前馈
|
|
||||||
这是最稳的第一步。
|
|
||||||
|
|
||||||
### 核心思路
|
|
||||||
保留:
|
|
||||||
- 步态规划
|
|
||||||
- IK 目标角
|
|
||||||
|
|
||||||
但降低位置刚度:
|
|
||||||
- `kp` 下降
|
|
||||||
- `kd` 下降
|
|
||||||
- `torque` 增强
|
|
||||||
|
|
||||||
### 目标
|
|
||||||
把机器人从“硬跟随”变成“柔顺跟随”。
|
|
||||||
|
|
||||||
### 先做什么
|
|
||||||
1. 静站重力补偿
|
|
||||||
2. 支撑腿附加支撑力矩
|
|
||||||
3. 落地缓冲 torque
|
|
||||||
4. 摆动腿保持较轻位置跟踪
|
|
||||||
|
|
||||||
这是最适合你现阶段的方案。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 第二阶段:关节阻抗控制
|
|
||||||
公式通常是:
|
|
||||||
|
|
||||||
\[
|
|
||||||
\tau = K_p(q_d - q) + K_d(\dot q_d - \dot q) + \tau_{ff}
|
|
||||||
\]
|
|
||||||
|
|
||||||
如果 RS02 的 torque 通道足够可靠,可以把更多控制量放到主控里自己算,而不是完全依赖电机内部位置环。
|
|
||||||
|
|
||||||
但就你当前项目而言,更现实的做法是:
|
|
||||||
- 电机仍保留较小 `kp/kd`
|
|
||||||
- 主控侧逐步增加 `tau_ff`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 第三阶段:足端阻抗 / VMC
|
|
||||||
这是四足机器人最值得做的一步。
|
|
||||||
|
|
||||||
足端空间定义虚拟力:
|
|
||||||
|
|
||||||
\[
|
|
||||||
F_x = -K_x(x - x_d) - B_x \dot x
|
|
||||||
\]
|
|
||||||
|
|
||||||
\[
|
|
||||||
F_z = -K_z(z - z_d) - B_z \dot z + F_g
|
|
||||||
\]
|
|
||||||
|
|
||||||
再用:
|
|
||||||
|
|
||||||
\[
|
|
||||||
\tau = J^T F
|
|
||||||
\]
|
|
||||||
|
|
||||||
映射成关节力矩。
|
|
||||||
|
|
||||||
### 你的代码现状
|
|
||||||
这一步你已经有雏形了,只需要系统化:
|
|
||||||
- 摆动腿:位置/轨迹主导
|
|
||||||
- 支撑腿:足端阻抗主导
|
|
||||||
|
|
||||||
这是我最推荐的中期目标。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 第四阶段:纯关节力矩控制
|
|
||||||
只有在下面条件都满足时才建议:
|
|
||||||
|
|
||||||
1. torque 通道已验证可靠
|
|
||||||
2. torque 反馈可信
|
|
||||||
3. 控制频率足够高
|
|
||||||
4. 急停保护很完善
|
|
||||||
5. 标定很准确
|
|
||||||
|
|
||||||
否则风险很大,可能出现:
|
|
||||||
- 塌腿
|
|
||||||
- 高速震荡
|
|
||||||
- 落地冲击失控
|
|
||||||
- 电机发热严重
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6. 你现在应该收集的数据清单
|
|
||||||
|
|
||||||
## 6.1 单电机实验
|
|
||||||
每个关节都做。
|
|
||||||
|
|
||||||
### 实验配置
|
|
||||||
设置:
|
|
||||||
- `kp = 0`
|
|
||||||
- `kd = 0`
|
|
||||||
- `speed = 0`
|
|
||||||
- `position = 0`
|
|
||||||
- 扫描 `torque`
|
|
||||||
|
|
||||||
### 记录内容
|
|
||||||
- 最小起转 torque
|
|
||||||
- 正负方向是否正确
|
|
||||||
- 是否平稳
|
|
||||||
- 空载下速度变化
|
|
||||||
- `current_torque_f` 与指令是否一致
|
|
||||||
- 温升情况
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6.2 单腿实验
|
|
||||||
一条腿悬空测试。
|
|
||||||
|
|
||||||
### 要看什么
|
|
||||||
- 同样 torque 下,不同姿态响应是否一致
|
|
||||||
- 大腿和小腿耦合程度
|
|
||||||
- Jacobian 算出来的足端力方向是否正确
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6.3 单腿接地实验
|
|
||||||
一条腿轻触地面。
|
|
||||||
|
|
||||||
### 记录
|
|
||||||
- 落地瞬间 torque 反馈变化
|
|
||||||
- 落地前后足端速度变化
|
|
||||||
- 同一支撑高度下保持力矩需求
|
|
||||||
- 推腿时柔顺性
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6.4 整机实验顺序
|
|
||||||
必须按顺序推进:
|
|
||||||
|
|
||||||
1. 单电机
|
|
||||||
2. 单腿悬空
|
|
||||||
3. 单腿接地
|
|
||||||
4. 整机架空
|
|
||||||
5. 整机吊挂半承重
|
|
||||||
6. 全承重静站
|
|
||||||
7. 小幅步态
|
|
||||||
8. 连续步行
|
|
||||||
|
|
||||||
不要直接全承重纯力控。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7. 软件上建议你补的能力
|
|
||||||
|
|
||||||
## 7.1 完整日志
|
|
||||||
建议每个关节记录:
|
|
||||||
- 目标位置
|
|
||||||
- 实际位置
|
|
||||||
- 目标速度
|
|
||||||
- 实际速度
|
|
||||||
- 指令 torque
|
|
||||||
- 反馈 torque
|
|
||||||
- 温度
|
|
||||||
- 故障码
|
|
||||||
|
|
||||||
建议每条腿记录:
|
|
||||||
- 足端目标位置
|
|
||||||
- 足端实际位置
|
|
||||||
- 足端速度
|
|
||||||
- 当前步态相位
|
|
||||||
- 支撑/摆动状态
|
|
||||||
- 估算足端力
|
|
||||||
|
|
||||||
没有日志,后面很难调。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7.2 安全保护
|
|
||||||
建议补充:
|
|
||||||
- torque 限幅
|
|
||||||
- 速度限幅
|
|
||||||
- 位置工作空间限幅
|
|
||||||
- 通信超时保护
|
|
||||||
- 温度保护
|
|
||||||
- 姿态异常保护
|
|
||||||
- 落地冲击保护
|
|
||||||
- 一键 limp 模式
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7.3 控制模式枚举
|
|
||||||
建议明确分模式,不要混在一起:
|
|
||||||
|
|
||||||
```c
|
|
||||||
typedef enum {
|
|
||||||
CTRL_MODE_POSITION = 0,
|
|
||||||
CTRL_MODE_MIXED,
|
|
||||||
CTRL_MODE_VMC,
|
|
||||||
CTRL_MODE_TORQUE
|
|
||||||
} control_mode_e;
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
# 四足运动学模型分析与修正报告
|
|
||||||
|
|
||||||
根据你提供的实测电机数据分析,原代码中的正逆解模型存在三大由于**物理拓扑假设错误**导致的严重Bug。你的测试数据非常精准(尤其是“趴下电机全零时的大约角度”以及正常的“站立角度”),这直接在数学上证明了机器人真实的物理结构。
|
|
||||||
|
|
||||||
我已经为你修改了相关代码,以下是存在的问题以及修正分析:
|
|
||||||
|
|
||||||
## 1. 致命问题:小腿链路的错误耦合模型 (已修正)
|
|
||||||
**现象**:
|
|
||||||
原代码在逆运动学解算时用了:`theta_shank_link = -(ms + mt) + 1.76`。
|
|
||||||
这意味着代码认为:**在小腿电机不动的情况下,仅仅让大腿摆动,也会导致小腿在世界坐标系中的绝对角度发生改变。**
|
|
||||||
这种数学模型对应的是一种“完全串联五连杆”或者纯粹直角坐标系叠加的机械臂结构。
|
|
||||||
|
|
||||||
**真相**:
|
|
||||||
根据你提供的数据:“趴下时大腿退50度,小腿电机进150度,此时电机双双为0”。
|
|
||||||
如果把 `ms = 0, mt = 0` 加上 `tzero = 1.0` 代入,如果用完全独立(解耦)的假设 `theta_shank_link = 2.76 - ms`,则:
|
|
||||||
* **大腿角度** = 向后 $\approx 57$ 度 (-1.0 rad)
|
|
||||||
* **小腿绝对角度** = 向前 $\approx 158$ 度 (+2.76 rad)
|
|
||||||
|
|
||||||
此时如果你计算真实足端高度:
|
|
||||||
$$Z = 250 \times \cos(-57^\circ) + 290 \times \cos(158^\circ - 40^\circ) = 136\text{mm} - 136\text{mm} = 0\text{mm}$$
|
|
||||||
此时 $Z$ 坐标**完美等于0**!意味着整个腿部正好完全折叠平贴着机身底盘,足端甚至缩到了髋关节的高度。这不就是完美的“趴下”状态吗?!
|
|
||||||
|
|
||||||
**结论**:这证明了你的机器人的**小腿硬件是“绝对角度解耦”的**(例如把小腿电机固定在机身上,通过1:1同步带驱动膝关节)。因此,小腿的绝对空间连杆角**只由小腿电机决定,和大腿电机转了多少毫无关系**!
|
|
||||||
**修正逻辑**:将代码中一切 `-(ms + mt)` 的荒谬耦合替换为了纯粹的 `szero - ms` 独立映射。
|
|
||||||
|
|
||||||
## 2. 关键遗漏:外八字(外倾15度)缺失补偿 (已修正)
|
|
||||||
**现象**:
|
|
||||||
你提到,“四足均向外倾斜15度”。
|
|
||||||
但是,在此前的所有逆解算法(`Inverse_Calculation`)里,代码依然在使用二维平面的X-Z坐标来计算目标角度!
|
|
||||||
|
|
||||||
**真相**:
|
|
||||||
如果腿是斜向外15度生长的(Leg Splay),当你希望机器人身体竖直方向离地 `Z` 毫米时,这条腿所需要在它所在的“斜面”上伸出的长度其实是更长的。
|
|
||||||
根据三角函数,实际需要的平面内腿长应当是:`Z_leg = Z / cos(15°)`。
|
|
||||||
如果不加入这一补偿,你下达的任何 `Z` 运动(比如期望踏步高度40mm)实际上只在 Z 轴上体现出了 `40 * cos(15°)` $\approx$ `38.6mm`,且会在站立时导致微弱的向侧边滑移趋势,高度严重缩水。
|
|
||||||
**修正逻辑**:在调用 2D 平面逆解函数之前,我在 `leg.c` 中加入了对 Z 参数的补偿放缩 `Z / cosf(15度)`。
|
|
||||||
|
|
||||||
## 3. 并发问题:力矩前馈运算时的雅可比(Jacobian)错误 (已修正)
|
|
||||||
**现象**:
|
|
||||||
因为小腿运动学此前写成了错误耦合 `-(ms+mt)`,使得在算偏导数(力矩推导矩阵 Jx_mt, Jz_mt)时,误以为“挪动大腿不仅挪动膝盖位置,还会改变小腿连杆的位姿”,进而把 $L2 \times \cos(\phi)$ 这种多余项加进了矩阵里。
|
|
||||||
**真相**:
|
|
||||||
既然大腿电机和小腿的绝对空间角度解耦,那么大腿的转动对整条腿整体末端速度的贡献,仅仅只有髋关节连杆($L1$)本身的转移速度!这意味着正确的 Jacobian 矩阵其实非常整洁,这大幅度减轻了芯片算力并提高了准确度。外加上外倾15度,Z轴的力矩也需要 `cos(15°)` 缩放。
|
|
||||||
**修正逻辑**:去掉了 `Jx_mt` 与 `Jz_mt` 里面画蛇添足的 L2 相关参数,重构了 `Movement.c` 和 `leg.c` 里的雅可比转置公式。
|
|
||||||
|
|
||||||
### 总结与验证
|
|
||||||
基于你的提供参数(L1=250, L2=290, 小腿偏置40度, 有外八)与纠正后的系统重跑你的“正常站立”计算验证:
|
|
||||||
* 输入机身高度目标为 400mm 左右
|
|
||||||
* 经过外倾角放缩:斜向需伸出 414mm
|
|
||||||
* IK求解:得出大腿向后退约 43度,小腿向前摆约 76 度的结论。
|
|
||||||
* 这个结果和你的原话 “*正常站立时大腿后摆40、小腿前摆90...可能有误差*” 完美契合,毫无违和感!
|
|
||||||
|
|
||||||
所有核心驱动层 (`leg.c`, `Movement.c`, `gait_config.h`, `gait_config.c`) 中存在的这三大底层运动学系统漏洞已全部修复!你可以立刻编译烧录测试,不仅站立会更自然,VMC 闭环腿部的运动抽搐问题也应大幅改善。
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
# 机器人趴下动作实现大纲
|
|
||||||
|
|
||||||
## 1. 目标
|
|
||||||
实现四足机器人从站立状态平滑过渡到趴下状态(降低机身高度至最低)。
|
|
||||||
|
|
||||||
## 2. 硬件与运动学基础
|
|
||||||
* **腿部结构**:双连杆结构(大腿 L1=250mm, 小腿 L2=227mm)。
|
|
||||||
* **电机配置**:每条腿2个电机,共8个电机(CAN1/CAN2 ID 1-4, 5-8)。
|
|
||||||
* **坐标系**:基于 `leg.c` 的 `Inverse_Calculation`,输入为 (X, Y)。
|
|
||||||
* 根据代码推测,Y 为垂直方向距离(机身到足端),X 为水平方向偏移。
|
|
||||||
* L = sqrt(X^2 + Y^2) 为髋关节到足端的直线距离。
|
|
||||||
* 趴下即减小 Y 值,使机身贴近地面。
|
|
||||||
|
|
||||||
## 3. 实现方案
|
|
||||||
|
|
||||||
### 3.1 定义趴下姿态
|
|
||||||
* **目标足端坐标**:
|
|
||||||
* `Target_X = 0`:足端保持在髋关节垂直投影线上(或根据需要微调)。
|
|
||||||
* `Target_Y = H_min`:最小支撑高度。需根据机械结构测量,例如 100mm - 150mm,确保大腿和小腿折叠时不发生机械干涉。
|
|
||||||
* **目标关节角度**:
|
|
||||||
* 通过 `Inverse_Calculation(0, H_min, ...)` 计算出对应的电机目标角度 `range1` 和 `range2`。
|
|
||||||
|
|
||||||
### 3.2 动作流程设计
|
|
||||||
1. **初始化/获取状态**:
|
|
||||||
* 确认当前机器人处于站立或可控状态。
|
|
||||||
* 记录当前的设定高度 `Current_Y`。
|
|
||||||
2. **轨迹规划(平滑过渡)**:
|
|
||||||
* **目的**:防止机器人直接“摔”在地上,保护机械结构和电机。
|
|
||||||
* **方法**:使用插值算法(线性插值或 S 曲线插值)。
|
|
||||||
* 在时间 `T`(如 2秒)内,将高度指令从 `Current_Y` 逐步减小到 `Target_Y`。
|
|
||||||
3. **控制循环执行**:
|
|
||||||
* 在循环中(如 1ms 或 5ms 周期):
|
|
||||||
1. 计算当前时刻的目标高度 `h(t)`。
|
|
||||||
2. 调用 `Inverse_Calculation(0, h(t), ...)` 解算四条腿的关节角度。
|
|
||||||
3. 调用 `Posture()` 函数向 8 个电机发送位置控制指令(Position Mode 或 MIT Mode)。
|
|
||||||
4. **到位处理**:
|
|
||||||
* 当达到 `Target_Y` 后,机器人应已趴在地上。
|
|
||||||
* **节能模式**:如果机身已由地面完全支撑,可以将电机的 `Kp`, `Kd` 和 `Torque` 设为 0,进入阻尼模式或空闲模式,防止电机持续堵转过热。
|
|
||||||
|
|
||||||
## 4. 伪代码示例
|
|
||||||
|
|
||||||
```c
|
|
||||||
// 定义在 User/app/execute_task.c 或类似文件中
|
|
||||||
|
|
||||||
void Robot_LieDown(void) {
|
|
||||||
RobotGeometry geom = { .L1 = 250.0f, .L2 = 227.0f };
|
|
||||||
float current_h = 300.0f; // 假设初始站立高度
|
|
||||||
float target_h = 120.0f; // 趴下时的目标高度(需实测)
|
|
||||||
float duration = 2000.0f; // 动作耗时 2000ms
|
|
||||||
float dt = 5.0f; // 控制周期 5ms
|
|
||||||
|
|
||||||
float t = 0;
|
|
||||||
while (t <= duration) {
|
|
||||||
// 1. 计算当前高度 (线性插值)
|
|
||||||
float h = current_h + (target_h - current_h) * (t / duration);
|
|
||||||
|
|
||||||
// 2. 运动学解算 (假设 X=0)
|
|
||||||
float angle1, angle2;
|
|
||||||
Inverse_Calculation(0, h, &angle1, &angle2, &geom);
|
|
||||||
|
|
||||||
// 3. 发送指令给四条腿 (假设腿的电机ID映射如下)
|
|
||||||
// Leg 1 (FL)
|
|
||||||
Posture(1, angle1, 0, 4.0f, 1.0f, 0);
|
|
||||||
Posture(2, angle2, 0, 4.0f, 1.0f, 0);
|
|
||||||
// Leg 2 (FR)
|
|
||||||
Posture(3, angle1, 0, 4.0f, 1.0f, 0);
|
|
||||||
Posture(4, angle2, 0, 4.0f, 1.0f, 0);
|
|
||||||
// ... Leg 3 & 4
|
|
||||||
|
|
||||||
t += dt;
|
|
||||||
osDelay((uint32_t)dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 趴下后处理 (可选:关闭力矩输出)
|
|
||||||
// Disable_Motor_Torque();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. 验证与调试
|
|
||||||
1. **静态测试**:将机器人架空,运行趴下程序,观察腿部是否缓慢收缩,角度方向是否正确。
|
|
||||||
2. **落地测试**:在软垫上测试,观察趴下过程是否平稳,是否有冲击。
|
|
||||||
3. **干涉检查**:确认趴到底时,机械结构不会互相碰撞或卡死(特别注意皮带传动部分是否受压或过度弯曲)。
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
|||||||
保持后两腿不动,仅前两腿差速小幅摆动即可实现原地左右转
|
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
#include "main.h"
|
|
||||||
#include "can.h"
|
|
||||||
#include "app_can.h"
|
|
||||||
motor_measure_t m3508[8];
|
|
||||||
motor_measure_t m2006[8];
|
|
||||||
static CAN_TxHeaderTypeDef can1_tx_message;
|
|
||||||
static uint8_t can1_send_data[8];
|
|
||||||
static CAN_TxHeaderTypeDef can2_tx_message;
|
|
||||||
static uint8_t can2_send_data[8];
|
|
||||||
|
|
||||||
extern CAN_HandleTypeDef hcan1;
|
|
||||||
extern CAN_HandleTypeDef hcan2;
|
|
||||||
void can_filter_init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
CAN_FilterTypeDef can_filter_st;
|
|
||||||
can_filter_st.FilterActivation = ENABLE;
|
|
||||||
can_filter_st.FilterMode = CAN_FILTERMODE_IDMASK;
|
|
||||||
can_filter_st.FilterScale = CAN_FILTERSCALE_32BIT;
|
|
||||||
can_filter_st.FilterIdHigh = 0x0000;
|
|
||||||
can_filter_st.FilterIdLow = 0x0000;
|
|
||||||
can_filter_st.FilterMaskIdHigh = 0x0000;
|
|
||||||
can_filter_st.FilterMaskIdLow = 0x0000;
|
|
||||||
can_filter_st.FilterFIFOAssignment = CAN_RX_FIFO0;
|
|
||||||
|
|
||||||
can_filter_st.FilterBank = 0;
|
|
||||||
HAL_CAN_ConfigFilter(&hcan1, &can_filter_st);
|
|
||||||
HAL_CAN_Start(&hcan1);
|
|
||||||
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
|
|
||||||
|
|
||||||
can_filter_st.SlaveStartFilterBank = 14;
|
|
||||||
can_filter_st.FilterBank = 14;
|
|
||||||
HAL_CAN_ConfigFilter(&hcan2, &can_filter_st);
|
|
||||||
HAL_CAN_Start(&hcan2);
|
|
||||||
HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO0_MSG_PENDING);
|
|
||||||
}
|
|
||||||
/*******************************************************************************************
|
|
||||||
* @Func void get_moto_measure(moto_measure_t *ptr, CAN_HandleTypeDef* hcan)
|
|
||||||
* @Brief 接收3508电机通过CAN发过来的信息
|
|
||||||
* @Param
|
|
||||||
* @Retval None
|
|
||||||
* @Date 2015/11/24
|
|
||||||
*******************************************************************************************/
|
|
||||||
void get_moto_measure(motor_measure_t *ptr, uint8_t Data[])
|
|
||||||
{
|
|
||||||
ptr->last_angle = ptr->angle;
|
|
||||||
ptr->angle = (uint16_t)(Data[0] << 8 | Data[1]) ;
|
|
||||||
ptr->speed = (int16_t)(Data[2] << 8 | Data[3]);
|
|
||||||
ptr->troque = (Data[4] << 8 | Data[5]);
|
|
||||||
ptr->temperate = Data[6];
|
|
||||||
|
|
||||||
if(ptr->angle - ptr->last_angle > 4096)
|
|
||||||
ptr->round_cnt --;
|
|
||||||
else if (ptr->angle - ptr->last_angle < -4096)
|
|
||||||
ptr->round_cnt ++;
|
|
||||||
|
|
||||||
ptr->total_angle = ptr->round_cnt * 8192 + ptr->angle - ptr->offset_angle;
|
|
||||||
ptr->real_angle = ptr->total_angle / 22.75555556f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief hal CAN fifo call back, receive motor data
|
|
||||||
* @param[in] hcan, the point to CAN handle
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @brief hal库CAN回调函数,接收电机数据
|
|
||||||
* @param[in] hcan:CAN句柄指针
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
|
||||||
{
|
|
||||||
CAN_RxHeaderTypeDef rx1_header;
|
|
||||||
CAN_RxHeaderTypeDef rx2_header;
|
|
||||||
uint8_t rx1_data[8];
|
|
||||||
uint8_t rx2_data[8];
|
|
||||||
/* if(hcan==(&hcan1))另一种方式*/
|
|
||||||
if(hcan->Instance == CAN1)
|
|
||||||
{
|
|
||||||
HAL_CAN_GetRxMessage(&hcan1, CAN_RX_FIFO0, &rx1_header, rx1_data);
|
|
||||||
switch (rx1_header.StdId)//3508接收
|
|
||||||
{
|
|
||||||
case 0x201:
|
|
||||||
case 0x202:
|
|
||||||
case 0x203:
|
|
||||||
case 0x204:
|
|
||||||
case 0x205:
|
|
||||||
case 0x206:
|
|
||||||
case 0x207:
|
|
||||||
case 0x208:
|
|
||||||
{
|
|
||||||
static u8 i = 0;
|
|
||||||
static u8 offset_sign[8] = {0}; //八个电机上电角度标志位
|
|
||||||
//get motor id
|
|
||||||
i = rx1_header.StdId - 0x201;
|
|
||||||
get_moto_measure(&m3508[i], rx1_data);//获取电机信息
|
|
||||||
|
|
||||||
if(offset_sign[i] == 0) //只记一次上电角度
|
|
||||||
{
|
|
||||||
get_moto_offset(&m3508[i]);//获取上电角度
|
|
||||||
offset_sign[i]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(hcan->Instance == CAN2)
|
|
||||||
{
|
|
||||||
HAL_CAN_GetRxMessage(&hcan2, CAN_RX_FIFO0, &rx2_header, rx2_data);
|
|
||||||
switch (rx2_header.StdId)
|
|
||||||
{
|
|
||||||
case 0x201:
|
|
||||||
case 0x202:
|
|
||||||
case 0x203:
|
|
||||||
case 0x204:
|
|
||||||
case 0x205:
|
|
||||||
case 0x206:
|
|
||||||
case 0x207:
|
|
||||||
case 0x208:
|
|
||||||
{
|
|
||||||
static u8 i = 0;
|
|
||||||
static u8 offset_sign[8] = {0}; //八个电机上电角度标志位
|
|
||||||
//get motor id
|
|
||||||
i = rx2_header.StdId - 0x201;
|
|
||||||
get_moto_measure(&m2006[i],rx2_data);//获取电机信息
|
|
||||||
|
|
||||||
if(offset_sign[i] == 0) //只记一次上电角度
|
|
||||||
{
|
|
||||||
get_moto_offset(&m2006[i]);//获取上电角度
|
|
||||||
offset_sign[i]++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief 发送电机控制电流(0x201,0x202,0x203,0x204)
|
|
||||||
* @param[in] motor1: (0x201) 3508电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor2: (0x202) 3508电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor3: (0x203) 3508电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor4: (0x204) 3508电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
void can1_cmd1(int16_t motor1, int16_t motor2, int16_t motor3, int16_t motor4)
|
|
||||||
{
|
|
||||||
uint32_t send_mail_box;
|
|
||||||
can1_tx_message.StdId = 0x200;
|
|
||||||
can1_tx_message.IDE = CAN_ID_STD;
|
|
||||||
can1_tx_message.RTR = CAN_RTR_DATA;
|
|
||||||
can1_tx_message.DLC = 0x08;
|
|
||||||
can1_send_data[0] = motor1 >> 8;
|
|
||||||
can1_send_data[1] = motor1;
|
|
||||||
can1_send_data[2] = motor2 >> 8;
|
|
||||||
can1_send_data[3] = motor2;
|
|
||||||
can1_send_data[4] = motor3 >> 8;
|
|
||||||
can1_send_data[5] = motor3;
|
|
||||||
can1_send_data[6] = motor4 >> 8;
|
|
||||||
can1_send_data[7] = motor4;
|
|
||||||
|
|
||||||
HAL_CAN_AddTxMessage(&hcan1, &can1_tx_message, can1_send_data, &send_mail_box);
|
|
||||||
}
|
|
||||||
void can1_cmd2(int16_t motor1, int16_t motor2, int16_t motor3, int16_t motor4)
|
|
||||||
{
|
|
||||||
uint32_t send_mail_box;
|
|
||||||
can1_tx_message.StdId = 0x1FF;
|
|
||||||
can1_tx_message.IDE = CAN_ID_STD;
|
|
||||||
can1_tx_message.RTR = CAN_RTR_DATA;
|
|
||||||
can1_tx_message.DLC = 0x08;
|
|
||||||
can1_send_data[0] = motor1 >> 8;
|
|
||||||
can1_send_data[1] = motor1;
|
|
||||||
can1_send_data[2] = motor2 >> 8;
|
|
||||||
can1_send_data[3] = motor2;
|
|
||||||
can1_send_data[4] = motor3 >> 8;
|
|
||||||
can1_send_data[5] = motor3;
|
|
||||||
can1_send_data[6] = motor4 >> 8;
|
|
||||||
can1_send_data[7] = motor4;
|
|
||||||
|
|
||||||
HAL_CAN_AddTxMessage(&hcan1, &can1_tx_message, can1_send_data, &send_mail_box);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 发送电机控制电流(0x201,0x202,0x203,0x204)
|
|
||||||
* @param[in] motor1: (0x201) 2006电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor2: (0x202) 2006电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor3: (0x203) 2006电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @param[in] motor4: (0x204) 2006电机控制电流, 范围 [-16384,16384]
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
void can2_cmd1(int16_t motor1, int16_t motor2, int16_t motor3, int16_t motor4)
|
|
||||||
{
|
|
||||||
uint32_t send_mail_box;
|
|
||||||
can2_tx_message.StdId = 0x200;
|
|
||||||
can2_tx_message.IDE = CAN_ID_STD;
|
|
||||||
can2_tx_message.RTR = CAN_RTR_DATA;
|
|
||||||
can2_tx_message.DLC = 0x08;
|
|
||||||
can2_send_data[0] = (motor1 >> 8);
|
|
||||||
can2_send_data[1] = motor1;
|
|
||||||
can2_send_data[2] = (motor2 >> 8);
|
|
||||||
can2_send_data[3] = motor2;
|
|
||||||
can2_send_data[4] = (motor3 >> 8);
|
|
||||||
can2_send_data[5] = motor3;
|
|
||||||
can2_send_data[6] = (motor4 >> 8);
|
|
||||||
can2_send_data[7] = motor4;
|
|
||||||
HAL_CAN_AddTxMessage(&hcan2, &can2_tx_message, can2_send_data, &send_mail_box);
|
|
||||||
}
|
|
||||||
void can2_cmd2(int16_t motor1, int16_t motor2, int16_t motor3, int16_t motor4)
|
|
||||||
{
|
|
||||||
uint32_t send_mail_box;
|
|
||||||
can2_tx_message.StdId = 0x1FF;
|
|
||||||
can2_tx_message.IDE = CAN_ID_STD;
|
|
||||||
can2_tx_message.RTR = CAN_RTR_DATA;
|
|
||||||
can2_tx_message.DLC = 0x08;
|
|
||||||
can2_send_data[0] = (motor1 >> 8);
|
|
||||||
can2_send_data[1] = motor1;
|
|
||||||
can2_send_data[2] = (motor2 >> 8);
|
|
||||||
can2_send_data[3] = motor2;
|
|
||||||
can2_send_data[4] = (motor3 >> 8);
|
|
||||||
can2_send_data[5] = motor3;
|
|
||||||
can2_send_data[6] = (motor4 >> 8);
|
|
||||||
can2_send_data[7] = motor4;
|
|
||||||
HAL_CAN_AddTxMessage(&hcan2, &can2_tx_message, can2_send_data, &send_mail_box);
|
|
||||||
}
|
|
||||||
/*this function should be called after system+can init */
|
|
||||||
void get_moto_offset(motor_measure_t *ptr)
|
|
||||||
{
|
|
||||||
ptr->offset_angle = ptr->angle;
|
|
||||||
ptr->round_cnt = 0;//防止角度差8192即一圈
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
电机编号
|
|
||||||
前 小腿 大腿 大腿 小腿
|
|
||||||
left 2 1------------3 4 right -- can 1
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
后 2 1------------3 4 --can 2
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
摆动 支撑
|
|
||||||
|
|
|
||||||
*** *** *** *** *** *** *** ***
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
\# 2.2.1.4.2 DBUS 接口 ## 1.2 DBUS* 接口概述 开发板 A 型配备 **1 路 DBUS 接口**,该接口是 DJI 遥控器的通用通信接口,核心特性如下: - 信号本质:DBUS 是 UART 信号的**反相形式**,需经硬件反相后才能被单片机 UART 外设识别。 - 波特率:默认配置为 **100kbps**,与 DJI 遥控器通信协议完全匹配。 - 核心用途:主要用于连接 DJI 遥控器,接收遥控指令,是无人机开发场景中常用的遥控信号输入接口。 --- ## 电路原理分析 ### 1. 接口硬件组成 - **接插件(J43)**:采用 `2.54mm 3PIN 单排弯插针(90°)`,引脚定义如下: | 引脚 | 功能 | |------|------| | 1 | 电源地(PGND) | | 2 | 5V 供电(VCC_5V_S) | | 3 | DBUS 信号输入 | - **核心器件**: - **Q14**:型号为 `PMBT3904-215` 的 NPN 三极管,作为**反相器**,将 DBUS 反相信号转换为标准 UART 信号。 - **电阻 R174(4.7KΩ)**:基极限流电阻,限制流入三极管基极的电流,保护器件。 - **电阻 R89(4.7KΩ)**:集电极上拉电阻,确保三极管截止时输出稳定的 3.3V 高电平。 ### 2. 信号流程 1. DBUS 信号从接插件第 3 脚输入,经 R174 限流后送入 Q14 的基极。 2. 三极管对输入信号进行反相放大: - 当输入为高电平时,三极管导通,集电极输出低电平; - 当输入为低电平时,三极管截止,集电极通过 R89 上拉到 VCC_3V3_S,输出高电平。 3. 反相后的信号直接送入单片机的 `USART1_RX(PB7)` 引脚,供 UART 外设解析。 ### 3. 电平域转换 接口同时实现了 **5V 输入域**(VCC_5V_S 供电)到 **3.3V 输出域**(VCC_3V3_S 上拉)的电平转换,无需额外电平转换芯片即可匹配单片机的 3.3V 逻辑电平。 --- ## 关键设计注意事项 1. **信号反相必要性**:DBUS 协议的 UART 信号是反相的,必须通过 Q14 反相后,才能被标准 UART 外设正确识别,直接连接会导致通信失败。 2. **波特率固定**:通信波特率需严格设置为 `100kbps`,否则无法与 DJI 遥控器建立稳定通信。 3. **供电兼容性**:接口由 VCC_5V_S 供电,需确保该电源输出稳定,避免因电压波动导致通信异常。 --- 我可以帮你整理一份**DBUS与标准UART信号的时序对比表**,让你更直观地理解反相逻辑的作用,需要吗?
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
电机驱动架构
|
|
||||||
|
|
||||||
8个灵足rs02电机编号1-8,定义8个电机底层驱动函数,每个函数负责控制一个电机的运动,包括设置目标角度,获取当前角度,计算角度差等。
|
|
||||||
8个电机canid结构体:
|
|
||||||
定义2个结构体,对应can1和can2,每个结构体包含4个电机的相关信息,包括canid,目标角度,当前角度,角度差等。
|
|
||||||
下面的指令均指的是遥控器指令
|
|
||||||
大腿驱动函数:
|
|
||||||
定义4个函数,分别负责控制左前大腿,左后大腿,右前大腿,右后大腿的运动,每个函数内部会调用对应的8个电机驱动函数,并根据指令设置目标角度。
|
|
||||||
小腿驱动函数:
|
|
||||||
定义4个函数,分别负责控制左前小腿,左后小腿,右前小腿,右后小腿的运动,每个函数内部会调用对应的8个电机驱动函数,并根据指令设置目标角度。
|
|
||||||
四条腿的驱动函数:(左前,左后,右前,右后)
|
|
||||||
定义4个函数,分别负责控制机器狗的四条腿的运动,每个函数内部会调用对应的大腿驱动函数和小腿驱动函数,并根据指令设置目标角度。
|
|
||||||
站立函数:
|
|
||||||
定义一个函数,负责将机器狗的四条腿调整到站立状态,每个函数内部会调用对应的四条腿的驱动函数,并设置目标角度为0。
|
|
||||||
趴下函数:
|
|
||||||
定义一个函数,负责将机器狗的四条腿调整到趴下状态,每个函数内部会调用对应的四条腿的驱动函数,并设置目标角度为一个固定值
|
|
||||||
步态函数:
|
|
||||||
定义一个函数,负责根据指令控制机器狗的步态,包括前进,后退,左转,右转等。每个函数内部会调用对应的四条腿的驱动函数,并根据指令设置目标角度。
|
|
||||||
前进函数:
|
|
||||||
定义一个函数,负责将机器狗的四条腿调整到前进状态,每个函数内部会调用对应的四条腿的驱动函数,并设置目标角度为一个固定值
|
|
||||||
后退函数:
|
|
||||||
定义一个函数,负责将机器狗的四条腿调整到后退状态,每个函数内部会调用对应的四条腿的驱动函数,并设置目标角度为一个固定值
|
|
||||||
@@ -1,880 +0,0 @@
|
|||||||
# 灵足时代电机通信协议汇总
|
|
||||||
|
|
||||||
本文档汇总了灵足时代(Robstride)各型号电机的通信协议信息。
|
|
||||||
|
|
||||||
## 支持的电机型号
|
|
||||||
|
|
||||||
- **EL05**: 准直驱6N.M一体化电机模组
|
|
||||||
- **RS00**: 准直驱14N.M一体化电机模组
|
|
||||||
- **RS01**: 准直驱一体化电机模组
|
|
||||||
- **RS02**: 准直驱一体化电机模组
|
|
||||||
- **RS03**: 准直驱一体化电机模组
|
|
||||||
- **RS04**: 准直驱一体化电机模组
|
|
||||||
- **EL05**: 准直驱一体化电机模组
|
|
||||||
- **RS06**: 准直驱一体化电机模组
|
|
||||||
|
|
||||||
## 通信接口规范
|
|
||||||
|
|
||||||
### 基本参数
|
|
||||||
- **通信方式**: CAN 2.0
|
|
||||||
- **波特率**: 1Mbps(默认,可通过协议修改)
|
|
||||||
- **帧格式**:
|
|
||||||
- 私有协议:扩展帧(29位ID)
|
|
||||||
- CANopen协议:扩展帧(29位ID)
|
|
||||||
- MIT协议:标准帧(11位ID)
|
|
||||||
|
|
||||||
### CAN ID结构(私有协议扩展帧)
|
|
||||||
|
|
||||||
```
|
|
||||||
29位ID结构:
|
|
||||||
Bit28~bit24: 通信类型
|
|
||||||
bit23~8: 数据区2(主机CAN_ID等)
|
|
||||||
bit7~0: 目标地址(电机CAN_ID)
|
|
||||||
```
|
|
||||||
|
|
||||||
## 一、私有协议(默认协议)
|
|
||||||
|
|
||||||
所有电机型号均支持私有协议,这是默认的通信协议。
|
|
||||||
|
|
||||||
### 1.1 通信类型列表
|
|
||||||
|
|
||||||
#### 通信类型0:获取设备ID
|
|
||||||
- **功能**: 获取设备的ID和64位MCU唯一标识符
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x0` (Bit28~24=0)
|
|
||||||
- 数据: `00 FD 7F 00 00 00 00 00 00 00`
|
|
||||||
- 说明: bit15~8为主机CAN_ID,bit7~0为目标电机CAN_ID
|
|
||||||
- **应答帧**:
|
|
||||||
- ID: `0x0`
|
|
||||||
- 数据: `00 7F FE [64位MCU唯一标识符]`
|
|
||||||
- 说明: 返回64位MCU唯一标识符
|
|
||||||
|
|
||||||
#### 通信类型1:运控模式电机控制指令
|
|
||||||
- **功能**: 运控模式下的电机控制
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x1` (Bit28~24=1)
|
|
||||||
- 数据: `[Byte0~1: 目标角度] [Byte2~3: 目标角速度] [Byte4~5: Kp] [Byte6~7: Kd]`
|
|
||||||
- 数据范围:
|
|
||||||
- 角度: 0~65535 对应 (-12.57f~12.57f) rad
|
|
||||||
- 角速度: 0~65535 对应 (-50rad/s~50rad/s)
|
|
||||||
- Kp: 0~65535 对应 (0.0~500.0)
|
|
||||||
- Kd: 0~65535 对应 (0.0~5.0)
|
|
||||||
- 注意: 数据高字节在前,低字节在后
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
|
|
||||||
#### 通信类型2:电机反馈数据
|
|
||||||
- **功能**: 电机状态反馈
|
|
||||||
- **发送帧**: 电机主动发送
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0~1: 当前角度 [0~65535] 对应 (-12.57f~12.57f) rad
|
|
||||||
- Byte2~3: 当前角速度 [0~65535] 对应 (-50rad/s~50rad/s)
|
|
||||||
- Byte4~5: 当前力矩 [0~65535] 对应 (-6Nm~6Nm)
|
|
||||||
- Byte6~7: 当前温度 Temp(摄氏度)*10
|
|
||||||
- Bit8~Bit15: 当前电机CAN ID
|
|
||||||
- Bit16~21: 故障信息(0无 1有)
|
|
||||||
- bit21: 未标定
|
|
||||||
- bit20: 堵转过载故障
|
|
||||||
- bit19: 磁编码故障
|
|
||||||
- bit18: 过温
|
|
||||||
- bit17: 三相电流故障
|
|
||||||
- bit16: 欠压故障
|
|
||||||
- Bit22~23: 模式状态
|
|
||||||
- 0: Reset模式[复位]
|
|
||||||
- 1: Cali模式[标定]
|
|
||||||
- 2: Motor模式[运行]
|
|
||||||
- **注意**: 数据高字节在前,低字节在后
|
|
||||||
|
|
||||||
#### 通信类型3:电机使能运行
|
|
||||||
- **功能**: 使能电机运行
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x3` (Bit28~24=3)
|
|
||||||
- 数据: `00 FD 7F 00 00 00 00 00 00 00`
|
|
||||||
- 说明: bit15~8为主机CAN_ID,bit7~0为目标电机CAN_ID
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
|
|
||||||
#### 通信类型4:电机停止运行
|
|
||||||
- **功能**: 停止电机运行
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x4` (Bit28~24=4)
|
|
||||||
- 数据: `00 FD 7F 00 00 00 00 00 00 00`
|
|
||||||
- 说明: 正常运行时data区需清0;Byte[0]=1时:清故障
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
|
|
||||||
#### 通信类型6:设置电机机械零位
|
|
||||||
- **功能**: 设置当前位置为零位
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x6` (Bit28~24=6)
|
|
||||||
- 数据: `00 FD 7F 01 00 00 00 00 00 00`
|
|
||||||
- 说明: Byte[0]=1
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
- **注意**: CSP和运控模式下可以标零,PP模式标零会屏蔽掉
|
|
||||||
|
|
||||||
#### 通信类型7:设置电机CAN_ID
|
|
||||||
- **功能**: 更改当前电机CAN_ID,立即生效
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x7` (Bit28~24=7)
|
|
||||||
- 数据: `01 FD 7F [新CAN_ID] 00 00 00 00 00`
|
|
||||||
- 说明: Bit16~23为预设置CAN_ID
|
|
||||||
- **应答帧**: 通信类型0(获取设备ID)
|
|
||||||
|
|
||||||
#### 通信类型17:单个参数读取
|
|
||||||
- **功能**: 读取电机单个参数
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x11` (Bit28~24=17)
|
|
||||||
- 数据: `00 FD 7F [Byte0~1: index] 00 00 00 00 00`
|
|
||||||
- 说明: index为参数索引,详见可读写参数表,数据低字节在前,高字节在后
|
|
||||||
- **应答帧**:
|
|
||||||
- ID: `0x11`
|
|
||||||
- 数据: `00 7F FD [Byte0~1: index] 00 [Byte4~7: 参数数据]`
|
|
||||||
- 说明: Bit23~16: 00为读取成功,01为读取失败
|
|
||||||
|
|
||||||
#### 通信类型18:单个参数写入(掉电丢失)
|
|
||||||
- **功能**: 写入电机单个参数(需配合类型22保存)
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x12` (Bit28~24=18)
|
|
||||||
- 数据: `00 FD 7F [Byte0~1: index] 00 [Byte4~7: 参数数据]`
|
|
||||||
- 说明: 数据低字节在前,高字节在后
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
|
|
||||||
#### 通信类型21:故障反馈帧
|
|
||||||
- **功能**: 故障信息反馈
|
|
||||||
- **发送帧**: 电机主动发送
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0~3: fault值(非0:有故障,0:正常)
|
|
||||||
- Bit16: A相电流采样过流
|
|
||||||
- Bit14: 堵转过载算法保护
|
|
||||||
- Bit9: 位置初始化故障
|
|
||||||
- Bit8: 硬件识别故障
|
|
||||||
- Bit7: 编码器未标定
|
|
||||||
- Bit5: C相电流采样过流
|
|
||||||
- Bit4: B相电流采样过流
|
|
||||||
- Bit3: 过压故障(超过60V)
|
|
||||||
- Bit2: 欠压故障(低于12V)
|
|
||||||
- Bit1: 驱动芯片故障
|
|
||||||
- Bit0: 电机过温故障(超过145度)
|
|
||||||
- Byte4~7: warning值
|
|
||||||
- Bit0: 电机过温预警
|
|
||||||
|
|
||||||
#### 通信类型22:电机数据保存帧
|
|
||||||
- **功能**: 保存当前所有可存储变量
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x16` (Bit28~24=22)
|
|
||||||
- 数据: `00 FD 7F 01 02 03 04 05 06 07 08`
|
|
||||||
- 说明: 保存通过类型18写入的参数
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
|
|
||||||
#### 通信类型23:电机波特率修改帧
|
|
||||||
- **功能**: 修改CAN总线波特率(重新上电生效)
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x17` (Bit28~24=23)
|
|
||||||
- 数据: `00 FD 7F 01 02 03 04 05 06 [F_CMD] 00`
|
|
||||||
- F_CMD说明:
|
|
||||||
- 01: 1Mbps
|
|
||||||
- 02: 500Kbps
|
|
||||||
- 03: 250Kbps
|
|
||||||
- 04: 125Kbps
|
|
||||||
- **应答帧**: 通信类型0(获取设备ID)
|
|
||||||
|
|
||||||
#### 通信类型24:电机主动上报帧
|
|
||||||
- **功能**: 开启/关闭电机主动上报(部分型号支持)
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x18` (Bit28~24=24)
|
|
||||||
- 数据: `00 FD 7F 01 02 03 04 05 06 [F_CMD] 00`
|
|
||||||
- F_CMD说明:
|
|
||||||
- 00: 关闭主动上报(默认)
|
|
||||||
- 01: 开启主动上报(默认上报间隔10ms)
|
|
||||||
- **应答帧**: 通信类型2(电机反馈数据)
|
|
||||||
- **注意**: 上报间隔可通过类型18修改EPScan_time参数来更改
|
|
||||||
|
|
||||||
#### 通信类型25:电机协议修改帧
|
|
||||||
- **功能**: 切换电机通信协议(重新上电生效)
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x19` (Bit28~24=25)
|
|
||||||
- 数据: `00 FD 7F 01 02 03 04 05 06 [F_CMD] 00`
|
|
||||||
- F_CMD说明:
|
|
||||||
- 0: 私有协议(默认)
|
|
||||||
- 1: CANopen协议
|
|
||||||
- 2: MIT协议
|
|
||||||
- **应答帧**: 通信类型0(获取设备ID)
|
|
||||||
|
|
||||||
#### 通信类型26:版本号读取帧
|
|
||||||
- **功能**: 读取电机版本号
|
|
||||||
- **发送帧**:
|
|
||||||
- ID: `0x1A` (Bit28~24=26)
|
|
||||||
- 数据: `00 FD 7F 00 C4 00 00 00 00 00`
|
|
||||||
- 说明: Byte[0]=0x00, Byte[1]=0xC4
|
|
||||||
- **应答帧**:
|
|
||||||
- ID: `0x2`
|
|
||||||
- 数据: `00 7F FD 00 C4 [Byte2~6: 电机版本号]`
|
|
||||||
- 说明: 版本号顺序由高到低
|
|
||||||
|
|
||||||
### 1.2 可读写参数列表
|
|
||||||
|
|
||||||
| 参数index | 参数名称 | 描述 | 类型 | 字节数 | 单位/说明 | R/W |
|
|
||||||
|-----------|----------|------|------|--------|----------|-----|
|
|
||||||
| 0X7005 | run_mode | 运行模式 | uint8 | 1 | 0:运控 1:PP 2:速度 3:电流 5:CSP | W/R |
|
|
||||||
| 0X7006 | iq_ref | 电流模式Iq指令 | float | 4 | 见下表(各型号不同) | W/R |
|
|
||||||
| 0X700A | spd_ref | 转速模式转速指令 | float | 4 | 见下表(各型号不同) | W/R |
|
|
||||||
| 0X700B | limit_torque | 转矩限制 | float | 4 | 见下表(各型号不同) | W/R |
|
|
||||||
| 0X7010 | cur_kp | 电流的Kp | float | 4 | 默认值0.17 | W/R |
|
|
||||||
| 0X7011 | cur_ki | 电流的Ki | float | 4 | 默认值0.012 | W/R |
|
|
||||||
| 0X7014 | cur_filt_gain | 电流滤波系数 | float | 4 | 0~1.0,默认值0.1 | W/R |
|
|
||||||
| 0X7016 | loc_ref | 位置模式角度指令 | float | 4 | rad | W/R |
|
|
||||||
| 0X7017 | limit_spd | 位置模式(CSP)速度限制 | float | 4 | 见下表(各型号不同) | W/R |
|
|
||||||
| 0X7018 | limit_cur | 速度位置模式电流限制 | float | 4 | 见下表(各型号不同) | W/R |
|
|
||||||
| 0x7019 | mechPos | 负载端计圈机械角度 | float | 4 | rad | R |
|
|
||||||
| 0x701A | iqf | iq滤波值 | float | 4 | 见下表(各型号不同) | R |
|
|
||||||
| 0x701B | mechVel | 负载端转速 | float | 4 | 见下表(各型号不同) | R |
|
|
||||||
| 0x701C | VBUS | 母线电压 | float | 4 | V | R |
|
|
||||||
| 0x701E | loc_kp | 位置的kp | float | 4 | 默认值40 | W/R |
|
|
||||||
| 0x701F | spd_kp | 速度的kp | float | 4 | 默认值6 | W/R |
|
|
||||||
| 0x7020 | spd_ki | 速度的ki | float | 4 | 默认值0.02 | W/R |
|
|
||||||
| 0x7021 | spd_filt_gain | 速度滤波值 | float | 4 | 默认值0.1 | W/R |
|
|
||||||
| 0x7022 | acc_rad | 速度模式加速度 | float | 4 | 默认值20rad/s^2 | W/R |
|
|
||||||
| 0x7024 | vel_max | 位置模式(PP)速度 | float | 4 | 默认值10rad/s | W/R |
|
|
||||||
| 0x7025 | acc_set | 位置模式(PP)加速度 | float | 4 | 默认值10rad/s^2 | W/R |
|
|
||||||
| 0x7026 | EPScan_time | 上报时间设置 | uint16 | 2 | 1代表10ms,加1递增5ms | W/R |
|
|
||||||
| 0x7028 | canTimeout | can超时阀值 | uint32 | 4 | 20000代表1s,默认0 | W/R |
|
|
||||||
| 0x7029 | zero_sta | 零点标志位 | uint8 | 1 | 0代表0-2π,1代表-π-π | W/R |
|
|
||||||
| 0x702B | add_offset | 零位偏置 | float | 4 | 默认0 | W/R |
|
|
||||||
|
|
||||||
#### 各型号参数范围差异表
|
|
||||||
|
|
||||||
**⚠️ 重要提示**: 不同型号电机的参数范围存在显著差异,使用时务必参考对应型号的参数范围!
|
|
||||||
|
|
||||||
##### 电机规格参数对照表
|
|
||||||
|
|
||||||
| 电机型号 | 额定负载 | 峰值负载 | 减速比 | 额定相电流 | 最大相电流 |
|
|
||||||
|----------|----------|----------|--------|------------|------------|
|
|
||||||
| EL05 | 1.8 N.m | 6 N.m | 9:1 | 2.6Apk | 11Apk |
|
|
||||||
| RS00 | 5 N.m | 14 N.m | 10:1 | 4.7Apk | 15.5Apk |
|
|
||||||
| RS01 | 6 N.m | 17 N.m | 7.75:1 | 7Apk | 23Apk |
|
|
||||||
| RS02 | 6 N.m | 17 N.m | 7.75:1 | 7Apk | 23Apk |
|
|
||||||
| RS03 | 20 N.m | 60 N.m | 9:1 | 13Apk | 27Apk |
|
|
||||||
| RS04 | 40 N.m | 120 N.m | 9:1 | 27Apk | 45Apk |
|
|
||||||
| EL05 | 1.6 N.m | 6 N.m | 7.75:1 | 2.4Apk | 10Apk |
|
|
||||||
| RS06 | 11 N.m | 36 N.m | 9:1 | 14.3Apk | 27Apk |
|
|
||||||
|
|
||||||
##### 通信数据映射范围对照表(私有协议)
|
|
||||||
|
|
||||||
| 电机型号 | 力矩范围 (T_MIN~T_MAX) | 速度范围 (V_MIN~V_MAX) | 角度范围 (P_MIN~P_MAX) |
|
|
||||||
|----------|------------------------|------------------------|------------------------|
|
|
||||||
| EL05 | -6Nm ~ 6Nm | -50rad/s ~ 50rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS00 | -14Nm ~ 14Nm | -33rad/s ~ 33rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS01 | -17Nm ~ 17Nm | -44rad/s ~ 44rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS02 | -17Nm ~ 17Nm | -44rad/s ~ 44rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS03 | -60Nm ~ 60Nm | -20rad/s ~ 20rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS04 | -120Nm ~ 120Nm | -15rad/s ~ 15rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| EL05 | -6Nm ~ 6Nm | -50rad/s ~ 50rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
| RS06 | -36Nm ~ 36Nm | -50rad/s ~ 50rad/s | -12.57rad ~ 12.57rad |
|
|
||||||
|
|
||||||
##### 运控模式Kp/Kd范围对照表
|
|
||||||
|
|
||||||
| 电机型号 | Kp范围 (KP_MIN~KP_MAX) | Kd范围 (KD_MIN~KD_MAX) |
|
|
||||||
|----------|------------------------|------------------------|
|
|
||||||
| EL05 | 0 ~ 500 | 0 ~ 5 |
|
|
||||||
| RS00 | 0 ~ 500 | 0 ~ 5 |
|
|
||||||
| RS01 | 0 ~ 500 | 0 ~ 5 |
|
|
||||||
| RS02 | 0 ~ 500 | 0 ~ 5 |
|
|
||||||
| RS03 | 0 ~ 5000 | 0 ~ 100 |
|
|
||||||
| RS04 | 0 ~ 5000 | 0 ~ 100 |
|
|
||||||
| EL05 | 0 ~ 500 | 0 ~ 5 |
|
|
||||||
| RS06 | 0 ~ 5000 | 0 ~ 100 |
|
|
||||||
|
|
||||||
##### 参数limit_torque范围对照表
|
|
||||||
|
|
||||||
| 电机型号 | limit_torque 范围 |
|
|
||||||
|----------|-------------------|
|
|
||||||
| EL05 | 0 ~ 6 Nm |
|
|
||||||
| RS00 | 0 ~ 14 Nm |
|
|
||||||
| RS01 | 0 ~ 17 Nm |
|
|
||||||
| RS02 | 0 ~ 17 Nm |
|
|
||||||
| RS03 | 0 ~ 60 Nm |
|
|
||||||
| RS04 | 0 ~ 120 Nm |
|
|
||||||
| EL05 | 0 ~ 6 Nm |
|
|
||||||
| RS06 | 0 ~ 36 Nm |
|
|
||||||
|
|
||||||
##### 参数limit_spd/spd_ref范围对照表
|
|
||||||
|
|
||||||
| 电机型号 | limit_spd / spd_ref 范围 |
|
|
||||||
|----------|--------------------------|
|
|
||||||
| EL05 | 0 ~ 50 rad/s |
|
|
||||||
| RS00 | 0 ~ 33 rad/s |
|
|
||||||
| RS01 | 0 ~ 44 rad/s |
|
|
||||||
| RS02 | 0 ~ 44 rad/s |
|
|
||||||
| RS03 | 0 ~ 20 rad/s |
|
|
||||||
| RS04 | 0 ~ 15 rad/s |
|
|
||||||
| EL05 | 0 ~ 50 rad/s |
|
|
||||||
| RS06 | 0 ~ 50 rad/s |
|
|
||||||
|
|
||||||
##### 参数limit_cur/iq_ref/iqf范围对照表
|
|
||||||
|
|
||||||
| 电机型号 | limit_cur / iq_ref / iqf 范围 |
|
|
||||||
|----------|-------------------------------|
|
|
||||||
| EL05 | 0 ~ 11 A |
|
|
||||||
| RS00 | 0 ~ 15.5 A |
|
|
||||||
| RS01 | 0 ~ 23 A |
|
|
||||||
| RS02 | 0 ~ 23 A |
|
|
||||||
| RS03 | 0 ~ 27 A |
|
|
||||||
| RS04 | 0 ~ 45 A |
|
|
||||||
| EL05 | 0 ~ 10 A |
|
|
||||||
| RS06 | 0 ~ 27 A |
|
|
||||||
|
|
||||||
##### 数据映射转换宏定义示例(C语言)
|
|
||||||
|
|
||||||
```c
|
|
||||||
// EL05 / EL05
|
|
||||||
#define P_MIN -12.57f
|
|
||||||
#define P_MAX 12.57f
|
|
||||||
#define V_MIN -50.0f
|
|
||||||
#define V_MAX 50.0f
|
|
||||||
#define KP_MIN 0.0f
|
|
||||||
#define KP_MAX 500.0f
|
|
||||||
#define KD_MIN 0.0f
|
|
||||||
#define KD_MAX 5.0f
|
|
||||||
#define T_MIN -6.0f // EL05: -6
|
|
||||||
#define T_MAX 6.0f // EL05: 6
|
|
||||||
|
|
||||||
// RS00
|
|
||||||
#define V_MIN -33.0f
|
|
||||||
#define V_MAX 33.0f
|
|
||||||
#define T_MIN -14.0f
|
|
||||||
#define T_MAX 14.0f
|
|
||||||
|
|
||||||
// RS01 / RS02
|
|
||||||
#define V_MIN -44.0f
|
|
||||||
#define V_MAX 44.0f
|
|
||||||
#define T_MIN -17.0f
|
|
||||||
#define T_MAX 17.0f
|
|
||||||
|
|
||||||
// RS03
|
|
||||||
#define V_MIN -20.0f
|
|
||||||
#define V_MAX 20.0f
|
|
||||||
#define KP_MAX 5000.0f
|
|
||||||
#define KD_MAX 100.0f
|
|
||||||
#define T_MIN -60.0f
|
|
||||||
#define T_MAX 60.0f
|
|
||||||
|
|
||||||
// RS04
|
|
||||||
#define V_MIN -15.0f
|
|
||||||
#define V_MAX 15.0f
|
|
||||||
#define KP_MAX 5000.0f
|
|
||||||
#define KD_MAX 100.0f
|
|
||||||
#define T_MIN -120.0f
|
|
||||||
#define T_MAX 120.0f
|
|
||||||
|
|
||||||
// RS06
|
|
||||||
#define V_MIN -50.0f
|
|
||||||
#define V_MAX 50.0f
|
|
||||||
#define KP_MAX 5000.0f
|
|
||||||
#define KD_MAX 100.0f
|
|
||||||
#define T_MIN -36.0f
|
|
||||||
#define T_MAX 36.0f
|
|
||||||
```
|
|
||||||
|
|
||||||
**版本兼容性说明**:
|
|
||||||
- RS00: 固件版本0.0.2.6及之前P_MIN/P_MAX为±12.5,之后为±12.57
|
|
||||||
- RS01: 固件版本0.1.2.1及之前P_MIN/P_MAX为±12.5,之后为±12.57
|
|
||||||
- RS02: 固件版本0.2.2.11及之前P_MIN/P_MAX为±12.5,之后为±12.57
|
|
||||||
- RS03: 固件版本0.3.0.5及之前P_MIN/P_MAX为±12.5,之后为±12.57
|
|
||||||
- RS04: 固件版本0.4.0.5及之前P_MIN/P_MAX为±12.5,之后为±12.57
|
|
||||||
|
|
||||||
### 1.3 控制模式使用说明
|
|
||||||
|
|
||||||
#### 运控模式
|
|
||||||
1. 电机上电后默认处于运控模式
|
|
||||||
2. 发送电机使能运行帧(通信类型3)
|
|
||||||
3. 发送运控模式电机控制指令(通信类型1)
|
|
||||||
4. 收到电机反馈帧(通信类型2)
|
|
||||||
|
|
||||||
#### 电流模式
|
|
||||||
1. 发送电机模式参数写入命令(通信类型18)设置runmode参数为3
|
|
||||||
2. 发送电机使能运行帧(通信类型3)
|
|
||||||
3. 发送电机模式参数写入命令(通信类型18)设置iq_ref参数为预设电流指令
|
|
||||||
|
|
||||||
#### 速度模式
|
|
||||||
1. 发送电机模式参数写入命令(通信类型18)设置runmode参数为2
|
|
||||||
2. 发送电机使能运行帧(通信类型3)
|
|
||||||
3. 发送电机模式参数写入命令(通信类型18)设置limit_cur参数为预设最大电流指令
|
|
||||||
4. 发送电机模式参数写入命令(通信类型18)设置acc_rad参数为预设加速度指令
|
|
||||||
5. 发送电机模式参数写入命令(通信类型18)设置spd_ref参数为预设速度指令
|
|
||||||
|
|
||||||
#### 位置模式(CSP)
|
|
||||||
1. 发送电机模式参数写入命令(通信类型18)设置runmode参数为5
|
|
||||||
2. 发送电机使能运行帧(通信类型3)
|
|
||||||
3. 发送电机模式参数写入命令(通信类型18)设置limit_spd参数为预设最大速度指令
|
|
||||||
4. 发送电机模式参数写入命令(通信类型18)设置loc_ref参数为预设位置指令
|
|
||||||
|
|
||||||
#### 位置模式(PP)
|
|
||||||
1. 发送电机模式参数写入命令(通信类型18)设置runmode参数为1
|
|
||||||
2. 发送电机使能运行帧(通信类型3)
|
|
||||||
3. 发送电机模式参数写入命令(通信类型18)设置vel_max参数为预设最大速度指令
|
|
||||||
4. 发送电机模式参数写入命令(通信类型18)设置acc_set参数为预设加速度指令
|
|
||||||
5. 发送电机模式参数写入命令(通信类型18)设置loc_ref参数为预设位置指令
|
|
||||||
6. **注意**: 该模式不支持运行过程中改速度和加速度,如想急停可以在过程中将vel_max修改为0
|
|
||||||
|
|
||||||
#### 停止运行
|
|
||||||
发送电机停止运行帧(通信类型4)
|
|
||||||
|
|
||||||
## 二、CANopen通信协议
|
|
||||||
|
|
||||||
CANopen是一个基于CAN总线的"高层协议",实现了OSI模型的第七层。
|
|
||||||
|
|
||||||
### 2.1 CANOpen协议报文分类
|
|
||||||
|
|
||||||
| 分类 | 作用 |
|
|
||||||
|------|------|
|
|
||||||
| NMT 网络管理报文 | 管理网络,切换节点的状态 |
|
|
||||||
| SDO 服务数据对象报文 | 设置设备参数,关键数据传输 |
|
|
||||||
| PDO 过程数据对象报文 | 传输设备的过程数据(温度、速度等) |
|
|
||||||
| EMCY 紧急报文 | 传输设备的故障信息 |
|
|
||||||
| SYNC 同步报文 | 同步数据,同步从站的TPDO数据 |
|
|
||||||
| NODE GUARDING 节点保护报文 | 主站请求从站的状态 |
|
|
||||||
| HeartBeat 心跳报文 | 设备主动发送心跳,表示在线 |
|
|
||||||
|
|
||||||
### 2.2 状态机说明
|
|
||||||
|
|
||||||
- **SWITCH_ON_DISABLED**: 电机初始上电状态
|
|
||||||
- **OPERATION_ENABLE**: 运行状态
|
|
||||||
- 通过修改controlword(6040)为6、7、15过渡到OPERATION_ENABLE状态
|
|
||||||
- 也可直接修改为15进入OPERATION_ENABLE状态
|
|
||||||
- **停止电机**: 修改controlword(6040)为1,进入SWITCH_ON_DISABLED状态
|
|
||||||
- **急停**: 修改controlword(6040)为11(慎用,易造成浪涌电压)
|
|
||||||
- **清除错误**: 修改controlword(6040)可以清除常规错误
|
|
||||||
|
|
||||||
**注意**: 切换模式需要在失能状态下,请在进入OPERATION_ENABLE之前设置相应模式
|
|
||||||
|
|
||||||
### 2.3 状态反馈参数
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 603F | Error_code | 可读 | UINTEGER16 | / |
|
|
||||||
| 6041 | Statusword | 可读 | UINTEGER16 | / |
|
|
||||||
| 6061 | Modes_of_operation_display | 可读 | INTEGER8 | / |
|
|
||||||
| 6062 | Position_demannd_value | 可读 | INTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 6064 | Position_actual_value | 可读 | INTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 606B | Velocity_demand_value | 可读 | INTEGER32 | 0.1rpm |
|
|
||||||
| 606C | Velocity_actual_value | 可读 | INTEGER32 | 0.1rpm |
|
|
||||||
| 6077 | Torque_actual_value | 可读 | INTEGER16 | 0.1%负载率,1000代表2N.m |
|
|
||||||
| 6078 | Current_actual_value | 可读 | INTEGER16 | mA |
|
|
||||||
| 6079 | DC_link_circuit_voltage | 可读 | INTEGER32 | mV |
|
|
||||||
|
|
||||||
### 2.4 归零模式(设置零位)
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 6040 | controlword | 可读写 | UINTEGER16 | / |
|
|
||||||
| 6060 | Modes of operation | 可读写 | INTEGER8 | / |
|
|
||||||
|
|
||||||
**标零方式**: 电机在失能状态下设置Modes of operation为6,电机即会设置当前位置为零位
|
|
||||||
**零点保持**: 修改controlword为15,电机会在零位位置保持
|
|
||||||
|
|
||||||
### 2.5 位置模式(PP)
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 6040 | controlword | 可读写 | UINTEGER16 | / |
|
|
||||||
| 6060 | Modes of operation | 可读写 | INTEGER8 | / |
|
|
||||||
| 6067 | Position_window | 可读写 | UINTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 6068 | Position_window_time | 可读写 | UINTEGER16 | ms |
|
|
||||||
| 6071 | Target_torque | 可读写 | INTEGER16 | 0.1%负载率,1000代表2N.m |
|
|
||||||
| 607A | Target_position | 可读写 | INTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 6081 | Profile_velocity | 可读写 | UINTEGER32 | 0.1rpm |
|
|
||||||
| 6083 | Profile_acceleration | 可读写 | UINTEGER32 | 0.1rpm/s |
|
|
||||||
|
|
||||||
**步骤**:
|
|
||||||
1. 电机在失能状态下设置Modes of operation为1
|
|
||||||
2. 设置Target_torque(位置模式下最大力矩绝对值,必设)
|
|
||||||
3. 设置Profile_velocity(位置模式速度绝对值,必设)
|
|
||||||
4. 设置Profile_acceleration(位置模式加速度绝对值,必设)
|
|
||||||
5. 设置Position_window和Position_window_time(可选)
|
|
||||||
6. 设置controlword为15
|
|
||||||
7. 设置Target_position(绝对位置)即可到达指定位置
|
|
||||||
|
|
||||||
### 2.6 位置模式(CSP)
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 6040 | controlword | 可读写 | UINTEGER16 | / |
|
|
||||||
| 6060 | Modes of operation | 可读写 | INTEGER8 | / |
|
|
||||||
| 6067 | Position_window | 可读写 | UINTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 6068 | Position_window_time | 可读写 | UINTEGER16 | ms |
|
|
||||||
| 6071 | Target_torque | 可读写 | INTEGER16 | 0.1%负载率,1000代表2N.m |
|
|
||||||
| 607A | Target_position | 可读写 | INTEGER32 | 脉冲,一圈对应16384脉冲 |
|
|
||||||
| 6081 | Profile_velocity | 可读写 | UINTEGER32 | 0.1rpm |
|
|
||||||
|
|
||||||
**步骤**:
|
|
||||||
1. 电机在失能状态下设置Modes of operation为5
|
|
||||||
2. 设置Target_torque(位置模式下最大力矩绝对值,必设)
|
|
||||||
3. 设置Profile_velocity(位置模式速度绝对值,必设)
|
|
||||||
4. 设置Position_window和Position_window_time(可选,0即不启用)
|
|
||||||
5. 设置controlword为15
|
|
||||||
6. 设置Target_position(绝对位置)即可到达指定位置
|
|
||||||
|
|
||||||
### 2.7 速度模式
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 6040 | controlword | 可读写 | UINTEGER16 | / |
|
|
||||||
| 6060 | Modes of operation | 可读写 | INTEGER8 | / |
|
|
||||||
| 6071 | Target_torque | 可读写 | INTEGER16 | 0.1%负载率,1000代表2N.m |
|
|
||||||
| 60FF | Target_velocity | 可读写 | INTEGER32 | 0.1rpm |
|
|
||||||
|
|
||||||
**步骤**:
|
|
||||||
1. 电机在失能状态下设置Modes of operation为3
|
|
||||||
2. 设置Target_torque(位置模式下最大力矩绝对值,必设)
|
|
||||||
3. 设置controlword为15
|
|
||||||
4. 设置Target_velocity即可到达指定速度
|
|
||||||
|
|
||||||
### 2.8 力矩模式
|
|
||||||
|
|
||||||
| 索引 | 名称 | 属性 | 类型 | 单位 |
|
|
||||||
|------|------|------|------|------|
|
|
||||||
| 6040 | controlword | 可读写 | UINTEGER16 | / |
|
|
||||||
| 6060 | Modes of operation | 可读写 | INTEGER8 | / |
|
|
||||||
| 6071 | Target_torque | 可读写 | INTEGER16 | 0.1%负载率,1000代表2N.m |
|
|
||||||
|
|
||||||
**步骤**:
|
|
||||||
1. 电机在失能状态下设置Modes of operation为4
|
|
||||||
2. 设置controlword为15
|
|
||||||
3. 设置Target_torque即可输出指定力矩
|
|
||||||
|
|
||||||
### 2.9 协议切换帧(扩展帧)
|
|
||||||
|
|
||||||
切换电机协议,重新上电生效
|
|
||||||
|
|
||||||
- **ID**: `0xFFF`
|
|
||||||
- **数据**: `01 02 03 04 05 06 [F_CMD]`
|
|
||||||
- **F_CMD说明**:
|
|
||||||
- 0: 私有协议(默认)
|
|
||||||
- 1: CANopen协议
|
|
||||||
- 2: MIT协议
|
|
||||||
|
|
||||||
**应答帧**:
|
|
||||||
- **ID**: 电机id(11位标准帧)
|
|
||||||
- **数据**: 64位MCU唯一标识符
|
|
||||||
|
|
||||||
## 三、MIT通信协议
|
|
||||||
|
|
||||||
MIT协议采用标准帧格式(11位ID),波特率默认1Mbps。
|
|
||||||
|
|
||||||
### 3.1 CAN ID结构(MIT协议标准帧)
|
|
||||||
|
|
||||||
```
|
|
||||||
11位ID结构:
|
|
||||||
Bit10~bit8: 模式类型
|
|
||||||
bit7~0: id(电机CAN_ID或主机CAN_ID)
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3.2 支持的控制模式
|
|
||||||
|
|
||||||
- **MIT模式**: 给定电机运控5个参数
|
|
||||||
- **速度模式**: 给定电机指定的运行速度
|
|
||||||
- **位置模式**: 给定电机指定的位置和速度,电机将以过程速度运行到该指定的位置
|
|
||||||
|
|
||||||
### 3.3 指令列表
|
|
||||||
|
|
||||||
#### 应答指令1
|
|
||||||
- **ID**: `0xFD`(主机id)
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0: 电机canid
|
|
||||||
- Byte1~2: 当前角度 [0~65535] 对应 (-12.57rad~12.57rad)
|
|
||||||
- Byte3为高8位,Byte4[7-4](高4位)为低4位: 当前速度 [0~4096] 对应 (-50rad/s~50rad/s)
|
|
||||||
- Byte4[3-0](低4位)为高4位,Byte5为低8位: 当前力矩 [0~4096] 对应 (-6N.m~6N.m)
|
|
||||||
- Byte6~7: 绕组温度 Temp(摄氏度)*10,单位度
|
|
||||||
|
|
||||||
#### 应答指令2
|
|
||||||
- **ID**: 电机id
|
|
||||||
- **数据**: 64位MCU唯一标识符
|
|
||||||
|
|
||||||
#### 指令1:电机使能运行
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF FF FC`
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令2:电机停止运行
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF FF FD`
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令3:电机MIT动态参数
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0~1: 目标角度 [0~65535] 对应 (-12.57rad~12.57rad)
|
|
||||||
- Byte2为高8位,Byte3[7-4](高4位)为低4位: 目标速度 [0~4096] 对应 (-50rad/s~50rad/s)
|
|
||||||
- Byte3[3-0](低4位)为高4位,Byte4为低8位: kp [0~4096] 对应 (0-500)
|
|
||||||
- Byte5为其高8位,Byte6[7-4](高4位)为其低4位: kd [0~4096] 对应 (0-5)
|
|
||||||
- Byte6[3-0](低4位)为高4位,Byte7为低8位: 目标力矩 [0~4096] 对应 (-6N.m~6N.m)
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令4:设置零点(非位置模式)
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF FF FE`
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令5:清除错误及读取异常状态
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF [F_CMD] FB`
|
|
||||||
- F_CMD = 0xFF: 消除当前的异常
|
|
||||||
- F_CMD = 其他值: 在回复中的BYTE1中回传错误值
|
|
||||||
- **清错应答帧**: 应答指令1
|
|
||||||
- **异常状态应答帧**:
|
|
||||||
- ID: `0xFD`(主机id)
|
|
||||||
- Byte0: 电机canid
|
|
||||||
- Byte1~4: fault值(非0:有故障,0:正常)
|
|
||||||
- Bit16: A相电流采样过流
|
|
||||||
- Bit14: 堵转过载算法保护
|
|
||||||
- Bit9: 位置初始化故障
|
|
||||||
- Bit8: 硬件识别故障
|
|
||||||
- Bit7: 编码器未标定
|
|
||||||
- Bit5: C相电流采样过流
|
|
||||||
- Bit4: B相电流采样过流
|
|
||||||
- Bit3: 过压故障(超过60V)
|
|
||||||
- Bit2: 欠压故障(低于12V)
|
|
||||||
- Bit1: 驱动芯片故障
|
|
||||||
- Bit0: 电机过温故障(超过145度)
|
|
||||||
|
|
||||||
#### 指令6:设置运行模式
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF [F_CMD] FC`
|
|
||||||
- F_CMD说明:
|
|
||||||
- 0: MIT模式(默认)
|
|
||||||
- 1: 位置模式
|
|
||||||
- 2: 速度模式
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令7:修改电机CANID
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF [F_CMD] FA`
|
|
||||||
- F_CMD: 目标修改的电机id
|
|
||||||
- **应答帧**: 应答指令2
|
|
||||||
|
|
||||||
#### 指令8:修改电机协议
|
|
||||||
切换电机协议,重新上电生效
|
|
||||||
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF [F_CMD] FD`
|
|
||||||
- F_CMD说明:
|
|
||||||
- 0: 私有协议(默认)
|
|
||||||
- 1: CANopen协议
|
|
||||||
- 2: MIT协议
|
|
||||||
- **应答帧**: 应答指令2
|
|
||||||
|
|
||||||
#### 指令9:修改主机canid
|
|
||||||
- **ID**: `0x7F`(目标电机canid)
|
|
||||||
- **数据**: `FF FF FF FF FF FF [F_CMD] 01`
|
|
||||||
- F_CMD: 为主机canid
|
|
||||||
- **应答帧**: 应答指令2
|
|
||||||
|
|
||||||
#### 指令10:位置模式控制指令
|
|
||||||
- **ID**: `0x17F`(Bit10~8=1,bit7~0=目标电机canid)
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0~3: 目标位置,单位rad,32位单精度float
|
|
||||||
- Byte4~7: 目标速度,单位rad/s,32位单精度float
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
#### 指令11:速度模式控制指令
|
|
||||||
- **ID**: `0x27F`(Bit10~8=2,bit7~0=目标电机canid)
|
|
||||||
- **数据格式**:
|
|
||||||
- Byte0~3: 目标速度,单位rad/s,32位单精度float
|
|
||||||
- Byte4~7: 速度位置模式电流限制,单位A,32位单精度float
|
|
||||||
- **应答帧**: 应答指令1
|
|
||||||
|
|
||||||
### 3.4 控制模式使用说明
|
|
||||||
|
|
||||||
#### 运控模式
|
|
||||||
1. 电机上电后默认处于运控模式
|
|
||||||
2. 发送电机使能运行帧(指令1)
|
|
||||||
3. 发送运控模式电机控制指令(指令3)
|
|
||||||
4. 发送电机停止帧(指令2)
|
|
||||||
|
|
||||||
#### 速度模式
|
|
||||||
1. 发送电机模式参数写入命令(指令6)设置模式为2
|
|
||||||
2. 发送电机使能运行帧(指令1)
|
|
||||||
3. 发送电机模式参数写入命令(指令11)设置最大电流(绝对值)和预设速度
|
|
||||||
4. 发送电机停止帧(指令2)
|
|
||||||
|
|
||||||
#### 位置模式(CSP)
|
|
||||||
1. 发送电机模式参数写入命令(指令6)设置模式为1
|
|
||||||
2. 发送电机使能运行帧(指令1)
|
|
||||||
3. 发送电机模式参数写入命令(指令10)设置最大速度(绝对值)和预设位置
|
|
||||||
4. 发送电机停止帧(指令2)
|
|
||||||
|
|
||||||
## 四、协议切换说明
|
|
||||||
|
|
||||||
### 4.1 切换方法
|
|
||||||
|
|
||||||
1. **通过上位机修改**: 修改protocol_1标志位或发送通信类型25(私有协议)即可切换协议
|
|
||||||
2. **通过CAN盒操作**: 切换协议后,需要通过can盒发送相应通信协议的切换协议指令进行切换
|
|
||||||
- CANopen协议: 发送扩展帧的协议切换帧
|
|
||||||
- MIT协议: 发送标准帧的指令8
|
|
||||||
|
|
||||||
### 4.2 生效方式
|
|
||||||
|
|
||||||
**重新上电生效**: 协议切换后需要重新上电才能生效
|
|
||||||
|
|
||||||
### 4.3 CAN ID一致性
|
|
||||||
|
|
||||||
- **CANopen协议**: canopen的id与私有协议下的canid保持一致
|
|
||||||
- **MIT协议**: 使用标准帧,id为电机CAN_ID
|
|
||||||
|
|
||||||
## 五、故障说明
|
|
||||||
|
|
||||||
### 5.1 故障位定义
|
|
||||||
|
|
||||||
故障信息通过通信类型2的Bit16~21或通信类型21的Byte0~3反馈:
|
|
||||||
|
|
||||||
| 位 | 故障名称 | 说明 |
|
|
||||||
|----|----------|------|
|
|
||||||
| Bit0 | 电机过温故障 | 电机热敏电阻温度超过145度 |
|
|
||||||
| Bit1 | 驱动芯片故障 | 电机驱动芯片报故障 |
|
|
||||||
| Bit2 | 欠压故障 | 电机电压低于保护电压12V |
|
|
||||||
| Bit3 | 过压故障 | 电机电压超过保护电压60V |
|
|
||||||
| Bit4 | B相电流故障 | B相电流采样过流 |
|
|
||||||
| Bit5 | C相电流故障 | C相电流采样过流 |
|
|
||||||
| Bit7 | 编码器未标定 | 电机未标定编码器 |
|
|
||||||
| Bit8 | 硬件识别故障 | 硬件识别故障 |
|
|
||||||
| Bit9 | 位置初始化故障 | 位置初始化故障 |
|
|
||||||
| Bit14 | 堵转过载算法保护 | 电机堵转过载算法保护 |
|
|
||||||
| Bit16 | A相电流故障 | A相电流采样过流 |
|
|
||||||
|
|
||||||
### 5.2 警告位定义
|
|
||||||
|
|
||||||
| 位 | 警告名称 | 说明 |
|
|
||||||
|----|----------|------|
|
|
||||||
| Bit0 | 电机过温预警 | 默认145度 |
|
|
||||||
|
|
||||||
## 六、特殊功能说明
|
|
||||||
|
|
||||||
### 6.1 主动上报
|
|
||||||
|
|
||||||
- **默认状态**: 关闭
|
|
||||||
- **开启方式**: 通过通信类型24开启上报
|
|
||||||
- **上报类型**: 通信类型2(电机反馈数据)
|
|
||||||
- **上报间隔**: 默认10ms,可通过通信类型18修改EPScan_time参数来更改
|
|
||||||
- **最小间隔**: 10ms
|
|
||||||
|
|
||||||
### 6.2 零点标志位
|
|
||||||
|
|
||||||
- **参数**: zero_sta(0x7029)
|
|
||||||
- **说明**:
|
|
||||||
- 0: 上电后默认位置为0-2π(默认)
|
|
||||||
- 1: 上电后默认位置为-π-π
|
|
||||||
- **修改方式**: 通过上位机或通信类型18修改,通过通信类型18修改需要用通信类型22保存
|
|
||||||
|
|
||||||
### 6.3 类型2变更说明
|
|
||||||
|
|
||||||
类型2变更为周期性循环-4π-4π,可通过该方式记圈数。
|
|
||||||
|
|
||||||
**位置接口变更**:
|
|
||||||
- P_MIN: -12.57f
|
|
||||||
- P_MAX: 12.57f
|
|
||||||
|
|
||||||
### 6.4 CAN超时保护
|
|
||||||
|
|
||||||
- **参数**: CAN_TIMEOUT(canTimeout,0x7028)
|
|
||||||
- **说明**:
|
|
||||||
- 值为0时: 该功能不启用
|
|
||||||
- 值为非0时: 当电机在一定时间段内没收到can指令时,电机进入reset模式
|
|
||||||
- 20000代表1s
|
|
||||||
|
|
||||||
### 6.5 标零功能
|
|
||||||
|
|
||||||
- **支持模式**: CSP和运控模式下可以标零
|
|
||||||
- **限制**: PP模式标零会屏蔽掉
|
|
||||||
- **说明**: 新版本电机在CSP和运控模式下标零,电机期望会马上更新为0,这样电机不会运动
|
|
||||||
|
|
||||||
## 七、数据转换说明
|
|
||||||
|
|
||||||
### 7.1 数据字节序
|
|
||||||
|
|
||||||
- **私有协议**: 大部分数据高字节在前,低字节在后
|
|
||||||
- **参数读写**: 数据低字节在前,高字节在后
|
|
||||||
- **MIT协议**: 按指令说明
|
|
||||||
|
|
||||||
### 7.2 数据范围映射
|
|
||||||
|
|
||||||
**⚠️ 重要**: 各型号电机的数据映射范围不同,详见 [1.2 可读写参数列表](#12-可读写参数列表) 中的各型号参数范围差异表。
|
|
||||||
|
|
||||||
#### 通用映射规则
|
|
||||||
|
|
||||||
| 数据类型 | 原始值范围 | 映射方式 | 备注 |
|
|
||||||
|----------|------------|----------|------|
|
|
||||||
| 角度(私有协议16位) | 0~65535 | 线性映射到 P_MIN~P_MAX | 各型号统一为 ±12.57rad |
|
|
||||||
| 角速度(私有协议16位) | 0~65535 | 线性映射到 V_MIN~V_MAX | 各型号不同,见差异表 |
|
|
||||||
| 力矩(私有协议16位) | 0~65535 | 线性映射到 T_MIN~T_MAX | 各型号不同,见差异表 |
|
|
||||||
| Kp(私有协议16位) | 0~65535 | 线性映射到 KP_MIN~KP_MAX | 小型号0~500,大型号0~5000 |
|
|
||||||
| Kd(私有协议16位) | 0~65535 | 线性映射到 KD_MIN~KD_MAX | 小型号0~5,大型号0~100 |
|
|
||||||
| 角度(MIT协议12位) | 0~65535 | 线性映射到 P_MIN~P_MAX | ±12.57rad |
|
|
||||||
| 角速度(MIT协议12位) | 0~4096 | 线性映射到 V_MIN~V_MAX | 各型号不同 |
|
|
||||||
| 力矩(MIT协议12位) | 0~4096 | 线性映射到 T_MIN~T_MAX | 各型号不同 |
|
|
||||||
| Kp(MIT协议12位) | 0~4096 | 线性映射到 KP_MIN~KP_MAX | 各型号不同 |
|
|
||||||
| Kd(MIT协议12位) | 0~4096 | 线性映射到 KD_MIN~KD_MAX | 各型号不同 |
|
|
||||||
|
|
||||||
#### 各型号数据映射快速参考
|
|
||||||
|
|
||||||
| 电机型号 | 力矩范围 | 速度范围 | Kp范围 | Kd范围 |
|
|
||||||
|----------|----------|----------|--------|--------|
|
|
||||||
| EL05 | ±6Nm | ±50rad/s | 0~500 | 0~5 |
|
|
||||||
| RS00 | ±14Nm | ±33rad/s | 0~500 | 0~5 |
|
|
||||||
| RS01 | ±17Nm | ±44rad/s | 0~500 | 0~5 |
|
|
||||||
| RS02 | ±17Nm | ±44rad/s | 0~500 | 0~5 |
|
|
||||||
| RS03 | ±60Nm | ±20rad/s | 0~5000 | 0~100 |
|
|
||||||
| RS04 | ±120Nm | ±15rad/s | 0~5000 | 0~100 |
|
|
||||||
| EL05 | ±6Nm | ±50rad/s | 0~500 | 0~5 |
|
|
||||||
| RS06 | ±36Nm | ±50rad/s | 0~5000 | 0~100 |
|
|
||||||
|
|
||||||
#### 温度映射
|
|
||||||
- 格式: Temp(摄氏度)*10
|
|
||||||
- 示例: 温度25.5度 = 255
|
|
||||||
|
|
||||||
#### 数据转换函数
|
|
||||||
|
|
||||||
```c
|
|
||||||
// 浮点数转无符号整数(用于发送)
|
|
||||||
int float_to_uint(float x, float x_min, float x_max, int bits) {
|
|
||||||
float span = x_max - x_min;
|
|
||||||
float offset = x_min;
|
|
||||||
if (x > x_max) x = x_max;
|
|
||||||
else if (x < x_min) x = x_min;
|
|
||||||
return (int)((x - offset) * ((float)((1 << bits) - 1)) / span);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 无符号整数转浮点数(用于接收)
|
|
||||||
float uint_to_float(int x_int, float x_min, float x_max, int bits) {
|
|
||||||
float span = x_max - x_min;
|
|
||||||
float offset = x_min;
|
|
||||||
return ((float)x_int) * span / ((float)((1 << bits) - 1)) + offset;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 7.3 浮点数格式
|
|
||||||
|
|
||||||
- **IEEE-754标准**: 32位单精度浮点数
|
|
||||||
- **字节序**: 按协议要求(低字节在前或高字节在前)
|
|
||||||
|
|
||||||
## 八、版本说明
|
|
||||||
|
|
||||||
本文档基于以下版本说明书整理:
|
|
||||||
- EL05使用说明书251210
|
|
||||||
- RS00使用说明书251210
|
|
||||||
- RS01使用说明书251210
|
|
||||||
- RS02使用说明书251210
|
|
||||||
- RS03使用说明书251210
|
|
||||||
- RS04使用说明书251210
|
|
||||||
- EL05使用说明书251210
|
|
||||||
- RS06使用说明书251210
|
|
||||||
|
|
||||||
**注意**: 不同型号的电机在某些细节上可能有差异,具体请参考对应型号的详细说明书。如无某些功能,请访问官网git升级最新版本。
|
|
||||||
|
|
||||||
## 九、参考资料
|
|
||||||
|
|
||||||
- 官方网站: https://www.robstride.com/
|
|
||||||
- 下载中心: www.robstride.com(可下载EDS文件等)
|
|
||||||
- 技术支持: 请通过官方网站联系技术支持
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**文档生成日期**: 2025年12月29日
|
|
||||||
**文档版本**: 1.0
|
|
||||||
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
## 工程文件框架总览(RCPRO)
|
|
||||||
|
|
||||||
- 工程类型:STM32F4(大疆 RoboMentors A 型板)四足机器人控制工程
|
|
||||||
- 工具链:STM32CubeMX 初始化 + Keil MDK 工程(Project 目录)
|
|
||||||
- 主要语言:C / C++(以 C 为主)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 顶层目录结构
|
|
||||||
|
|
||||||
- Inc/
|
|
||||||
- 工程公共头文件与 HAL、CMSIS、FreeRTOS 相关头文件
|
|
||||||
- User/
|
|
||||||
- 用户自定义代码(算法、驱动、任务、启动文件等)
|
|
||||||
- Project/
|
|
||||||
- Keil 工程文件、编译输出中间文件、调试配置
|
|
||||||
- .vscode/
|
|
||||||
- VS Code 配置(智能提示、调试配置等)
|
|
||||||
- 文档与说明文件
|
|
||||||
- README.md、DBUS.md、can.md、app_can.md、姿态.md、辅助通道.md 等
|
|
||||||
- RS02使用说明书251112.pdf、遥控器相关 md 文档
|
|
||||||
- 其他工具与脚本
|
|
||||||
- keilkilll.bat 等
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Inc 目录结构
|
|
||||||
|
|
||||||
- Inc/hal_inc/
|
|
||||||
- STM32 HAL 库头文件(GPIO、RCC、CAN、UART、SPI、TIM、RTC 等)
|
|
||||||
- 由 STM32CubeMX 生成或随库提供
|
|
||||||
- Inc/m3_inc/
|
|
||||||
- CMSIS 相关头文件(内核 core_cmX、stm32f4xx.h、系统时钟 system_stm32f4xx.h 等)
|
|
||||||
- 提供底层寄存器与内核抽象
|
|
||||||
- Inc/os_inc/
|
|
||||||
- FreeRTOS 核心头文件(FreeRTOS.h、task.h、queue.h、semphr.h 等)
|
|
||||||
- CMSIS-OS 适配层 cmsis_os.h
|
|
||||||
- Inc 根目录下关键头文件:
|
|
||||||
- main.h:主函数相关声明
|
|
||||||
- gpio.h、dma.h、adc.h、tim.h、spi.h、usart.h、rtc.h:外设初始化接口
|
|
||||||
- can.h:CAN 相关句柄与接口声明
|
|
||||||
- FreeRTOSConfig.h:FreeRTOS 配置
|
|
||||||
- stm32f4xx_hal_conf.h:HAL 外设使能配置
|
|
||||||
- stm32f4xx_it.h / stm32f4xx_it.c:中断向量与中断服务函数
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## User 目录结构
|
|
||||||
|
|
||||||
- User/algorithm/
|
|
||||||
- pid.c / pid.h
|
|
||||||
- PID 控制算法实现(位置/速度等)
|
|
||||||
- ramp.c / ramp.h
|
|
||||||
- 斜坡函数、平滑过渡控制(例如速度/位置渐变)
|
|
||||||
|
|
||||||
- User/driver/
|
|
||||||
- Movement.c / Movement.h
|
|
||||||
- 四足运动控制与步态生成(站立、行走等高层运动逻辑)
|
|
||||||
- leg.c / leg.h
|
|
||||||
- 机械腿几何建模与逆运动学计算
|
|
||||||
- lingzu_motor.c / lingzu_motor.h
|
|
||||||
- 灵足 RS02 关节电机 CAN 通讯与控制接口
|
|
||||||
- can_device.c / can_device.h
|
|
||||||
- CAN 收发封装、设备层抽象
|
|
||||||
- uart_device.c / uart_device.h
|
|
||||||
- UART 封装(遥控器、调试串口等)
|
|
||||||
- mpu6500_reg.h / ist8310_reg.h
|
|
||||||
- IMU、磁力计寄存器定义
|
|
||||||
- keyboard.h、calibrate.h 等
|
|
||||||
- 键盘控制、校准相关接口
|
|
||||||
|
|
||||||
- User/app/
|
|
||||||
- lingzu_task.c / lingzu_task.h
|
|
||||||
- 主要控制任务入口:四足行走、站立、模式切换等
|
|
||||||
- uart_task.c / uart_task.h
|
|
||||||
- 串口任务(接收/解析/发送数据)
|
|
||||||
- study_task.c / study_task.h
|
|
||||||
- 学习/实验用任务逻辑
|
|
||||||
- chassis_task.h、gimbal_task.h、shoot_custom.c、execute_task.h 等
|
|
||||||
- 源于 RM 工程的任务接口,可复用/裁剪
|
|
||||||
|
|
||||||
- User 其他文件
|
|
||||||
- startup.c / startup.h
|
|
||||||
- 启动相关代码(复位后初始化、任务启动等)
|
|
||||||
- rm_hal_lib.h
|
|
||||||
- RoboMentors 板级相关封装
|
|
||||||
- sys.h
|
|
||||||
- 系统级通用定义与工具
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Project 目录结构(Keil 工程)
|
|
||||||
|
|
||||||
- Project/RoboMentors_Board/
|
|
||||||
- RoboMentors_Board.uvprojx / .uvoptx / .uvguix.*
|
|
||||||
- Keil 工程、编译配置、调试配置文件
|
|
||||||
- *.o / *.d / *.crf
|
|
||||||
- 中间目标文件与依赖信息(编译产物)
|
|
||||||
- RoboMentors_Board.axf / .hex / .map / .htm
|
|
||||||
- 最终固件、链接映射与编译报告
|
|
||||||
|
|
||||||
- Project/DebugConfig/
|
|
||||||
- RoboMentors_Board_STM32F427IIHx*.dbgconf
|
|
||||||
- 调试器与目标芯片调试配置
|
|
||||||
|
|
||||||
- Project/output/
|
|
||||||
- RoboMentors_Board.map
|
|
||||||
- 链接映射文件(地址分布、段信息等)
|
|
||||||
|
|
||||||
- Project 根目录其他文件
|
|
||||||
- JLinkLog.txt / JLinkSettings.ini
|
|
||||||
- J-Link 调试相关日志与配置
|
|
||||||
- images.jpg
|
|
||||||
- 可能用于说明或调试记录
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 文档与辅助说明
|
|
||||||
|
|
||||||
- README.md
|
|
||||||
- 工程整体说明(来源、用途等)
|
|
||||||
- DBUS.md / can.md / app_can.md
|
|
||||||
- 遥控器 DBUS、CAN 通信相关说明
|
|
||||||
- move.c.md、姿态.md、辅助通道.md
|
|
||||||
- 与运动控制、姿态解算、辅助通道配置相关的说明文档
|
|
||||||
- # RadioLink AT9S Pro 遥控器使用说明书(详细版).md
|
|
||||||
- 遥控器详细使用说明
|
|
||||||
- RS02使用说明书251112.pdf
|
|
||||||
- RS02 关节电机官方说明书
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 建议阅读顺序(熟悉工程)
|
|
||||||
|
|
||||||
- 1)阅读顶层 README.md 与遥控器 / RS02 说明文档
|
|
||||||
- 2)查看 User/driver/ 中的 lingzu_motor.c、leg.c、Movement.c
|
|
||||||
- 3)查看 User/app/lingzu_task.c,理解任务入口与模式切换
|
|
||||||
- 4)根据需要再深入 Inc/、Project/ 与其他说明 md 文档
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
## 遥控器按键使用说明
|
|
||||||
---
|
|
||||||
- 更新时间: 2026年1月31日
|
|
||||||
---
|
|
||||||
### 1. 基础控制通道
|
|
||||||
| 通道 | 对应按键 | 功能说明 | 备注 |
|
|
||||||
| :---: | :---: | :---: | :---: |
|
|
||||||
| **Ch1** | 右摇杆 (左右) | 预留 (替代SwG) | **左:** 左转 (Turn Left)<br>**右:** 右转 (Turn Right) |
|
|
||||||
| **Ch2** | 右摇杆 (上下) | 预留 (替代SwB) | **上:** 前进 (Forward)<br>**下:** 后退 (Backward) |
|
|
||||||
| **Ch3** | 左摇杆 (上下) | **步态使能** | **推杆(>200):** 进入行走模式<br>**回中/下拉:** 保持站立模式 |
|
|
||||||
| **Ch4** | 左摇杆 (左右) | 预留 (暂无功能) | |
|
|
||||||
|
|
||||||
### 2. 辅助功能开关
|
|
||||||
| 开关 | 通道 | 功能定义 | 详细操作 |
|
|
||||||
| :---: | :---: | :---: | :---: |
|
|
||||||
| **SwA** | Ch10 | **起立/趴下切换** | **上:** 起立 (Stand/Walk Ready)<br>**下:** 趴下 (Prone/Rest) |
|
|
||||||
| **SwD** | Ch7 | **急停/使能** | **下:** 软急停 (停止所有电机输出)<br>**上:** 正常工作 (恢复电机使能) |
|
|
||||||
| **SwC** | Ch8 | **步态方向控制** | **下:** 前进 (Forward)<br>**中:** 原地踏步 (Step In Place)<br>**上:** 后退 (Backward) |
|
|
||||||
| **SwG** | Ch5 | **转向控制** | **上:** 左转 (Turn Left)<br>**中:** 直行 (Straight)<br>**下:** 右转 (Turn Right) |
|
|
||||||
|
|
||||||
|
|
||||||
### 3. 组合操作说明
|
|
||||||
1. **启动流程**:
|
|
||||||
- 确保 **SwD** 拨到上 (正常工作)。
|
|
||||||
- 等到电机全部上电回到0位置, 确认电机没有异常.
|
|
||||||
- 如果有电机异常, 请立即拨下 **SwD** (软急停) ,重新拨上SwD使能电机,如果电机还是异常,请检查电机连接.
|
|
||||||
- 将 **SwA** 拨到上 (起立),机器人将从趴下状态站起。
|
|
||||||
- 确认 **SwC** 拨到中 (原地踏步),推动摇杆,使狗原地踏步两下,稳定狗身.
|
|
||||||
|
|
||||||
2. **行走操作**:
|
|
||||||
- 保持 **SwA** 在上 (站立状态)。
|
|
||||||
- 使用 **SwC** 选择方向 (前/后/原地)。
|
|
||||||
- 使用 **SwG** 选择转向 (左/直/右)。
|
|
||||||
- **推起左摇杆 (Ch3)**: 机器人开始按设定方向和转向行走。
|
|
||||||
- **拨下左摇杆**: 机器人停止行走,保持站立。
|
|
||||||
|
|
||||||
3. **紧急停止**:
|
|
||||||
- 任何时候拨动 **SwD** 到上,机器人将立即切断电机力矩输出 (软急停)。
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ch通道中上方低电平,下方为高电平
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
-17
@@ -1,20 +1,15 @@
|
|||||||
# 8DOF 串联足机械资料
|
# 机械设计
|
||||||
|
|
||||||
`CAD/` 保存通过中期检查的 8DOF 串联足机器人 SolidWorks 源文件。
|
本目录用于整理 16DOF 串联轮足机器人的机械资料。
|
||||||
|
|
||||||
## 主要文件
|
```text
|
||||||
|
02_mechanical/
|
||||||
|
├─ CAD/ # 可编辑机械源文件
|
||||||
|
├─ STEP/ # 通用交换格式
|
||||||
|
├─ drawings/ # 二维加工图
|
||||||
|
└─ robot_description/
|
||||||
|
├─ URDF/
|
||||||
|
└─ MJCF/
|
||||||
|
```
|
||||||
|
|
||||||
- `DOG总装.SLDASM`:整机总装候选入口
|
正式导入前需要确认比赛机械、训练模型和仿真模型之间的尺寸、质量与关节定义关系。
|
||||||
- `LDOG身体.SLDASM`:机身装配体
|
|
||||||
- `单一腿部.SLDASM`:单腿装配体
|
|
||||||
- `动力单元.SLDASM`:腿部动力单元
|
|
||||||
- `小腿.SLDASM`:小腿装配体
|
|
||||||
- `*.SLDPRT`:机身、腿部、同步带传动和电机连接零件
|
|
||||||
|
|
||||||
## 使用建议
|
|
||||||
|
|
||||||
1. 保持 `CAD/` 内文件的相对位置和文件名不变。
|
|
||||||
2. 优先从 `CAD/DOG总装.SLDASM` 打开整机。
|
|
||||||
3. 若出现引用丢失,使用 SolidWorks 的查找引用功能指向 `CAD/`。
|
|
||||||
|
|
||||||
当前资料尚未包含 8DOF STEP 总装和二维 PDF 工程图。
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
# 硬件
|
# 硬件
|
||||||
|
|
||||||
8DOF 版本使用 DJI RoboMaster A 型板兼容主控和现成 RS02 关节电机,没有单独整理出本项目自研 PCB。
|
本目录用于保存 16DOF 轮足机器人的自研电路、接线图、BOM、传感器与计算平台说明。
|
||||||
|
|
||||||
|
第三方硬件资料不作为自研成果提交。
|
||||||
|
|||||||
+2
-18
@@ -1,21 +1,5 @@
|
|||||||
# 嵌入式固件
|
# 嵌入式固件
|
||||||
|
|
||||||
本目录保存运行在 MCU 上的固件源码和构建工程。Keil 工程属于 firmware;编译生成的 `.hex`、`.bin`、`.axf` 等属于构建产物。
|
本目录用于保存运行在 MCU 或其他嵌入式控制器上的固件源码和构建工程。
|
||||||
|
|
||||||
```text
|
编译生成的 `.hex`、`.bin`、`.elf`、`.axf` 等文件不进入源码目录,可在需要时作为 Release 附件发布。
|
||||||
04_firmware/
|
|
||||||
└─ stm32/
|
|
||||||
└─ dji_a_board/
|
|
||||||
├─ RCPROyuan/
|
|
||||||
└─ rc_/
|
|
||||||
```
|
|
||||||
|
|
||||||
两个目录均包含 STM32F427、FreeRTOS、RS02 电机控制和 Keil MDK 工程。当前保留原名,待确认中期检查实际烧录版本后再决定是否改为 `baseline`、`midterm` 等语义名称。
|
|
||||||
|
|
||||||
工程入口均为:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Project/RoboMentors_Board.uvprojx
|
|
||||||
```
|
|
||||||
|
|
||||||
根目录 `.gitignore` 排除 Keil 编译输出和用户状态文件。预编译库 `Inc/RoboMentors_Board1_3.lib` 暂时保留以维持原工程依赖,其再分发条件仍需确认。
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
.idea
|
|
||||||
.DS*
|
|
||||||
.git
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
/*
|
|
||||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
|
||||||
All rights reserved
|
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
|
||||||
|
|
||||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License (version 2) as published by the
|
|
||||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
|
||||||
|
|
||||||
***************************************************************************
|
|
||||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
|
||||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
|
||||||
>>! obliged to provide the source code for proprietary components !<<
|
|
||||||
>>! outside of the FreeRTOS kernel. !<<
|
|
||||||
***************************************************************************
|
|
||||||
|
|
||||||
FreeRTOS 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. Full license text is available on the following
|
|
||||||
link: http://www.freertos.org/a00114.html
|
|
||||||
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* FreeRTOS provides completely free yet professionally developed, *
|
|
||||||
* robust, strictly quality controlled, supported, and cross *
|
|
||||||
* platform software that is more than just the market leader, it *
|
|
||||||
* is the industry's de facto standard. *
|
|
||||||
* *
|
|
||||||
* Help yourself get started quickly while simultaneously helping *
|
|
||||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
|
||||||
* tutorial book, reference manual, or both: *
|
|
||||||
* http://www.FreeRTOS.org/Documentation *
|
|
||||||
* *
|
|
||||||
***************************************************************************
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
|
||||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
|
||||||
defined configASSERT()?
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
|
||||||
embedded software for free we request you assist our global community by
|
|
||||||
participating in the support forum.
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
|
||||||
be as productive as possible as early as possible. Now you can receive
|
|
||||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
|
||||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
|
||||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
|
||||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
|
||||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
|
||||||
|
|
||||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
|
||||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
|
||||||
licenses offer ticketed support, indemnification and commercial middleware.
|
|
||||||
|
|
||||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
|
||||||
engineered and independently SIL3 certified version for use in safety and
|
|
||||||
mission critical applications that require provable dependability.
|
|
||||||
|
|
||||||
1 tab == 4 spaces!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FREERTOS_CONFIG_H
|
|
||||||
#define FREERTOS_CONFIG_H
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
|
||||||
* Application specific definitions.
|
|
||||||
*
|
|
||||||
* These definitions should be adjusted for your particular hardware and
|
|
||||||
* application requirements.
|
|
||||||
*
|
|
||||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
|
||||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
|
||||||
*
|
|
||||||
* See http://www.freertos.org/a00110.html.
|
|
||||||
*----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
/* Section where include file can be added */
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* Ensure stdint is only used by the compiler, and not the assembler. */
|
|
||||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "main.h"
|
|
||||||
extern uint32_t SystemCoreClock;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define configUSE_PREEMPTION 1
|
|
||||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
|
||||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
|
||||||
#define configUSE_IDLE_HOOK 0
|
|
||||||
#define configUSE_TICK_HOOK 0
|
|
||||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
|
||||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
|
||||||
#define configMAX_PRIORITIES ( 7 )
|
|
||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)15360)
|
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
|
||||||
#define configUSE_16_BIT_TICKS 0
|
|
||||||
#define configUSE_MUTEXES 1
|
|
||||||
#define configQUEUE_REGISTRY_SIZE 8
|
|
||||||
#define configCHECK_FOR_STACK_OVERFLOW 1
|
|
||||||
#define configUSE_RECURSIVE_MUTEXES 1
|
|
||||||
#define configUSE_COUNTING_SEMAPHORES 1
|
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
|
||||||
|
|
||||||
/* Co-routine definitions. */
|
|
||||||
#define configUSE_CO_ROUTINES 0
|
|
||||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
|
||||||
|
|
||||||
/* Set the following definitions to 1 to include the API function, or zero
|
|
||||||
to exclude the API function. */
|
|
||||||
#define INCLUDE_vTaskPrioritySet 1
|
|
||||||
#define INCLUDE_uxTaskPriorityGet 1
|
|
||||||
#define INCLUDE_vTaskDelete 1
|
|
||||||
#define INCLUDE_vTaskCleanUpResources 0
|
|
||||||
#define INCLUDE_vTaskSuspend 1
|
|
||||||
#define INCLUDE_vTaskDelayUntil 1
|
|
||||||
#define INCLUDE_vTaskDelay 1
|
|
||||||
#define INCLUDE_xTaskGetSchedulerState 1
|
|
||||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
|
||||||
|
|
||||||
/* Cortex-M specific definitions. */
|
|
||||||
#ifdef __NVIC_PRIO_BITS
|
|
||||||
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
|
||||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
|
||||||
#else
|
|
||||||
#define configPRIO_BITS 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
|
||||||
function. */
|
|
||||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
|
|
||||||
|
|
||||||
/* The highest interrupt priority that can be used by any interrupt service
|
|
||||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
|
||||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
|
||||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
|
||||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
|
||||||
|
|
||||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
|
||||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
|
||||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
|
||||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
|
||||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
|
||||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
|
||||||
|
|
||||||
/* Normal assert() semantics without relying on the provision of an assert.h
|
|
||||||
header file. */
|
|
||||||
/* USER CODE BEGIN 1 */
|
|
||||||
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
|
|
||||||
/* USER CODE END 1 */
|
|
||||||
|
|
||||||
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
|
||||||
standard names. */
|
|
||||||
#define vPortSVCHandler SVC_Handler
|
|
||||||
#define xPortPendSVHandler PendSV_Handler
|
|
||||||
|
|
||||||
/* IMPORTANT: This define MUST be commented when used with STM32Cube firmware,
|
|
||||||
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
|
|
||||||
/* #define xPortSysTickHandler SysTick_Handler */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Defines */
|
|
||||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
|
||||||
/* USER CODE END Defines */
|
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
|
||||||
Binary file not shown.
@@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* File Name : ADC.h
|
|
||||||
* Description : This file provides code for the configuration
|
|
||||||
* of the ADC instances.
|
|
||||||
******************************************************************************
|
|
||||||
* This notice applies to any and all portions of this file
|
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
|
||||||
* USER CODE END. Other portions of this file, whether
|
|
||||||
* inserted by the user or by software development tools
|
|
||||||
* are owned by their respective copyright owners.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
|
||||||
* contributors to this software may be used to endorse or promote products
|
|
||||||
* derived from this software without specific written permission.
|
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
|
||||||
* this license is void and will automatically terminate your rights under
|
|
||||||
* this license.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __adc_H
|
|
||||||
#define __adc_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
extern ADC_HandleTypeDef hadc1;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
extern void _Error_Handler(char *, int);
|
|
||||||
|
|
||||||
void MX_ADC1_Init(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
|
||||||
|
|
||||||
/* USER CODE END Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /*__ adc_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* File Name : CAN.h
|
|
||||||
* Description : This file provides code for the configuration
|
|
||||||
* of the CAN instances.
|
|
||||||
******************************************************************************
|
|
||||||
* This notice applies to any and all portions of this file
|
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
|
||||||
* USER CODE END. Other portions of this file, whether
|
|
||||||
* inserted by the user or by software development tools
|
|
||||||
* are owned by their respective copyright owners.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
|
||||||
* contributors to this software may be used to endorse or promote products
|
|
||||||
* derived from this software without specific written permission.
|
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
|
||||||
* this license is void and will automatically terminate your rights under
|
|
||||||
* this license.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __can_H
|
|
||||||
#define __can_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
extern CAN_HandleTypeDef hcan1;
|
|
||||||
extern CAN_HandleTypeDef hcan2;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
extern void _Error_Handler(char *, int);
|
|
||||||
|
|
||||||
void MX_CAN1_Init(void);
|
|
||||||
void MX_CAN2_Init(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
|
||||||
|
|
||||||
/* USER CODE END Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /*__ can_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file cpu_utils.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.1.0
|
|
||||||
* @date 20-November-2014
|
|
||||||
* @brief Header for cpu_utils module
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef _CPU_UTILS_H__
|
|
||||||
#define _CPU_UTILS_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "cmsis_os.h"
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/* Exported variables --------------------------------------------------------*/
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
#define CALCULATION_PERIOD 1000
|
|
||||||
|
|
||||||
/* Exported functions ------------------------------------------------------- */
|
|
||||||
uint16_t osGetCPUUsage(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _CPU_UTILS_H__ */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* File Name : dma.h
|
|
||||||
* Description : This file contains all the function prototypes for
|
|
||||||
* the dma.c file
|
|
||||||
******************************************************************************
|
|
||||||
* This notice applies to any and all portions of this file
|
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
|
||||||
* USER CODE END. Other portions of this file, whether
|
|
||||||
* inserted by the user or by software development tools
|
|
||||||
* are owned by their respective copyright owners.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
|
||||||
* contributors to this software may be used to endorse or promote products
|
|
||||||
* derived from this software without specific written permission.
|
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
|
||||||
* this license is void and will automatically terminate your rights under
|
|
||||||
* this license.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __dma_H
|
|
||||||
#define __dma_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/* DMA memory to memory transfer handles -------------------------------------*/
|
|
||||||
extern void _Error_Handler(char*, int);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
void MX_DMA_Init(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
|
||||||
|
|
||||||
/* USER CODE END Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __dma_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* File Name : gpio.h
|
|
||||||
* Description : This file contains all the functions prototypes for
|
|
||||||
* the gpio
|
|
||||||
******************************************************************************
|
|
||||||
* This notice applies to any and all portions of this file
|
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
|
||||||
* USER CODE END. Other portions of this file, whether
|
|
||||||
* inserted by the user or by software development tools
|
|
||||||
* are owned by their respective copyright owners.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
|
||||||
* contributors to this software may be used to endorse or promote products
|
|
||||||
* derived from this software without specific written permission.
|
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
|
||||||
* this license is void and will automatically terminate your rights under
|
|
||||||
* this license.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __gpio_H
|
|
||||||
#define __gpio_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
void MX_GPIO_Init(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
|
||||||
|
|
||||||
/* USER CODE END Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /*__ pinoutConfig_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,267 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief This file contains all the functions prototypes for the HAL
|
|
||||||
* module driver.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_H
|
|
||||||
#define __STM32F4xx_HAL_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_conf.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup HAL
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup HAL_Exported_Macros HAL Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Freeze/Unfreeze Peripherals in Debug mode
|
|
||||||
*/
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM3() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM4() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM5() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM6() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM7() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM12() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM13() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM14() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_RTC() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_WWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_IWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_CAN1() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_CAN2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM1() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM8() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM9() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM10() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP))
|
|
||||||
#define __HAL_DBGMCU_FREEZE_TIM11() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP))
|
|
||||||
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM3() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM4() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM5() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM6() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM7() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM12() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM13() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM14() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_RTC() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_WWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_IWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_CAN1() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN1_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_CAN2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN2_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM1() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM1_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM8() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM8_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM9() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM9_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM10() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM10_STOP))
|
|
||||||
#define __HAL_DBGMCU_UNFREEZE_TIM11() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM11_STOP))
|
|
||||||
|
|
||||||
/** @brief Main Flash memory mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_FLASH() (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE))
|
|
||||||
|
|
||||||
/** @brief System Flash memory mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
|
|
||||||
SYSCFG->MEMRMP |= SYSCFG_MEMRMP_MEM_MODE_0;\
|
|
||||||
}while(0);
|
|
||||||
|
|
||||||
/** @brief Embedded SRAM mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_SRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
|
|
||||||
SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_0 | SYSCFG_MEMRMP_MEM_MODE_1);\
|
|
||||||
}while(0);
|
|
||||||
|
|
||||||
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
|
|
||||||
/** @brief FSMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_FSMC() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
|
|
||||||
SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\
|
|
||||||
}while(0);
|
|
||||||
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
|
|
||||||
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
/** @brief FMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_FMC() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
|
|
||||||
SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\
|
|
||||||
}while(0);
|
|
||||||
|
|
||||||
/** @brief FMC/SDRAM Bank 1 and 2 mapped at 0x00000000
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
|
|
||||||
SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_2);\
|
|
||||||
}while(0);
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
|
|
||||||
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
/** @defgroup Cortex_Lockup_Enable Cortex Lockup Enable
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @brief SYSCFG Break Lockup lock
|
|
||||||
* Enables and locks the connection of Cortex-M4 LOCKUP (Hardfault) output to TIM1/8 input
|
|
||||||
* @note The selected configuration is locked and can be unlocked by system reset
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_BREAK_PVD_LOCK() do {SYSCFG->CFGR2 &= ~(SYSCFG_CFGR2_PVD_LOCK); \
|
|
||||||
SYSCFG->CFGR2 |= SYSCFG_CFGR2_PVD_LOCK; \
|
|
||||||
}while(0)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PVD_Lock_Enable PVD Lock
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @brief SYSCFG Break PVD lock
|
|
||||||
* Enables and locks the PVD connection with Timer1/8 Break Input, , as well as the PVDE and PLS[2:0] in the PWR_CR register
|
|
||||||
* @note The selected configuration is locked and can be unlocked by system reset
|
|
||||||
*/
|
|
||||||
#define __HAL_SYSCFG_BREAK_LOCKUP_LOCK() do {SYSCFG->CFGR2 &= ~(SYSCFG_CFGR2_LOCKUP_LOCK); \
|
|
||||||
SYSCFG->CFGR2 |= SYSCFG_CFGR2_LOCKUP_LOCK; \
|
|
||||||
}while(0)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup HAL_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @addtogroup HAL_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization and de-initialization functions ******************************/
|
|
||||||
HAL_StatusTypeDef HAL_Init(void);
|
|
||||||
HAL_StatusTypeDef HAL_DeInit(void);
|
|
||||||
void HAL_MspInit(void);
|
|
||||||
void HAL_MspDeInit(void);
|
|
||||||
HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup HAL_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions ************************************************/
|
|
||||||
void HAL_IncTick(void);
|
|
||||||
void HAL_Delay(__IO uint32_t Delay);
|
|
||||||
uint32_t HAL_GetTick(void);
|
|
||||||
void HAL_SuspendTick(void);
|
|
||||||
void HAL_ResumeTick(void);
|
|
||||||
uint32_t HAL_GetHalVersion(void);
|
|
||||||
uint32_t HAL_GetREVID(void);
|
|
||||||
uint32_t HAL_GetDEVID(void);
|
|
||||||
void HAL_DBGMCU_EnableDBGSleepMode(void);
|
|
||||||
void HAL_DBGMCU_DisableDBGSleepMode(void);
|
|
||||||
void HAL_DBGMCU_EnableDBGStopMode(void);
|
|
||||||
void HAL_DBGMCU_DisableDBGStopMode(void);
|
|
||||||
void HAL_DBGMCU_EnableDBGStandbyMode(void);
|
|
||||||
void HAL_DBGMCU_DisableDBGStandbyMode(void);
|
|
||||||
void HAL_EnableCompensationCell(void);
|
|
||||||
void HAL_DisableCompensationCell(void);
|
|
||||||
void HAL_GetUID(uint32_t *UID);
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
void HAL_EnableMemorySwappingBank(void);
|
|
||||||
void HAL_DisableMemorySwappingBank(void);
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/** @defgroup HAL_Private_Variables HAL Private Variables
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup HAL_Private_Constants HAL Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,787 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_can.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of CAN HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_CAN_H
|
|
||||||
#define __STM32F4xx_HAL_CAN_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
|
|
||||||
defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
|
|
||||||
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
|
|
||||||
defined(STM32F423xx)
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CAN
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Exported_Types CAN Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL State structures definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_CAN_STATE_RESET = 0x00U, /*!< CAN not yet initialized or disabled */
|
|
||||||
HAL_CAN_STATE_READY = 0x01U, /*!< CAN initialized and ready for use */
|
|
||||||
HAL_CAN_STATE_BUSY = 0x02U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_TX = 0x12U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_RX0 = 0x22U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_RX1 = 0x32U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_TX_RX0 = 0x42U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_TX_RX1 = 0x52U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_RX0_RX1 = 0x62U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_BUSY_TX_RX0_RX1 = 0x72U, /*!< CAN process is ongoing */
|
|
||||||
HAL_CAN_STATE_TIMEOUT = 0x03U, /*!< CAN in Timeout state */
|
|
||||||
HAL_CAN_STATE_ERROR = 0x04U /*!< CAN error state */
|
|
||||||
|
|
||||||
}HAL_CAN_StateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN init structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t Prescaler; /*!< Specifies the length of a time quantum.
|
|
||||||
This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
|
|
||||||
|
|
||||||
uint32_t Mode; /*!< Specifies the CAN operating mode.
|
|
||||||
This parameter can be a value of @ref CAN_operating_mode */
|
|
||||||
|
|
||||||
uint32_t SJW; /*!< Specifies the maximum number of time quanta
|
|
||||||
the CAN hardware is allowed to lengthen or
|
|
||||||
shorten a bit to perform resynchronization.
|
|
||||||
This parameter can be a value of @ref CAN_synchronisation_jump_width */
|
|
||||||
|
|
||||||
uint32_t BS1; /*!< Specifies the number of time quanta in Bit Segment 1.
|
|
||||||
This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */
|
|
||||||
|
|
||||||
uint32_t BS2; /*!< Specifies the number of time quanta in Bit Segment 2.
|
|
||||||
This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */
|
|
||||||
|
|
||||||
uint32_t TTCM; /*!< Enable or disable the time triggered communication mode.
|
|
||||||
This parameter can be set to ENABLE or DISABLE. */
|
|
||||||
|
|
||||||
uint32_t ABOM; /*!< Enable or disable the automatic bus-off management.
|
|
||||||
This parameter can be set to ENABLE or DISABLE */
|
|
||||||
|
|
||||||
uint32_t AWUM; /*!< Enable or disable the automatic wake-up mode.
|
|
||||||
This parameter can be set to ENABLE or DISABLE */
|
|
||||||
|
|
||||||
uint32_t NART; /*!< Enable or disable the non-automatic retransmission mode.
|
|
||||||
This parameter can be set to ENABLE or DISABLE */
|
|
||||||
|
|
||||||
uint32_t RFLM; /*!< Enable or disable the receive FIFO Locked mode.
|
|
||||||
This parameter can be set to ENABLE or DISABLE */
|
|
||||||
|
|
||||||
uint32_t TXFP; /*!< Enable or disable the transmit FIFO priority.
|
|
||||||
This parameter can be set to ENABLE or DISABLE */
|
|
||||||
}CAN_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN filter configuration structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit
|
|
||||||
configuration, first one for a 16-bit configuration).
|
|
||||||
This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
|
|
||||||
|
|
||||||
uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit
|
|
||||||
configuration, second one for a 16-bit configuration).
|
|
||||||
This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
|
|
||||||
|
|
||||||
uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number,
|
|
||||||
according to the mode (MSBs for a 32-bit configuration,
|
|
||||||
first one for a 16-bit configuration).
|
|
||||||
This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
|
|
||||||
|
|
||||||
uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number,
|
|
||||||
according to the mode (LSBs for a 32-bit configuration,
|
|
||||||
second one for a 16-bit configuration).
|
|
||||||
This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
|
|
||||||
|
|
||||||
uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
|
|
||||||
This parameter can be a value of @ref CAN_filter_FIFO */
|
|
||||||
|
|
||||||
uint32_t FilterNumber; /*!< Specifies the filter which will be initialized.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 27 */
|
|
||||||
|
|
||||||
uint32_t FilterMode; /*!< Specifies the filter mode to be initialized.
|
|
||||||
This parameter can be a value of @ref CAN_filter_mode */
|
|
||||||
|
|
||||||
uint32_t FilterScale; /*!< Specifies the filter scale.
|
|
||||||
This parameter can be a value of @ref CAN_filter_scale */
|
|
||||||
|
|
||||||
uint32_t FilterActivation; /*!< Enable or disable the filter.
|
|
||||||
This parameter can be set to ENABLE or DISABLE. */
|
|
||||||
|
|
||||||
uint32_t BankNumber; /*!< Select the start slave bank filter.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 28 */
|
|
||||||
|
|
||||||
}CAN_FilterConfTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN Tx message structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t StdId; /*!< Specifies the standard identifier.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */
|
|
||||||
|
|
||||||
uint32_t ExtId; /*!< Specifies the extended identifier.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */
|
|
||||||
|
|
||||||
uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.
|
|
||||||
This parameter can be a value of @ref CAN_Identifier_Type */
|
|
||||||
|
|
||||||
uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted.
|
|
||||||
This parameter can be a value of @ref CAN_remote_transmission_request */
|
|
||||||
|
|
||||||
uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 8 */
|
|
||||||
|
|
||||||
uint8_t Data[8]; /*!< Contains the data to be transmitted.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
|
|
||||||
|
|
||||||
}CanTxMsgTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN Rx message structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t StdId; /*!< Specifies the standard identifier.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */
|
|
||||||
|
|
||||||
uint32_t ExtId; /*!< Specifies the extended identifier.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */
|
|
||||||
|
|
||||||
uint32_t IDE; /*!< Specifies the type of identifier for the message that will be received.
|
|
||||||
This parameter can be a value of @ref CAN_Identifier_Type */
|
|
||||||
|
|
||||||
uint32_t RTR; /*!< Specifies the type of frame for the received message.
|
|
||||||
This parameter can be a value of @ref CAN_remote_transmission_request */
|
|
||||||
|
|
||||||
uint32_t DLC; /*!< Specifies the length of the frame that will be received.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 8 */
|
|
||||||
|
|
||||||
uint8_t Data[8]; /*!< Contains the data to be received.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
|
|
||||||
|
|
||||||
uint32_t FMI; /*!< Specifies the index of the filter the message stored in the mailbox passes through.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
|
|
||||||
|
|
||||||
uint32_t FIFONumber; /*!< Specifies the receive FIFO number.
|
|
||||||
This parameter can be CAN_FIFO0 or CAN_FIFO1 */
|
|
||||||
|
|
||||||
}CanRxMsgTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
CAN_TypeDef *Instance; /*!< Register base address */
|
|
||||||
|
|
||||||
CAN_InitTypeDef Init; /*!< CAN required parameters */
|
|
||||||
|
|
||||||
CanTxMsgTypeDef* pTxMsg; /*!< Pointer to transmit structure */
|
|
||||||
|
|
||||||
CanRxMsgTypeDef* pRxMsg; /*!< Pointer to reception structure for RX FIFO0 msg */
|
|
||||||
|
|
||||||
CanRxMsgTypeDef* pRx1Msg; /*!< Pointer to reception structure for RX FIFO1 msg */
|
|
||||||
|
|
||||||
__IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /*!< CAN locking object */
|
|
||||||
|
|
||||||
__IO uint32_t ErrorCode; /*!< CAN Error code */
|
|
||||||
|
|
||||||
}CAN_HandleTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Exported_Constants CAN Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_Error_Code CAN Error Code
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define HAL_CAN_ERROR_NONE 0x00000000U /*!< No error */
|
|
||||||
#define HAL_CAN_ERROR_EWG 0x00000001U /*!< EWG error */
|
|
||||||
#define HAL_CAN_ERROR_EPV 0x00000002U /*!< EPV error */
|
|
||||||
#define HAL_CAN_ERROR_BOF 0x00000004U /*!< BOF error */
|
|
||||||
#define HAL_CAN_ERROR_STF 0x00000008U /*!< Stuff error */
|
|
||||||
#define HAL_CAN_ERROR_FOR 0x00000010U /*!< Form error */
|
|
||||||
#define HAL_CAN_ERROR_ACK 0x00000020U /*!< Acknowledgment error */
|
|
||||||
#define HAL_CAN_ERROR_BR 0x00000040U /*!< Bit recessive */
|
|
||||||
#define HAL_CAN_ERROR_BD 0x00000080U /*!< LEC dominant */
|
|
||||||
#define HAL_CAN_ERROR_CRC 0x00000100U /*!< LEC transfer error */
|
|
||||||
#define HAL_CAN_ERROR_FOV0 0x00000200U /*!< FIFO0 overrun error */
|
|
||||||
#define HAL_CAN_ERROR_FOV1 0x00000400U /*!< FIFO1 overrun error */
|
|
||||||
#define HAL_CAN_ERROR_TXFAIL 0x00000800U /*!< Transmit failure */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_InitStatus CAN InitStatus
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_INITSTATUS_FAILED ((uint8_t)0x00) /*!< CAN initialization failed */
|
|
||||||
#define CAN_INITSTATUS_SUCCESS ((uint8_t)0x01) /*!< CAN initialization OK */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_operating_mode CAN Operating Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_MODE_NORMAL 0x00000000U /*!< Normal mode */
|
|
||||||
#define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */
|
|
||||||
#define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */
|
|
||||||
#define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_synchronisation_jump_width CAN Synchronisation Jump Width
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_SJW_1TQ 0x00000000U /*!< 1 time quantum */
|
|
||||||
#define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */
|
|
||||||
#define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */
|
|
||||||
#define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in bit segment 1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_BS1_1TQ 0x00000000U /*!< 1 time quantum */
|
|
||||||
#define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */
|
|
||||||
#define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */
|
|
||||||
#define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */
|
|
||||||
#define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */
|
|
||||||
#define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */
|
|
||||||
#define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */
|
|
||||||
#define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */
|
|
||||||
#define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */
|
|
||||||
#define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */
|
|
||||||
#define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */
|
|
||||||
#define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */
|
|
||||||
#define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */
|
|
||||||
#define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */
|
|
||||||
#define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */
|
|
||||||
#define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in bit segment 2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_BS2_1TQ 0x00000000U /*!< 1 time quantum */
|
|
||||||
#define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */
|
|
||||||
#define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */
|
|
||||||
#define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */
|
|
||||||
#define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */
|
|
||||||
#define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */
|
|
||||||
#define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */
|
|
||||||
#define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_filter_mode CAN Filter Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_FILTERMODE_IDMASK ((uint8_t)0x00) /*!< Identifier mask mode */
|
|
||||||
#define CAN_FILTERMODE_IDLIST ((uint8_t)0x01) /*!< Identifier list mode */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_filter_scale CAN Filter Scale
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_FILTERSCALE_16BIT ((uint8_t)0x00) /*!< Two 16-bit filters */
|
|
||||||
#define CAN_FILTERSCALE_32BIT ((uint8_t)0x01) /*!< One 32-bit filter */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_filter_FIFO CAN Filter FIFO
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_FILTER_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
|
|
||||||
#define CAN_FILTER_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_Identifier_Type CAN Identifier Type
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_ID_STD 0x00000000U /*!< Standard Id */
|
|
||||||
#define CAN_ID_EXT 0x00000004U /*!< Extended Id */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_RTR_DATA 0x00000000U /*!< Data frame */
|
|
||||||
#define CAN_RTR_REMOTE 0x00000002U /*!< Remote frame */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_receive_FIFO_number_constants CAN Receive FIFO Number Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */
|
|
||||||
#define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_flags CAN Flags
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus()
|
|
||||||
and CAN_ClearFlag() functions. */
|
|
||||||
/* If the flag is 0x1XXXXXXX, it means that it can only be used with
|
|
||||||
CAN_GetFlagStatus() function. */
|
|
||||||
|
|
||||||
/* Transmit Flags */
|
|
||||||
#define CAN_FLAG_RQCP0 0x00000500U /*!< Request MailBox0 flag */
|
|
||||||
#define CAN_FLAG_RQCP1 0x00000508U /*!< Request MailBox1 flag */
|
|
||||||
#define CAN_FLAG_RQCP2 0x00000510U /*!< Request MailBox2 flag */
|
|
||||||
#define CAN_FLAG_TXOK0 0x00000501U /*!< Transmission OK MailBox0 flag */
|
|
||||||
#define CAN_FLAG_TXOK1 0x00000509U /*!< Transmission OK MailBox1 flag */
|
|
||||||
#define CAN_FLAG_TXOK2 0x00000511U /*!< Transmission OK MailBox2 flag */
|
|
||||||
#define CAN_FLAG_TME0 0x0000051AU /*!< Transmit mailbox 0 empty flag */
|
|
||||||
#define CAN_FLAG_TME1 0x0000051BU /*!< Transmit mailbox 0 empty flag */
|
|
||||||
#define CAN_FLAG_TME2 0x0000051CU /*!< Transmit mailbox 0 empty flag */
|
|
||||||
|
|
||||||
/* Receive Flags */
|
|
||||||
#define CAN_FLAG_FF0 0x00000203U /*!< FIFO 0 Full flag */
|
|
||||||
#define CAN_FLAG_FOV0 0x00000204U /*!< FIFO 0 Overrun flag */
|
|
||||||
|
|
||||||
#define CAN_FLAG_FF1 0x00000403U /*!< FIFO 1 Full flag */
|
|
||||||
#define CAN_FLAG_FOV1 0x00000404U /*!< FIFO 1 Overrun flag */
|
|
||||||
|
|
||||||
/* Operating Mode Flags */
|
|
||||||
#define CAN_FLAG_INAK 0x00000100U /*!< Initialization acknowledge flag */
|
|
||||||
#define CAN_FLAG_SLAK 0x00000101U /*!< Sleep acknowledge flag */
|
|
||||||
#define CAN_FLAG_ERRI 0x00000102U /*!< Error flag */
|
|
||||||
#define CAN_FLAG_WKU 0x00000103U /*!< Wake up flag */
|
|
||||||
#define CAN_FLAG_SLAKI 0x00000104U /*!< Sleep acknowledge flag */
|
|
||||||
|
|
||||||
/* @note When SLAK interrupt is disabled (SLKIE=0), no polling on SLAKI is possible.
|
|
||||||
In this case the SLAK bit can be polled.*/
|
|
||||||
|
|
||||||
/* Error Flags */
|
|
||||||
#define CAN_FLAG_EWG 0x00000300U /*!< Error warning flag */
|
|
||||||
#define CAN_FLAG_EPV 0x00000301U /*!< Error passive flag */
|
|
||||||
#define CAN_FLAG_BOF 0x00000302U /*!< Bus-Off flag */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_Interrupts CAN Interrupts
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */
|
|
||||||
|
|
||||||
/* Receive Interrupts */
|
|
||||||
#define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */
|
|
||||||
#define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */
|
|
||||||
#define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */
|
|
||||||
#define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */
|
|
||||||
#define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */
|
|
||||||
#define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */
|
|
||||||
|
|
||||||
/* Operating Mode Interrupts */
|
|
||||||
#define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */
|
|
||||||
#define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */
|
|
||||||
|
|
||||||
/* Error Interrupts */
|
|
||||||
#define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */
|
|
||||||
#define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */
|
|
||||||
#define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */
|
|
||||||
#define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */
|
|
||||||
#define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CAN_Mailboxes_Definition CAN Mailboxes Definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_TXMAILBOX_0 ((uint8_t)0x00)
|
|
||||||
#define CAN_TXMAILBOX_1 ((uint8_t)0x01)
|
|
||||||
#define CAN_TXMAILBOX_2 ((uint8_t)0x02)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Exported_Macros CAN Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Reset CAN handle state
|
|
||||||
* @param __HANDLE__: specifies the CAN Handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the specified CAN interrupts.
|
|
||||||
* @param __HANDLE__: CAN handle
|
|
||||||
* @param __INTERRUPT__: CAN Interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the specified CAN interrupts.
|
|
||||||
* @param __HANDLE__: CAN handle
|
|
||||||
* @param __INTERRUPT__: CAN Interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the number of pending received messages.
|
|
||||||
* @param __HANDLE__: CAN handle
|
|
||||||
* @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
|
|
||||||
* @retval The number of pending message.
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
|
|
||||||
((uint8_t)((__HANDLE__)->Instance->RF0R&0x03U)) : ((uint8_t)((__HANDLE__)->Instance->RF1R & 0x03U)))
|
|
||||||
|
|
||||||
/** @brief Check whether the specified CAN flag is set or not.
|
|
||||||
* @param __HANDLE__: CAN Handle
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg CAN_TSR_RQCP0: Request MailBox0 Flag
|
|
||||||
* @arg CAN_TSR_RQCP1: Request MailBox1 Flag
|
|
||||||
* @arg CAN_TSR_RQCP2: Request MailBox2 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
|
|
||||||
* @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
|
|
||||||
* @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
|
|
||||||
* @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
|
|
||||||
* @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
|
|
||||||
* @arg CAN_FLAG_FF0: FIFO 0 Full Flag
|
|
||||||
* @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
|
|
||||||
* @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
|
|
||||||
* @arg CAN_FLAG_FF1: FIFO 1 Full Flag
|
|
||||||
* @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
|
|
||||||
* @arg CAN_FLAG_WKU: Wake up Flag
|
|
||||||
* @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
|
|
||||||
* @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
|
|
||||||
* @arg CAN_FLAG_EWG: Error Warning Flag
|
|
||||||
* @arg CAN_FLAG_EPV: Error Passive Flag
|
|
||||||
* @arg CAN_FLAG_BOF: Bus-Off Flag
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \
|
|
||||||
((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))))
|
|
||||||
|
|
||||||
/** @brief Clear the specified CAN pending flag.
|
|
||||||
* @param __HANDLE__: CAN Handle.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg CAN_TSR_RQCP0: Request MailBox0 Flag
|
|
||||||
* @arg CAN_TSR_RQCP1: Request MailBox1 Flag
|
|
||||||
* @arg CAN_TSR_RQCP2: Request MailBox2 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
|
|
||||||
* @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
|
|
||||||
* @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
|
|
||||||
* @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
|
|
||||||
* @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
|
|
||||||
* @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
|
|
||||||
* @arg CAN_FLAG_FF0: FIFO 0 Full Flag
|
|
||||||
* @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
|
|
||||||
* @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
|
|
||||||
* @arg CAN_FLAG_FF1: FIFO 1 Full Flag
|
|
||||||
* @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
|
|
||||||
* @arg CAN_FLAG_WKU: Wake up Flag
|
|
||||||
* @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
|
|
||||||
* @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \
|
|
||||||
((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
|
|
||||||
(((__HANDLE__)->Instance->MSR) = ((uint32_t)1U << ((__FLAG__) & CAN_FLAG_MASK))))
|
|
||||||
|
|
||||||
/** @brief Check if the specified CAN interrupt source is enabled or disabled.
|
|
||||||
* @param __HANDLE__: CAN Handle
|
|
||||||
* @param __INTERRUPT__: specifies the CAN interrupt source to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg CAN_IT_TME: Transmit mailbox empty interrupt enable
|
|
||||||
* @arg CAN_IT_FMP0: FIFO0 message pending interrupt enable
|
|
||||||
* @arg CAN_IT_FMP1: FIFO1 message pending interrupt enable
|
|
||||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check the transmission status of a CAN Frame.
|
|
||||||
* @param __HANDLE__: CAN Handle
|
|
||||||
* @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
|
|
||||||
* @retval The new status of transmission (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\
|
|
||||||
(((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) == (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) :\
|
|
||||||
((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) == (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) :\
|
|
||||||
((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Release the specified receive FIFO.
|
|
||||||
* @param __HANDLE__: CAN handle
|
|
||||||
* @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
|
|
||||||
((__HANDLE__)->Instance->RF0R = CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R = CAN_RF1R_RFOM1))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Cancel a transmit request.
|
|
||||||
* @param __HANDLE__: CAN Handle
|
|
||||||
* @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\
|
|
||||||
(((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ0) :\
|
|
||||||
((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ1) :\
|
|
||||||
((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ2))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable or disable the DBG Freeze for CAN.
|
|
||||||
* @param __HANDLE__: CAN Handle
|
|
||||||
* @param __NEWSTATE__: new state of the CAN peripheral.
|
|
||||||
* This parameter can be: ENABLE (CAN reception/transmission is frozen
|
|
||||||
* during debug. Reception FIFOs can still be accessed/controlled normally)
|
|
||||||
* or DISABLE (CAN is working during debug).
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \
|
|
||||||
((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup CAN_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CAN_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization/de-initialization functions ***********************************/
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan);
|
|
||||||
void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan);
|
|
||||||
void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CAN_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* I/O operation functions ******************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan);
|
|
||||||
HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan);
|
|
||||||
void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan);
|
|
||||||
void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan);
|
|
||||||
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan);
|
|
||||||
void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CAN_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral State functions ***************************************************/
|
|
||||||
uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan);
|
|
||||||
HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Private_Types CAN Private Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Private_Variables CAN Private Variables
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Private_Constants CAN Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04) /*!< CAN cell did not provide CAN_TxStatus_NoMailBox */
|
|
||||||
#define CAN_FLAG_MASK 0x000000FFU
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Private_Macros CAN Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \
|
|
||||||
((MODE) == CAN_MODE_LOOPBACK)|| \
|
|
||||||
((MODE) == CAN_MODE_SILENT) || \
|
|
||||||
((MODE) == CAN_MODE_SILENT_LOOPBACK))
|
|
||||||
#define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \
|
|
||||||
((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ))
|
|
||||||
#define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ)
|
|
||||||
#define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ)
|
|
||||||
#define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U))
|
|
||||||
#define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27U)
|
|
||||||
#define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \
|
|
||||||
((MODE) == CAN_FILTERMODE_IDLIST))
|
|
||||||
#define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \
|
|
||||||
((SCALE) == CAN_FILTERSCALE_32BIT))
|
|
||||||
#define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \
|
|
||||||
((FIFO) == CAN_FILTER_FIFO1))
|
|
||||||
#define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28U)
|
|
||||||
|
|
||||||
#define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
|
|
||||||
#define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FFU))
|
|
||||||
#define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU)
|
|
||||||
#define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
|
|
||||||
|
|
||||||
#define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \
|
|
||||||
((IDTYPE) == CAN_ID_EXT))
|
|
||||||
#define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))
|
|
||||||
#define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup CAN_Private_Functions CAN Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
|
|
||||||
STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
|
|
||||||
STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_CAN_H */
|
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,428 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_cortex.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of CORTEX HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_CORTEX_H
|
|
||||||
#define __STM32F4xx_HAL_CORTEX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CORTEX
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup CORTEX_Exported_Types Cortex Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
/** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition
|
|
||||||
* @brief MPU Region initialization structure
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t Enable; /*!< Specifies the status of the region.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Region_Enable */
|
|
||||||
uint8_t Number; /*!< Specifies the number of the region to protect.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Region_Number */
|
|
||||||
uint32_t BaseAddress; /*!< Specifies the base address of the region to protect. */
|
|
||||||
uint8_t Size; /*!< Specifies the size of the region to protect.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Region_Size */
|
|
||||||
uint8_t SubRegionDisable; /*!< Specifies the number of the subregion protection to disable.
|
|
||||||
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
|
|
||||||
uint8_t TypeExtField; /*!< Specifies the TEX field level.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */
|
|
||||||
uint8_t AccessPermission; /*!< Specifies the region access permission type.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */
|
|
||||||
uint8_t DisableExec; /*!< Specifies the instruction access status.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */
|
|
||||||
uint8_t IsShareable; /*!< Specifies the shareability status of the protected region.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */
|
|
||||||
uint8_t IsCacheable; /*!< Specifies the cacheable status of the region protected.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */
|
|
||||||
uint8_t IsBufferable; /*!< Specifies the bufferable status of the protected region.
|
|
||||||
This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */
|
|
||||||
}MPU_Region_InitTypeDef;
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* __MPU_PRESENT */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority
|
|
||||||
4 bits for subpriority */
|
|
||||||
#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority
|
|
||||||
3 bits for subpriority */
|
|
||||||
#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority
|
|
||||||
2 bits for subpriority */
|
|
||||||
#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority
|
|
||||||
1 bits for subpriority */
|
|
||||||
#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority
|
|
||||||
0 bits for subpriority */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U
|
|
||||||
#define SYSTICK_CLKSOURCE_HCLK 0x00000004U
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1)
|
|
||||||
/** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_HFNMI_PRIVDEF_NONE 0x00000000U
|
|
||||||
#define MPU_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk
|
|
||||||
#define MPU_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk
|
|
||||||
#define MPU_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_REGION_ENABLE ((uint8_t)0x01)
|
|
||||||
#define MPU_REGION_DISABLE ((uint8_t)0x00)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00)
|
|
||||||
#define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_ACCESS_SHAREABLE ((uint8_t)0x01)
|
|
||||||
#define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_ACCESS_CACHEABLE ((uint8_t)0x01)
|
|
||||||
#define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01)
|
|
||||||
#define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_TEX_LEVEL0 ((uint8_t)0x00)
|
|
||||||
#define MPU_TEX_LEVEL1 ((uint8_t)0x01)
|
|
||||||
#define MPU_TEX_LEVEL2 ((uint8_t)0x02)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_REGION_SIZE_32B ((uint8_t)0x04)
|
|
||||||
#define MPU_REGION_SIZE_64B ((uint8_t)0x05)
|
|
||||||
#define MPU_REGION_SIZE_128B ((uint8_t)0x06)
|
|
||||||
#define MPU_REGION_SIZE_256B ((uint8_t)0x07)
|
|
||||||
#define MPU_REGION_SIZE_512B ((uint8_t)0x08)
|
|
||||||
#define MPU_REGION_SIZE_1KB ((uint8_t)0x09)
|
|
||||||
#define MPU_REGION_SIZE_2KB ((uint8_t)0x0A)
|
|
||||||
#define MPU_REGION_SIZE_4KB ((uint8_t)0x0B)
|
|
||||||
#define MPU_REGION_SIZE_8KB ((uint8_t)0x0C)
|
|
||||||
#define MPU_REGION_SIZE_16KB ((uint8_t)0x0D)
|
|
||||||
#define MPU_REGION_SIZE_32KB ((uint8_t)0x0E)
|
|
||||||
#define MPU_REGION_SIZE_64KB ((uint8_t)0x0F)
|
|
||||||
#define MPU_REGION_SIZE_128KB ((uint8_t)0x10)
|
|
||||||
#define MPU_REGION_SIZE_256KB ((uint8_t)0x11)
|
|
||||||
#define MPU_REGION_SIZE_512KB ((uint8_t)0x12)
|
|
||||||
#define MPU_REGION_SIZE_1MB ((uint8_t)0x13)
|
|
||||||
#define MPU_REGION_SIZE_2MB ((uint8_t)0x14)
|
|
||||||
#define MPU_REGION_SIZE_4MB ((uint8_t)0x15)
|
|
||||||
#define MPU_REGION_SIZE_8MB ((uint8_t)0x16)
|
|
||||||
#define MPU_REGION_SIZE_16MB ((uint8_t)0x17)
|
|
||||||
#define MPU_REGION_SIZE_32MB ((uint8_t)0x18)
|
|
||||||
#define MPU_REGION_SIZE_64MB ((uint8_t)0x19)
|
|
||||||
#define MPU_REGION_SIZE_128MB ((uint8_t)0x1A)
|
|
||||||
#define MPU_REGION_SIZE_256MB ((uint8_t)0x1B)
|
|
||||||
#define MPU_REGION_SIZE_512MB ((uint8_t)0x1C)
|
|
||||||
#define MPU_REGION_SIZE_1GB ((uint8_t)0x1D)
|
|
||||||
#define MPU_REGION_SIZE_2GB ((uint8_t)0x1E)
|
|
||||||
#define MPU_REGION_SIZE_4GB ((uint8_t)0x1F)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_REGION_NO_ACCESS ((uint8_t)0x00)
|
|
||||||
#define MPU_REGION_PRIV_RW ((uint8_t)0x01)
|
|
||||||
#define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02)
|
|
||||||
#define MPU_REGION_FULL_ACCESS ((uint8_t)0x03)
|
|
||||||
#define MPU_REGION_PRIV_RO ((uint8_t)0x05)
|
|
||||||
#define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define MPU_REGION_NUMBER0 ((uint8_t)0x00)
|
|
||||||
#define MPU_REGION_NUMBER1 ((uint8_t)0x01)
|
|
||||||
#define MPU_REGION_NUMBER2 ((uint8_t)0x02)
|
|
||||||
#define MPU_REGION_NUMBER3 ((uint8_t)0x03)
|
|
||||||
#define MPU_REGION_NUMBER4 ((uint8_t)0x04)
|
|
||||||
#define MPU_REGION_NUMBER5 ((uint8_t)0x05)
|
|
||||||
#define MPU_REGION_NUMBER6 ((uint8_t)0x06)
|
|
||||||
#define MPU_REGION_NUMBER7 ((uint8_t)0x07)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* __MPU_PRESENT */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Exported Macros -----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup CORTEX_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CORTEX_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization and de-initialization functions *****************************/
|
|
||||||
void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
|
|
||||||
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
|
|
||||||
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
|
|
||||||
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
|
|
||||||
void HAL_NVIC_SystemReset(void);
|
|
||||||
uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CORTEX_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions ***********************************************/
|
|
||||||
uint32_t HAL_NVIC_GetPriorityGrouping(void);
|
|
||||||
void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
|
|
||||||
uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
|
|
||||||
void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
|
|
||||||
void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
|
|
||||||
uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
|
|
||||||
void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
|
|
||||||
void HAL_SYSTICK_IRQHandler(void);
|
|
||||||
void HAL_SYSTICK_Callback(void);
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
void HAL_MPU_Enable(uint32_t MPU_Control);
|
|
||||||
void HAL_MPU_Disable(void);
|
|
||||||
void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init);
|
|
||||||
#endif /* __MPU_PRESENT */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup CORTEX_Private_Macros CORTEX Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
|
|
||||||
((GROUP) == NVIC_PRIORITYGROUP_1) || \
|
|
||||||
((GROUP) == NVIC_PRIORITYGROUP_2) || \
|
|
||||||
((GROUP) == NVIC_PRIORITYGROUP_3) || \
|
|
||||||
((GROUP) == NVIC_PRIORITYGROUP_4))
|
|
||||||
|
|
||||||
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U)
|
|
||||||
|
|
||||||
#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U)
|
|
||||||
|
|
||||||
#define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= (IRQn_Type)0x00U)
|
|
||||||
|
|
||||||
#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
|
|
||||||
((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
#define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \
|
|
||||||
((STATE) == MPU_REGION_DISABLE))
|
|
||||||
|
|
||||||
#define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \
|
|
||||||
((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE))
|
|
||||||
|
|
||||||
#define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \
|
|
||||||
((STATE) == MPU_ACCESS_NOT_SHAREABLE))
|
|
||||||
|
|
||||||
#define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \
|
|
||||||
((STATE) == MPU_ACCESS_NOT_CACHEABLE))
|
|
||||||
|
|
||||||
#define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \
|
|
||||||
((STATE) == MPU_ACCESS_NOT_BUFFERABLE))
|
|
||||||
|
|
||||||
#define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \
|
|
||||||
((TYPE) == MPU_TEX_LEVEL1) || \
|
|
||||||
((TYPE) == MPU_TEX_LEVEL2))
|
|
||||||
|
|
||||||
#define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \
|
|
||||||
((TYPE) == MPU_REGION_PRIV_RW) || \
|
|
||||||
((TYPE) == MPU_REGION_PRIV_RW_URO) || \
|
|
||||||
((TYPE) == MPU_REGION_FULL_ACCESS) || \
|
|
||||||
((TYPE) == MPU_REGION_PRIV_RO) || \
|
|
||||||
((TYPE) == MPU_REGION_PRIV_RO_URO))
|
|
||||||
|
|
||||||
#define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER1) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER2) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER3) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER4) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER5) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER6) || \
|
|
||||||
((NUMBER) == MPU_REGION_NUMBER7))
|
|
||||||
|
|
||||||
#define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_64B) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_128B) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_256B) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_512B) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_1KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_2KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_4KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_8KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_16KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_32KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_64KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_128KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_256KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_512KB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_1MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_2MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_4MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_8MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_16MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_32MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_64MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_128MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_256MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_512MB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_1GB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_2GB) || \
|
|
||||||
((SIZE) == MPU_REGION_SIZE_4GB))
|
|
||||||
|
|
||||||
#define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF)
|
|
||||||
#endif /* __MPU_PRESENT */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_CORTEX_H */
|
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_def.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief This file contains HAL common defines, enumeration, macros and
|
|
||||||
* structures definitions.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_DEF
|
|
||||||
#define __STM32F4xx_HAL_DEF
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx.h"
|
|
||||||
#include "Legacy/stm32_hal_legacy.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL Status structures definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_OK = 0x00U,
|
|
||||||
HAL_ERROR = 0x01U,
|
|
||||||
HAL_BUSY = 0x02U,
|
|
||||||
HAL_TIMEOUT = 0x03U
|
|
||||||
} HAL_StatusTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL Lock structures definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_UNLOCKED = 0x00U,
|
|
||||||
HAL_LOCKED = 0x01U
|
|
||||||
} HAL_LockTypeDef;
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
#define HAL_MAX_DELAY 0xFFFFFFFFU
|
|
||||||
|
|
||||||
#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
|
|
||||||
#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
|
|
||||||
|
|
||||||
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
(__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
|
|
||||||
(__DMA_HANDLE__).Parent = (__HANDLE__); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define UNUSED(x) ((void)(x))
|
|
||||||
|
|
||||||
/** @brief Reset the Handle's State field.
|
|
||||||
* @param __HANDLE__: specifies the Peripheral Handle.
|
|
||||||
* @note This macro can be used for the following purpose:
|
|
||||||
* - When the Handle is declared as local variable; before passing it as parameter
|
|
||||||
* to HAL_PPP_Init() for the first time, it is mandatory to use this macro
|
|
||||||
* to set to 0 the Handle's "State" field.
|
|
||||||
* Otherwise, "State" field may have any random value and the first time the function
|
|
||||||
* HAL_PPP_Init() is called, the low level hardware initialization will be missed
|
|
||||||
* (i.e. HAL_PPP_MspInit() will not be executed).
|
|
||||||
* - When there is a need to reconfigure the low level hardware: instead of calling
|
|
||||||
* HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
|
|
||||||
* In this later function, when the Handle's "State" field is set to 0, it will execute the function
|
|
||||||
* HAL_PPP_MspInit() which will reconfigure the low level hardware.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
|
|
||||||
|
|
||||||
#if (USE_RTOS == 1U)
|
|
||||||
/* Reserved for future use */
|
|
||||||
#error "USE_RTOS should be 0 in the current HAL release"
|
|
||||||
#else
|
|
||||||
#define __HAL_LOCK(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
if((__HANDLE__)->Lock == HAL_LOCKED) \
|
|
||||||
{ \
|
|
||||||
return HAL_BUSY; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(__HANDLE__)->Lock = HAL_LOCKED; \
|
|
||||||
} \
|
|
||||||
}while (0U)
|
|
||||||
|
|
||||||
#define __HAL_UNLOCK(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
(__HANDLE__)->Lock = HAL_UNLOCKED; \
|
|
||||||
}while (0U)
|
|
||||||
#endif /* USE_RTOS */
|
|
||||||
|
|
||||||
#if defined ( __GNUC__ )
|
|
||||||
#ifndef __weak
|
|
||||||
#define __weak __attribute__((weak))
|
|
||||||
#endif /* __weak */
|
|
||||||
#ifndef __packed
|
|
||||||
#define __packed __attribute__((__packed__))
|
|
||||||
#endif /* __packed */
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
|
|
||||||
#if defined (__GNUC__) /* GNU Compiler */
|
|
||||||
#ifndef __ALIGN_END
|
|
||||||
#define __ALIGN_END __attribute__ ((aligned (4)))
|
|
||||||
#endif /* __ALIGN_END */
|
|
||||||
#ifndef __ALIGN_BEGIN
|
|
||||||
#define __ALIGN_BEGIN
|
|
||||||
#endif /* __ALIGN_BEGIN */
|
|
||||||
#else
|
|
||||||
#ifndef __ALIGN_END
|
|
||||||
#define __ALIGN_END
|
|
||||||
#endif /* __ALIGN_END */
|
|
||||||
#ifndef __ALIGN_BEGIN
|
|
||||||
#if defined (__CC_ARM) /* ARM Compiler */
|
|
||||||
#define __ALIGN_BEGIN __align(4)
|
|
||||||
#elif defined (__ICCARM__) /* IAR Compiler */
|
|
||||||
#define __ALIGN_BEGIN
|
|
||||||
#endif /* __CC_ARM */
|
|
||||||
#endif /* __ALIGN_BEGIN */
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief __RAM_FUNC definition
|
|
||||||
*/
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
/* ARM Compiler
|
|
||||||
------------
|
|
||||||
RAM functions are defined using the toolchain options.
|
|
||||||
Functions that are executed in RAM should reside in a separate source module.
|
|
||||||
Using the 'Options for File' dialog you can simply change the 'Code / Const'
|
|
||||||
area of a module to a memory space in physical RAM.
|
|
||||||
Available memory areas are declared in the 'Target' tab of the 'Options for Target'
|
|
||||||
dialog.
|
|
||||||
*/
|
|
||||||
#define __RAM_FUNC HAL_StatusTypeDef
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
/* ICCARM Compiler
|
|
||||||
---------------
|
|
||||||
RAM functions are defined using a specific toolchain keyword "__ramfunc".
|
|
||||||
*/
|
|
||||||
#define __RAM_FUNC __ramfunc HAL_StatusTypeDef
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
/* GNU Compiler
|
|
||||||
------------
|
|
||||||
RAM functions are defined using a specific toolchain attribute
|
|
||||||
"__attribute__((section(".RamFunc")))".
|
|
||||||
*/
|
|
||||||
#define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief __NOINLINE definition
|
|
||||||
*/
|
|
||||||
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
|
|
||||||
/* ARM & GNUCompiler
|
|
||||||
----------------
|
|
||||||
*/
|
|
||||||
#define __NOINLINE __attribute__ ( (noinline) )
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
/* ICCARM Compiler
|
|
||||||
---------------
|
|
||||||
*/
|
|
||||||
#define __NOINLINE _Pragma("optimize = no_inline")
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ___STM32F4xx_HAL_DEF */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,822 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_dma.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of DMA HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_DMA_H
|
|
||||||
#define __STM32F4xx_HAL_DMA_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup DMA
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Types DMA Exported Types
|
|
||||||
* @brief DMA Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DMA Configuration Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t Channel; /*!< Specifies the channel used for the specified stream.
|
|
||||||
This parameter can be a value of @ref DMA_Channel_selection */
|
|
||||||
|
|
||||||
uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
|
|
||||||
from memory to memory or from peripheral to memory.
|
|
||||||
This parameter can be a value of @ref DMA_Data_transfer_direction */
|
|
||||||
|
|
||||||
uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not.
|
|
||||||
This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
|
|
||||||
|
|
||||||
uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not.
|
|
||||||
This parameter can be a value of @ref DMA_Memory_incremented_mode */
|
|
||||||
|
|
||||||
uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width.
|
|
||||||
This parameter can be a value of @ref DMA_Peripheral_data_size */
|
|
||||||
|
|
||||||
uint32_t MemDataAlignment; /*!< Specifies the Memory data width.
|
|
||||||
This parameter can be a value of @ref DMA_Memory_data_size */
|
|
||||||
|
|
||||||
uint32_t Mode; /*!< Specifies the operation mode of the DMAy Streamx.
|
|
||||||
This parameter can be a value of @ref DMA_mode
|
|
||||||
@note The circular buffer mode cannot be used if the memory-to-memory
|
|
||||||
data transfer is configured on the selected Stream */
|
|
||||||
|
|
||||||
uint32_t Priority; /*!< Specifies the software priority for the DMAy Streamx.
|
|
||||||
This parameter can be a value of @ref DMA_Priority_level */
|
|
||||||
|
|
||||||
uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream.
|
|
||||||
This parameter can be a value of @ref DMA_FIFO_direct_mode
|
|
||||||
@note The Direct mode (FIFO mode disabled) cannot be used if the
|
|
||||||
memory-to-memory data transfer is configured on the selected stream */
|
|
||||||
|
|
||||||
uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level.
|
|
||||||
This parameter can be a value of @ref DMA_FIFO_threshold_level */
|
|
||||||
|
|
||||||
uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers.
|
|
||||||
It specifies the amount of data to be transferred in a single non interruptible
|
|
||||||
transaction.
|
|
||||||
This parameter can be a value of @ref DMA_Memory_burst
|
|
||||||
@note The burst mode is possible only if the address Increment mode is enabled. */
|
|
||||||
|
|
||||||
uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers.
|
|
||||||
It specifies the amount of data to be transferred in a single non interruptible
|
|
||||||
transaction.
|
|
||||||
This parameter can be a value of @ref DMA_Peripheral_burst
|
|
||||||
@note The burst mode is possible only if the address Increment mode is enabled. */
|
|
||||||
}DMA_InitTypeDef;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL DMA State structures definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */
|
|
||||||
HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */
|
|
||||||
HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */
|
|
||||||
HAL_DMA_STATE_TIMEOUT = 0x03U, /*!< DMA timeout state */
|
|
||||||
HAL_DMA_STATE_ERROR = 0x04U, /*!< DMA error state */
|
|
||||||
HAL_DMA_STATE_ABORT = 0x05U, /*!< DMA Abort state */
|
|
||||||
}HAL_DMA_StateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL DMA Error Code structure definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */
|
|
||||||
HAL_DMA_HALF_TRANSFER = 0x01U /*!< Half Transfer */
|
|
||||||
}HAL_DMA_LevelCompleteTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL DMA Error Code structure definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */
|
|
||||||
HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half Transfer */
|
|
||||||
HAL_DMA_XFER_M1CPLT_CB_ID = 0x02U, /*!< M1 Full Transfer */
|
|
||||||
HAL_DMA_XFER_M1HALFCPLT_CB_ID = 0x03U, /*!< M1 Half Transfer */
|
|
||||||
HAL_DMA_XFER_ERROR_CB_ID = 0x04U, /*!< Error */
|
|
||||||
HAL_DMA_XFER_ABORT_CB_ID = 0x05U, /*!< Abort */
|
|
||||||
HAL_DMA_XFER_ALL_CB_ID = 0x06U /*!< All */
|
|
||||||
}HAL_DMA_CallbackIDTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DMA handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct __DMA_HandleTypeDef
|
|
||||||
{
|
|
||||||
DMA_Stream_TypeDef *Instance; /*!< Register base address */
|
|
||||||
|
|
||||||
DMA_InitTypeDef Init; /*!< DMA communication parameters */
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /*!< DMA locking object */
|
|
||||||
|
|
||||||
__IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
|
|
||||||
|
|
||||||
void *Parent; /*!< Parent object state */
|
|
||||||
|
|
||||||
void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */
|
|
||||||
|
|
||||||
void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */
|
|
||||||
|
|
||||||
void (* XferM1CpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete Memory1 callback */
|
|
||||||
|
|
||||||
void (* XferM1HalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Half complete Memory1 callback */
|
|
||||||
|
|
||||||
void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */
|
|
||||||
|
|
||||||
void (* XferAbortCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Abort callback */
|
|
||||||
|
|
||||||
__IO uint32_t ErrorCode; /*!< DMA Error code */
|
|
||||||
|
|
||||||
uint32_t StreamBaseAddress; /*!< DMA Stream Base Address */
|
|
||||||
|
|
||||||
uint32_t StreamIndex; /*!< DMA Stream Index */
|
|
||||||
|
|
||||||
}DMA_HandleTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Constants DMA Exported Constants
|
|
||||||
* @brief DMA Exported constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Error_Code DMA Error Code
|
|
||||||
* @brief DMA Error Code
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define HAL_DMA_ERROR_NONE 0x00000000U /*!< No error */
|
|
||||||
#define HAL_DMA_ERROR_TE 0x00000001U /*!< Transfer error */
|
|
||||||
#define HAL_DMA_ERROR_FE 0x00000002U /*!< FIFO error */
|
|
||||||
#define HAL_DMA_ERROR_DME 0x00000004U /*!< Direct Mode error */
|
|
||||||
#define HAL_DMA_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */
|
|
||||||
#define HAL_DMA_ERROR_PARAM 0x00000040U /*!< Parameter error */
|
|
||||||
#define HAL_DMA_ERROR_NO_XFER 0x00000080U /*!< Abort requested with no Xfer ongoing */
|
|
||||||
#define HAL_DMA_ERROR_NOT_SUPPORTED 0x00000100U /*!< Not supported mode */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Channel_selection DMA Channel selection
|
|
||||||
* @brief DMA channel selection
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_CHANNEL_0 0x00000000U /*!< DMA Channel 0 */
|
|
||||||
#define DMA_CHANNEL_1 0x02000000U /*!< DMA Channel 1 */
|
|
||||||
#define DMA_CHANNEL_2 0x04000000U /*!< DMA Channel 2 */
|
|
||||||
#define DMA_CHANNEL_3 0x06000000U /*!< DMA Channel 3 */
|
|
||||||
#define DMA_CHANNEL_4 0x08000000U /*!< DMA Channel 4 */
|
|
||||||
#define DMA_CHANNEL_5 0x0A000000U /*!< DMA Channel 5 */
|
|
||||||
#define DMA_CHANNEL_6 0x0C000000U /*!< DMA Channel 6 */
|
|
||||||
#define DMA_CHANNEL_7 0x0E000000U /*!< DMA Channel 7 */
|
|
||||||
#if defined (DMA_SxCR_CHSEL_3)
|
|
||||||
#define DMA_CHANNEL_8 0x10000000U /*!< DMA Channel 8 */
|
|
||||||
#define DMA_CHANNEL_9 0x12000000U /*!< DMA Channel 9 */
|
|
||||||
#define DMA_CHANNEL_10 0x14000000U /*!< DMA Channel 10 */
|
|
||||||
#define DMA_CHANNEL_11 0x16000000U /*!< DMA Channel 11 */
|
|
||||||
#define DMA_CHANNEL_12 0x18000000U /*!< DMA Channel 12 */
|
|
||||||
#define DMA_CHANNEL_13 0x1A000000U /*!< DMA Channel 13 */
|
|
||||||
#define DMA_CHANNEL_14 0x1C000000U /*!< DMA Channel 14 */
|
|
||||||
#define DMA_CHANNEL_15 0x1E000000U /*!< DMA Channel 15 */
|
|
||||||
#endif /* DMA_SxCR_CHSEL_3 */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Data_transfer_direction DMA Data transfer direction
|
|
||||||
* @brief DMA data transfer direction
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */
|
|
||||||
#define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_SxCR_DIR_0) /*!< Memory to peripheral direction */
|
|
||||||
#define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_SxCR_DIR_1) /*!< Memory to memory direction */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode
|
|
||||||
* @brief DMA peripheral incremented mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_PINC_ENABLE ((uint32_t)DMA_SxCR_PINC) /*!< Peripheral increment mode enable */
|
|
||||||
#define DMA_PINC_DISABLE 0x00000000U /*!< Peripheral increment mode disable */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode
|
|
||||||
* @brief DMA memory incremented mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_MINC_ENABLE ((uint32_t)DMA_SxCR_MINC) /*!< Memory increment mode enable */
|
|
||||||
#define DMA_MINC_DISABLE 0x00000000U /*!< Memory increment mode disable */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Peripheral_data_size DMA Peripheral data size
|
|
||||||
* @brief DMA peripheral data size
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment: Byte */
|
|
||||||
#define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */
|
|
||||||
#define DMA_PDATAALIGN_WORD ((uint32_t)DMA_SxCR_PSIZE_1) /*!< Peripheral data alignment: Word */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Memory_data_size DMA Memory data size
|
|
||||||
* @brief DMA memory data size
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment: Byte */
|
|
||||||
#define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_MSIZE_0) /*!< Memory data alignment: HalfWord */
|
|
||||||
#define DMA_MDATAALIGN_WORD ((uint32_t)DMA_SxCR_MSIZE_1) /*!< Memory data alignment: Word */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_mode DMA mode
|
|
||||||
* @brief DMA mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_NORMAL 0x00000000U /*!< Normal mode */
|
|
||||||
#define DMA_CIRCULAR ((uint32_t)DMA_SxCR_CIRC) /*!< Circular mode */
|
|
||||||
#define DMA_PFCTRL ((uint32_t)DMA_SxCR_PFCTRL) /*!< Peripheral flow control mode */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Priority_level DMA Priority level
|
|
||||||
* @brief DMA priority levels
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_PRIORITY_LOW 0x00000000U /*!< Priority level: Low */
|
|
||||||
#define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_SxCR_PL_0) /*!< Priority level: Medium */
|
|
||||||
#define DMA_PRIORITY_HIGH ((uint32_t)DMA_SxCR_PL_1) /*!< Priority level: High */
|
|
||||||
#define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_SxCR_PL) /*!< Priority level: Very High */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_FIFO_direct_mode DMA FIFO direct mode
|
|
||||||
* @brief DMA FIFO direct mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */
|
|
||||||
#define DMA_FIFOMODE_ENABLE ((uint32_t)DMA_SxFCR_DMDIS) /*!< FIFO mode enable */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_FIFO_threshold_level DMA FIFO threshold level
|
|
||||||
* @brief DMA FIFO level
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_FIFO_THRESHOLD_1QUARTERFULL 0x00000000U /*!< FIFO threshold 1 quart full configuration */
|
|
||||||
#define DMA_FIFO_THRESHOLD_HALFFULL ((uint32_t)DMA_SxFCR_FTH_0) /*!< FIFO threshold half full configuration */
|
|
||||||
#define DMA_FIFO_THRESHOLD_3QUARTERSFULL ((uint32_t)DMA_SxFCR_FTH_1) /*!< FIFO threshold 3 quarts full configuration */
|
|
||||||
#define DMA_FIFO_THRESHOLD_FULL ((uint32_t)DMA_SxFCR_FTH) /*!< FIFO threshold full configuration */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Memory_burst DMA Memory burst
|
|
||||||
* @brief DMA memory burst
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_MBURST_SINGLE 0x00000000U
|
|
||||||
#define DMA_MBURST_INC4 ((uint32_t)DMA_SxCR_MBURST_0)
|
|
||||||
#define DMA_MBURST_INC8 ((uint32_t)DMA_SxCR_MBURST_1)
|
|
||||||
#define DMA_MBURST_INC16 ((uint32_t)DMA_SxCR_MBURST)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Peripheral_burst DMA Peripheral burst
|
|
||||||
* @brief DMA peripheral burst
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_PBURST_SINGLE 0x00000000U
|
|
||||||
#define DMA_PBURST_INC4 ((uint32_t)DMA_SxCR_PBURST_0)
|
|
||||||
#define DMA_PBURST_INC8 ((uint32_t)DMA_SxCR_PBURST_1)
|
|
||||||
#define DMA_PBURST_INC16 ((uint32_t)DMA_SxCR_PBURST)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions
|
|
||||||
* @brief DMA interrupts definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_IT_TC ((uint32_t)DMA_SxCR_TCIE)
|
|
||||||
#define DMA_IT_HT ((uint32_t)DMA_SxCR_HTIE)
|
|
||||||
#define DMA_IT_TE ((uint32_t)DMA_SxCR_TEIE)
|
|
||||||
#define DMA_IT_DME ((uint32_t)DMA_SxCR_DMEIE)
|
|
||||||
#define DMA_IT_FE 0x00000080U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_flag_definitions DMA flag definitions
|
|
||||||
* @brief DMA flag definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DMA_FLAG_FEIF0_4 0x00800001U
|
|
||||||
#define DMA_FLAG_DMEIF0_4 0x00800004U
|
|
||||||
#define DMA_FLAG_TEIF0_4 0x00000008U
|
|
||||||
#define DMA_FLAG_HTIF0_4 0x00000010U
|
|
||||||
#define DMA_FLAG_TCIF0_4 0x00000020U
|
|
||||||
#define DMA_FLAG_FEIF1_5 0x00000040U
|
|
||||||
#define DMA_FLAG_DMEIF1_5 0x00000100U
|
|
||||||
#define DMA_FLAG_TEIF1_5 0x00000200U
|
|
||||||
#define DMA_FLAG_HTIF1_5 0x00000400U
|
|
||||||
#define DMA_FLAG_TCIF1_5 0x00000800U
|
|
||||||
#define DMA_FLAG_FEIF2_6 0x00010000U
|
|
||||||
#define DMA_FLAG_DMEIF2_6 0x00040000U
|
|
||||||
#define DMA_FLAG_TEIF2_6 0x00080000U
|
|
||||||
#define DMA_FLAG_HTIF2_6 0x00100000U
|
|
||||||
#define DMA_FLAG_TCIF2_6 0x00200000U
|
|
||||||
#define DMA_FLAG_FEIF3_7 0x00400000U
|
|
||||||
#define DMA_FLAG_DMEIF3_7 0x01000000U
|
|
||||||
#define DMA_FLAG_TEIF3_7 0x02000000U
|
|
||||||
#define DMA_FLAG_HTIF3_7 0x04000000U
|
|
||||||
#define DMA_FLAG_TCIF3_7 0x08000000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @brief Reset DMA handle state
|
|
||||||
* @param __HANDLE__: specifies the DMA handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream FIFO filled level.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The FIFO filling state.
|
|
||||||
* - DMA_FIFOStatus_Less1QuarterFull: when FIFO is less than 1 quarter-full
|
|
||||||
* and not empty.
|
|
||||||
* - DMA_FIFOStatus_1QuarterFull: if more than 1 quarter-full.
|
|
||||||
* - DMA_FIFOStatus_HalfFull: if more than 1 half-full.
|
|
||||||
* - DMA_FIFOStatus_3QuartersFull: if more than 3 quarters-full.
|
|
||||||
* - DMA_FIFOStatus_Empty: when FIFO is empty
|
|
||||||
* - DMA_FIFOStatus_Full: when FIFO is full
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_FS(__HANDLE__) (((__HANDLE__)->Instance->FCR & (DMA_SxFCR_FS)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the specified DMA Stream.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA_SxCR_EN)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the specified DMA Stream.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~DMA_SxCR_EN)
|
|
||||||
|
|
||||||
/* Interrupt & Flag management */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream transfer complete flag.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The specified transfer complete flag index.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TCIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TCIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TCIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TCIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TCIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TCIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TCIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TCIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TCIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TCIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TCIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TCIF2_6 :\
|
|
||||||
DMA_FLAG_TCIF3_7)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream half transfer complete flag.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The specified half transfer complete flag index.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_HTIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_HTIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_HTIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_HTIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_HTIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_HTIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_HTIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_HTIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_HTIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_HTIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_HTIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_HTIF2_6 :\
|
|
||||||
DMA_FLAG_HTIF3_7)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream transfer error flag.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The specified transfer error flag index.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TEIF2_6 :\
|
|
||||||
DMA_FLAG_TEIF3_7)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream FIFO error flag.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The specified FIFO error flag index.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_FE_FLAG_INDEX(__HANDLE__)\
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_FEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_FEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_FEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_FEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_FEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_FEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_FEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_FEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_FEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_FEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_FEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_FEIF2_6 :\
|
|
||||||
DMA_FLAG_FEIF3_7)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the current DMA Stream direct mode error flag.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @retval The specified direct mode error flag index.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_DME_FLAG_INDEX(__HANDLE__)\
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_DMEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_DMEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_DMEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_DMEIF0_4 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_DMEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_DMEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_DMEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_DMEIF1_5 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_DMEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_DMEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_DMEIF2_6 :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_DMEIF2_6 :\
|
|
||||||
DMA_FLAG_DMEIF3_7)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the DMA Stream pending flags.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __FLAG__: Get the specified flag.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag.
|
|
||||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag.
|
|
||||||
* @arg DMA_FLAG_TEIFx: Transfer error flag.
|
|
||||||
* @arg DMA_FLAG_DMEIFx: Direct mode error flag.
|
|
||||||
* @arg DMA_FLAG_FEIFx: FIFO error flag.
|
|
||||||
* Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
|
|
||||||
* @retval The state of FLAG (SET or RESET).
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HISR & (__FLAG__)) :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LISR & (__FLAG__)) :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HISR & (__FLAG__)) : (DMA1->LISR & (__FLAG__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear the DMA Stream pending flags.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __FLAG__: specifies the flag to clear.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag.
|
|
||||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag.
|
|
||||||
* @arg DMA_FLAG_TEIFx: Transfer error flag.
|
|
||||||
* @arg DMA_FLAG_DMEIFx: Direct mode error flag.
|
|
||||||
* @arg DMA_FLAG_FEIFx: FIFO error flag.
|
|
||||||
* Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
|
|
||||||
(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HIFCR = (__FLAG__)) :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LIFCR = (__FLAG__)) :\
|
|
||||||
((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HIFCR = (__FLAG__)) : (DMA1->LIFCR = (__FLAG__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the specified DMA Stream interrupts.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg DMA_IT_TC: Transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_HT: Half transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_TE: Transfer error interrupt mask.
|
|
||||||
* @arg DMA_IT_FE: FIFO error interrupt mask.
|
|
||||||
* @arg DMA_IT_DME: Direct mode error interrupt.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
|
|
||||||
((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR |= (__INTERRUPT__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the specified DMA Stream interrupts.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg DMA_IT_TC: Transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_HT: Half transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_TE: Transfer error interrupt mask.
|
|
||||||
* @arg DMA_IT_FE: FIFO error interrupt mask.
|
|
||||||
* @arg DMA_IT_DME: Direct mode error interrupt.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
|
|
||||||
((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR &= ~(__INTERRUPT__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether the specified DMA Stream interrupt is enabled or disabled.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __INTERRUPT__: specifies the DMA interrupt source to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg DMA_IT_TC: Transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_HT: Half transfer complete interrupt mask.
|
|
||||||
* @arg DMA_IT_TE: Transfer error interrupt mask.
|
|
||||||
* @arg DMA_IT_FE: FIFO error interrupt mask.
|
|
||||||
* @arg DMA_IT_DME: Direct mode error interrupt.
|
|
||||||
* @retval The state of DMA_IT.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
|
|
||||||
((__HANDLE__)->Instance->CR & (__INTERRUPT__)) : \
|
|
||||||
((__HANDLE__)->Instance->FCR & (__INTERRUPT__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Writes the number of data units to be transferred on the DMA Stream.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
* @param __COUNTER__: Number of data units to be transferred (from 0 to 65535)
|
|
||||||
* Number of data items depends only on the Peripheral data format.
|
|
||||||
*
|
|
||||||
* @note If Peripheral data format is Bytes: number of data units is equal
|
|
||||||
* to total number of bytes to be transferred.
|
|
||||||
*
|
|
||||||
* @note If Peripheral data format is Half-Word: number of data units is
|
|
||||||
* equal to total number of bytes to be transferred / 2.
|
|
||||||
*
|
|
||||||
* @note If Peripheral data format is Word: number of data units is equal
|
|
||||||
* to total number of bytes to be transferred / 4.
|
|
||||||
*
|
|
||||||
* @retval The number of remaining data units in the current DMAy Streamx transfer.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->NDTR = (uint16_t)(__COUNTER__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the number of remaining data units in the current DMAy Streamx transfer.
|
|
||||||
* @param __HANDLE__: DMA handle
|
|
||||||
*
|
|
||||||
* @retval The number of remaining data units in the current DMA Stream transfer.
|
|
||||||
*/
|
|
||||||
#define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->NDTR)
|
|
||||||
|
|
||||||
|
|
||||||
/* Include DMA HAL Extension module */
|
|
||||||
#include "stm32f4xx_hal_dma_ex.h"
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Functions DMA Exported Functions
|
|
||||||
* @brief DMA Exported functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions
|
|
||||||
* @brief Initialization and de-initialization functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Functions_Group2 I/O operation functions
|
|
||||||
* @brief I/O operation functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout);
|
|
||||||
void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_CleanCallbacks(DMA_HandleTypeDef *hdma);
|
|
||||||
HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)(DMA_HandleTypeDef *_hdma));
|
|
||||||
HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMA_Exported_Functions_Group3 Peripheral State functions
|
|
||||||
* @brief Peripheral State functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma);
|
|
||||||
uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private Constants -------------------------------------------------------------*/
|
|
||||||
/** @defgroup DMA_Private_Constants DMA Private Constants
|
|
||||||
* @brief DMA private defines and constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup DMA_Private_Macros DMA Private Macros
|
|
||||||
* @brief DMA private macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#if defined (DMA_SxCR_CHSEL_3)
|
|
||||||
#define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_1) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_2) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_3) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_4) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_5) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_6) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_7) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_8) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_9) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_10)|| \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_11)|| \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_12)|| \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_13)|| \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_14)|| \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_15))
|
|
||||||
#else
|
|
||||||
#define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_1) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_2) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_3) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_4) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_5) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_6) || \
|
|
||||||
((CHANNEL) == DMA_CHANNEL_7))
|
|
||||||
#endif /* DMA_SxCR_CHSEL_3 */
|
|
||||||
|
|
||||||
#define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \
|
|
||||||
((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
|
|
||||||
((DIRECTION) == DMA_MEMORY_TO_MEMORY))
|
|
||||||
|
|
||||||
#define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x01U) && ((SIZE) < 0x10000U))
|
|
||||||
|
|
||||||
#define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \
|
|
||||||
((STATE) == DMA_PINC_DISABLE))
|
|
||||||
|
|
||||||
#define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \
|
|
||||||
((STATE) == DMA_MINC_DISABLE))
|
|
||||||
|
|
||||||
#define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \
|
|
||||||
((SIZE) == DMA_PDATAALIGN_HALFWORD) || \
|
|
||||||
((SIZE) == DMA_PDATAALIGN_WORD))
|
|
||||||
|
|
||||||
#define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \
|
|
||||||
((SIZE) == DMA_MDATAALIGN_HALFWORD) || \
|
|
||||||
((SIZE) == DMA_MDATAALIGN_WORD ))
|
|
||||||
|
|
||||||
#define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \
|
|
||||||
((MODE) == DMA_CIRCULAR) || \
|
|
||||||
((MODE) == DMA_PFCTRL))
|
|
||||||
|
|
||||||
#define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \
|
|
||||||
((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
|
|
||||||
((PRIORITY) == DMA_PRIORITY_HIGH) || \
|
|
||||||
((PRIORITY) == DMA_PRIORITY_VERY_HIGH))
|
|
||||||
|
|
||||||
#define IS_DMA_FIFO_MODE_STATE(STATE) (((STATE) == DMA_FIFOMODE_DISABLE ) || \
|
|
||||||
((STATE) == DMA_FIFOMODE_ENABLE))
|
|
||||||
|
|
||||||
#define IS_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == DMA_FIFO_THRESHOLD_1QUARTERFULL ) || \
|
|
||||||
((THRESHOLD) == DMA_FIFO_THRESHOLD_HALFFULL) || \
|
|
||||||
((THRESHOLD) == DMA_FIFO_THRESHOLD_3QUARTERSFULL) || \
|
|
||||||
((THRESHOLD) == DMA_FIFO_THRESHOLD_FULL))
|
|
||||||
|
|
||||||
#define IS_DMA_MEMORY_BURST(BURST) (((BURST) == DMA_MBURST_SINGLE) || \
|
|
||||||
((BURST) == DMA_MBURST_INC4) || \
|
|
||||||
((BURST) == DMA_MBURST_INC8) || \
|
|
||||||
((BURST) == DMA_MBURST_INC16))
|
|
||||||
|
|
||||||
#define IS_DMA_PERIPHERAL_BURST(BURST) (((BURST) == DMA_PBURST_SINGLE) || \
|
|
||||||
((BURST) == DMA_PBURST_INC4) || \
|
|
||||||
((BURST) == DMA_PBURST_INC8) || \
|
|
||||||
((BURST) == DMA_PBURST_INC16))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup DMA_Private_Functions DMA Private Functions
|
|
||||||
* @brief DMA private functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_DMA_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_dma_ex.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of DMA HAL extension module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_DMA_EX_H
|
|
||||||
#define __STM32F4xx_HAL_DMA_EX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup DMAEx
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup DMAEx_Exported_Types DMAEx Exported Types
|
|
||||||
* @brief DMAEx Exported types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL DMA Memory definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
MEMORY0 = 0x00U, /*!< Memory 0 */
|
|
||||||
MEMORY1 = 0x01U /*!< Memory 1 */
|
|
||||||
}HAL_DMA_MemoryTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions
|
|
||||||
* @brief DMAEx Exported functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions
|
|
||||||
* @brief Extended features functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* IO operation functions *******************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
|
|
||||||
HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
|
|
||||||
HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup DMAEx_Private_Functions DMAEx Private Functions
|
|
||||||
* @brief DMAEx Private functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__STM32F4xx_HAL_DMA_EX_H*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,446 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_flash.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of FLASH HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_FLASH_H
|
|
||||||
#define __STM32F4xx_HAL_FLASH_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup FLASH
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Exported_Types FLASH Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief FLASH Procedure structure definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
FLASH_PROC_NONE = 0U,
|
|
||||||
FLASH_PROC_SECTERASE,
|
|
||||||
FLASH_PROC_MASSERASE,
|
|
||||||
FLASH_PROC_PROGRAM
|
|
||||||
} FLASH_ProcedureTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief FLASH handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/
|
|
||||||
|
|
||||||
__IO uint32_t NbSectorsToErase; /*Internal variable to save the remaining sectors to erase in IT context*/
|
|
||||||
|
|
||||||
__IO uint8_t VoltageForErase; /*Internal variable to provide voltage range selected by user in IT context*/
|
|
||||||
|
|
||||||
__IO uint32_t Sector; /*Internal variable to define the current sector which is erasing*/
|
|
||||||
|
|
||||||
__IO uint32_t Bank; /*Internal variable to save current bank selected during mass erase*/
|
|
||||||
|
|
||||||
__IO uint32_t Address; /*Internal variable to save address selected for program*/
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /* FLASH locking object */
|
|
||||||
|
|
||||||
__IO uint32_t ErrorCode; /* FLASH error code */
|
|
||||||
|
|
||||||
}FLASH_ProcessTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Exported_Constants FLASH Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @defgroup FLASH_Error_Code FLASH Error Code
|
|
||||||
* @brief FLASH Error Code
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define HAL_FLASH_ERROR_NONE 0x00000000U /*!< No error */
|
|
||||||
#define HAL_FLASH_ERROR_RD 0x00000001U /*!< Read Protection error */
|
|
||||||
#define HAL_FLASH_ERROR_PGS 0x00000002U /*!< Programming Sequence error */
|
|
||||||
#define HAL_FLASH_ERROR_PGP 0x00000004U /*!< Programming Parallelism error */
|
|
||||||
#define HAL_FLASH_ERROR_PGA 0x00000008U /*!< Programming Alignment error */
|
|
||||||
#define HAL_FLASH_ERROR_WRP 0x00000010U /*!< Write protection error */
|
|
||||||
#define HAL_FLASH_ERROR_OPERATION 0x00000020U /*!< Operation Error */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_Type_Program FLASH Type Program
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define FLASH_TYPEPROGRAM_BYTE 0x00000000U /*!< Program byte (8-bit) at a specified address */
|
|
||||||
#define FLASH_TYPEPROGRAM_HALFWORD 0x00000001U /*!< Program a half-word (16-bit) at a specified address */
|
|
||||||
#define FLASH_TYPEPROGRAM_WORD 0x00000002U /*!< Program a word (32-bit) at a specified address */
|
|
||||||
#define FLASH_TYPEPROGRAM_DOUBLEWORD 0x00000003U /*!< Program a double word (64-bit) at a specified address */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_Flag_definition FLASH Flag definition
|
|
||||||
* @brief Flag definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */
|
|
||||||
#define FLASH_FLAG_OPERR FLASH_SR_SOP /*!< FLASH operation Error flag */
|
|
||||||
#define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */
|
|
||||||
#define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */
|
|
||||||
#define FLASH_FLAG_PGPERR FLASH_SR_PGPERR /*!< FLASH Programming Parallelism error flag */
|
|
||||||
#define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< FLASH Programming Sequence error flag */
|
|
||||||
#if defined(FLASH_SR_RDERR)
|
|
||||||
#define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< Read Protection error flag (PCROP) */
|
|
||||||
#endif /* FLASH_SR_RDERR */
|
|
||||||
#define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition
|
|
||||||
* @brief FLASH Interrupt definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
|
|
||||||
#define FLASH_IT_ERR 0x02000000U /*!< Error Interrupt source */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define FLASH_PSIZE_BYTE 0x00000000U
|
|
||||||
#define FLASH_PSIZE_HALF_WORD 0x00000100U
|
|
||||||
#define FLASH_PSIZE_WORD 0x00000200U
|
|
||||||
#define FLASH_PSIZE_DOUBLE_WORD 0x00000300U
|
|
||||||
#define CR_PSIZE_MASK 0xFFFFFCFFU
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_Keys FLASH Keys
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RDP_KEY ((uint16_t)0x00A5)
|
|
||||||
#define FLASH_KEY1 0x45670123U
|
|
||||||
#define FLASH_KEY2 0xCDEF89ABU
|
|
||||||
#define FLASH_OPT_KEY1 0x08192A3BU
|
|
||||||
#define FLASH_OPT_KEY2 0x4C5D6E7FU
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Exported_Macros FLASH Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @brief Set the FLASH Latency.
|
|
||||||
* @param __LATENCY__: FLASH Latency
|
|
||||||
* The value of this parameter depend on device used within the same series
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_SET_LATENCY(__LATENCY__) (*(__IO uint8_t *)ACR_BYTE0_ADDRESS = (uint8_t)(__LATENCY__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the FLASH Latency.
|
|
||||||
* @retval FLASH Latency
|
|
||||||
* The value of this parameter depend on device used within the same series
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the FLASH prefetch buffer.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the FLASH prefetch buffer.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the FLASH instruction cache.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the FLASH instruction cache.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the FLASH data cache.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the FLASH data cache.
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resets the FLASH instruction Cache.
|
|
||||||
* @note This function must be used only when the Instruction Cache is disabled.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_INSTRUCTION_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_ICRST; \
|
|
||||||
FLASH->ACR &= ~FLASH_ACR_ICRST; \
|
|
||||||
}while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resets the FLASH data Cache.
|
|
||||||
* @note This function must be used only when the data Cache is disabled.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_DATA_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_DCRST; \
|
|
||||||
FLASH->ACR &= ~FLASH_ACR_DCRST; \
|
|
||||||
}while(0U)
|
|
||||||
/**
|
|
||||||
* @brief Enable the specified FLASH interrupt.
|
|
||||||
* @param __INTERRUPT__ : FLASH interrupt
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
|
|
||||||
* @arg FLASH_IT_ERR: Error Interrupt
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the specified FLASH interrupt.
|
|
||||||
* @param __INTERRUPT__ : FLASH interrupt
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
|
|
||||||
* @arg FLASH_IT_ERR: Error Interrupt
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the specified FLASH flag status.
|
|
||||||
* @param __FLAG__: specifies the FLASH flags to check.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag
|
|
||||||
* @arg FLASH_FLAG_OPERR : FLASH operation Error flag
|
|
||||||
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
|
|
||||||
* @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag
|
|
||||||
* @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag
|
|
||||||
* @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag
|
|
||||||
* @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (*)
|
|
||||||
* @arg FLASH_FLAG_BSY : FLASH Busy flag
|
|
||||||
* (*) FLASH_FLAG_RDERR is not available for STM32F405xx/407xx/415xx/417xx devices
|
|
||||||
* @retval The new state of __FLAG__ (SET or RESET).
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear the specified FLASH flags.
|
|
||||||
* @param __FLAG__: specifies the FLASH flags to clear.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag
|
|
||||||
* @arg FLASH_FLAG_OPERR : FLASH operation Error flag
|
|
||||||
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
|
|
||||||
* @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag
|
|
||||||
* @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag
|
|
||||||
* @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag
|
|
||||||
* @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (*)
|
|
||||||
* (*) FLASH_FLAG_RDERR is not available for STM32F405xx/407xx/415xx/417xx devices
|
|
||||||
* @retval none
|
|
||||||
*/
|
|
||||||
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include FLASH HAL Extension module */
|
|
||||||
#include "stm32f4xx_hal_flash_ex.h"
|
|
||||||
#include "stm32f4xx_hal_flash_ramfunc.h"
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup FLASH_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @addtogroup FLASH_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Program operation functions ***********************************************/
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
|
|
||||||
/* FLASH IRQ handler method */
|
|
||||||
void HAL_FLASH_IRQHandler(void);
|
|
||||||
/* Callbacks in non blocking modes */
|
|
||||||
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
|
|
||||||
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup FLASH_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions **********************************************/
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_Unlock(void);
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_Lock(void);
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
|
|
||||||
/* Option bytes control */
|
|
||||||
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup FLASH_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral State functions ************************************************/
|
|
||||||
uint32_t HAL_FLASH_GetError(void);
|
|
||||||
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Private_Variables FLASH Private Variables
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Private_Constants FLASH Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ACR register byte 0 (Bits[7:0]) base address
|
|
||||||
*/
|
|
||||||
#define ACR_BYTE0_ADDRESS 0x40023C00U
|
|
||||||
/**
|
|
||||||
* @brief OPTCR register byte 0 (Bits[7:0]) base address
|
|
||||||
*/
|
|
||||||
#define OPTCR_BYTE0_ADDRESS 0x40023C14U
|
|
||||||
/**
|
|
||||||
* @brief OPTCR register byte 1 (Bits[15:8]) base address
|
|
||||||
*/
|
|
||||||
#define OPTCR_BYTE1_ADDRESS 0x40023C15U
|
|
||||||
/**
|
|
||||||
* @brief OPTCR register byte 2 (Bits[23:16]) base address
|
|
||||||
*/
|
|
||||||
#define OPTCR_BYTE2_ADDRESS 0x40023C16U
|
|
||||||
/**
|
|
||||||
* @brief OPTCR register byte 3 (Bits[31:24]) base address
|
|
||||||
*/
|
|
||||||
#define OPTCR_BYTE3_ADDRESS 0x40023C17U
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Private_Macros FLASH Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup FLASH_IS_FLASH_Definitions FLASH Private macros to check input parameters
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \
|
|
||||||
((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
|
|
||||||
((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
|
|
||||||
((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup FLASH_Private_Functions FLASH Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_FLASH_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,97 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_flash_ramfunc.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of FLASH RAMFUNC driver.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_FLASH_RAMFUNC_H
|
|
||||||
#define __STM32F4xx_FLASH_RAMFUNC_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
|
|
||||||
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup FLASH_RAMFUNC
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup FLASH_RAMFUNC_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
__RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void);
|
|
||||||
__RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void);
|
|
||||||
__RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void);
|
|
||||||
__RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_FLASH_RAMFUNC_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,327 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_gpio.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of GPIO HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_GPIO_H
|
|
||||||
#define __STM32F4xx_HAL_GPIO_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup GPIO
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup GPIO_Exported_Types GPIO Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GPIO Init structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
|
|
||||||
This parameter can be any value of @ref GPIO_pins_define */
|
|
||||||
|
|
||||||
uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
|
|
||||||
This parameter can be a value of @ref GPIO_mode_define */
|
|
||||||
|
|
||||||
uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins.
|
|
||||||
This parameter can be a value of @ref GPIO_pull_define */
|
|
||||||
|
|
||||||
uint32_t Speed; /*!< Specifies the speed for the selected pins.
|
|
||||||
This parameter can be a value of @ref GPIO_speed_define */
|
|
||||||
|
|
||||||
uint32_t Alternate; /*!< Peripheral to be connected to the selected pins.
|
|
||||||
This parameter can be a value of @ref GPIO_Alternate_function_selection */
|
|
||||||
}GPIO_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GPIO Bit SET and Bit RESET enumeration
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GPIO_PIN_RESET = 0,
|
|
||||||
GPIO_PIN_SET
|
|
||||||
}GPIO_PinState;
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup GPIO_Exported_Constants GPIO Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup GPIO_pins_define GPIO pins define
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
|
|
||||||
#define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */
|
|
||||||
#define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */
|
|
||||||
#define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */
|
|
||||||
#define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */
|
|
||||||
#define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */
|
|
||||||
#define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */
|
|
||||||
#define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */
|
|
||||||
#define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */
|
|
||||||
#define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */
|
|
||||||
#define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */
|
|
||||||
#define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */
|
|
||||||
#define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */
|
|
||||||
#define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */
|
|
||||||
#define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */
|
|
||||||
#define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */
|
|
||||||
#define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */
|
|
||||||
|
|
||||||
#define GPIO_PIN_MASK 0x0000FFFFU /* PIN mask for assert test */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup GPIO_mode_define GPIO mode define
|
|
||||||
* @brief GPIO Configuration Mode
|
|
||||||
* Elements values convention: 0xX0yz00YZ
|
|
||||||
* - X : GPIO mode or EXTI Mode
|
|
||||||
* - y : External IT or Event trigger detection
|
|
||||||
* - z : IO configuration on External IT or Event
|
|
||||||
* - Y : Output type (Push Pull or Open Drain)
|
|
||||||
* - Z : IO Direction mode (Input, Output, Alternate or Analog)
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define GPIO_MODE_INPUT 0x00000000U /*!< Input Floating Mode */
|
|
||||||
#define GPIO_MODE_OUTPUT_PP 0x00000001U /*!< Output Push Pull Mode */
|
|
||||||
#define GPIO_MODE_OUTPUT_OD 0x00000011U /*!< Output Open Drain Mode */
|
|
||||||
#define GPIO_MODE_AF_PP 0x00000002U /*!< Alternate Function Push Pull Mode */
|
|
||||||
#define GPIO_MODE_AF_OD 0x00000012U /*!< Alternate Function Open Drain Mode */
|
|
||||||
|
|
||||||
#define GPIO_MODE_ANALOG 0x00000003U /*!< Analog Mode */
|
|
||||||
|
|
||||||
#define GPIO_MODE_IT_RISING 0x10110000U /*!< External Interrupt Mode with Rising edge trigger detection */
|
|
||||||
#define GPIO_MODE_IT_FALLING 0x10210000U /*!< External Interrupt Mode with Falling edge trigger detection */
|
|
||||||
#define GPIO_MODE_IT_RISING_FALLING 0x10310000U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
|
|
||||||
|
|
||||||
#define GPIO_MODE_EVT_RISING 0x10120000U /*!< External Event Mode with Rising edge trigger detection */
|
|
||||||
#define GPIO_MODE_EVT_FALLING 0x10220000U /*!< External Event Mode with Falling edge trigger detection */
|
|
||||||
#define GPIO_MODE_EVT_RISING_FALLING 0x10320000U /*!< External Event Mode with Rising/Falling edge trigger detection */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup GPIO_speed_define GPIO speed define
|
|
||||||
* @brief GPIO Output Maximum frequency
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define GPIO_SPEED_FREQ_LOW 0x00000000U /*!< IO works at 2 MHz, please refer to the product datasheet */
|
|
||||||
#define GPIO_SPEED_FREQ_MEDIUM 0x00000001U /*!< range 12,5 MHz to 50 MHz, please refer to the product datasheet */
|
|
||||||
#define GPIO_SPEED_FREQ_HIGH 0x00000002U /*!< range 25 MHz to 100 MHz, please refer to the product datasheet */
|
|
||||||
#define GPIO_SPEED_FREQ_VERY_HIGH 0x00000003U /*!< range 50 MHz to 200 MHz, please refer to the product datasheet */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup GPIO_pull_define GPIO pull define
|
|
||||||
* @brief GPIO Pull-Up or Pull-Down Activation
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define GPIO_NOPULL 0x00000000U /*!< No Pull-up or Pull-down activation */
|
|
||||||
#define GPIO_PULLUP 0x00000001U /*!< Pull-up activation */
|
|
||||||
#define GPIO_PULLDOWN 0x00000002U /*!< Pull-down activation */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup GPIO_Exported_Macros GPIO Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks whether the specified EXTI line flag is set or not.
|
|
||||||
* @param __EXTI_LINE__: specifies the EXTI line flag to check.
|
|
||||||
* This parameter can be GPIO_PIN_x where x can be(0..15)
|
|
||||||
* @retval The new state of __EXTI_LINE__ (SET or RESET).
|
|
||||||
*/
|
|
||||||
#define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR & (__EXTI_LINE__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clears the EXTI's line pending flags.
|
|
||||||
* @param __EXTI_LINE__: specifies the EXTI lines flags to clear.
|
|
||||||
* This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR = (__EXTI_LINE__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks whether the specified EXTI line is asserted or not.
|
|
||||||
* @param __EXTI_LINE__: specifies the EXTI line to check.
|
|
||||||
* This parameter can be GPIO_PIN_x where x can be(0..15)
|
|
||||||
* @retval The new state of __EXTI_LINE__ (SET or RESET).
|
|
||||||
*/
|
|
||||||
#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR & (__EXTI_LINE__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clears the EXTI's line pending bits.
|
|
||||||
* @param __EXTI_LINE__: specifies the EXTI lines to clear.
|
|
||||||
* This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR = (__EXTI_LINE__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Generates a Software interrupt on selected EXTI line.
|
|
||||||
* @param __EXTI_LINE__: specifies the EXTI line to check.
|
|
||||||
* This parameter can be GPIO_PIN_x where x can be(0..15)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER |= (__EXTI_LINE__))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include GPIO HAL Extension module */
|
|
||||||
#include "stm32f4xx_hal_gpio_ex.h"
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup GPIO_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup GPIO_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization and de-initialization functions *****************************/
|
|
||||||
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init);
|
|
||||||
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup GPIO_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* IO operation functions *****************************************************/
|
|
||||||
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
|
|
||||||
void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
|
|
||||||
void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
|
|
||||||
HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
|
|
||||||
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin);
|
|
||||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup GPIO_Private_Constants GPIO Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup GPIO_Private_Macros GPIO Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET))
|
|
||||||
#define IS_GPIO_PIN(PIN) ((((PIN) & GPIO_PIN_MASK ) != 0x00U) && (((PIN) & ~GPIO_PIN_MASK) == 0x00U))
|
|
||||||
#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\
|
|
||||||
((MODE) == GPIO_MODE_OUTPUT_PP) ||\
|
|
||||||
((MODE) == GPIO_MODE_OUTPUT_OD) ||\
|
|
||||||
((MODE) == GPIO_MODE_AF_PP) ||\
|
|
||||||
((MODE) == GPIO_MODE_AF_OD) ||\
|
|
||||||
((MODE) == GPIO_MODE_IT_RISING) ||\
|
|
||||||
((MODE) == GPIO_MODE_IT_FALLING) ||\
|
|
||||||
((MODE) == GPIO_MODE_IT_RISING_FALLING) ||\
|
|
||||||
((MODE) == GPIO_MODE_EVT_RISING) ||\
|
|
||||||
((MODE) == GPIO_MODE_EVT_FALLING) ||\
|
|
||||||
((MODE) == GPIO_MODE_EVT_RISING_FALLING) ||\
|
|
||||||
((MODE) == GPIO_MODE_ANALOG))
|
|
||||||
#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_SPEED_FREQ_LOW) || ((SPEED) == GPIO_SPEED_FREQ_MEDIUM) || \
|
|
||||||
((SPEED) == GPIO_SPEED_FREQ_HIGH) || ((SPEED) == GPIO_SPEED_FREQ_VERY_HIGH))
|
|
||||||
#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \
|
|
||||||
((PULL) == GPIO_PULLDOWN))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup GPIO_Private_Functions GPIO Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_GPIO_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,449 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_pwr.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of PWR HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_PWR_H
|
|
||||||
#define __STM32F4xx_HAL_PWR_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup PWR
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_Exported_Types PWR Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief PWR PVD configuration structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level.
|
|
||||||
This parameter can be a value of @ref PWR_PVD_detection_level */
|
|
||||||
|
|
||||||
uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
|
|
||||||
This parameter can be a value of @ref PWR_PVD_Mode */
|
|
||||||
}PWR_PVDTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup PWR_Exported_Constants PWR Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_WAKEUP_PIN1 0x00000100U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_PVD_detection_level PWR PVD detection level
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
|
|
||||||
#define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
|
|
||||||
#define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
|
|
||||||
#define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
|
|
||||||
#define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
|
|
||||||
#define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
|
|
||||||
#define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
|
|
||||||
#define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7/* External input analog voltage
|
|
||||||
(Compare internally to VREFINT) */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_PVD_Mode PWR PVD Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_PVD_MODE_NORMAL 0x00000000U /*!< basic mode is used */
|
|
||||||
#define PWR_PVD_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */
|
|
||||||
#define PWR_PVD_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */
|
|
||||||
#define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
|
|
||||||
#define PWR_PVD_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */
|
|
||||||
#define PWR_PVD_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */
|
|
||||||
#define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in SLEEP/STOP mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_MAINREGULATOR_ON 0x00000000U
|
|
||||||
#define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_SLEEPENTRY_WFI ((uint8_t)0x01)
|
|
||||||
#define PWR_SLEEPENTRY_WFE ((uint8_t)0x02)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_STOPENTRY_WFI ((uint8_t)0x01)
|
|
||||||
#define PWR_STOPENTRY_WFE ((uint8_t)0x02)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_Flag PWR Flag
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_FLAG_WU PWR_CSR_WUF
|
|
||||||
#define PWR_FLAG_SB PWR_CSR_SBF
|
|
||||||
#define PWR_FLAG_PVDO PWR_CSR_PVDO
|
|
||||||
#define PWR_FLAG_BRR PWR_CSR_BRR
|
|
||||||
#define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup PWR_Exported_Macro PWR Exported Macro
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Check PWR flag is set or not.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
|
|
||||||
* was received from the WKUP pin or from the RTC alarm (Alarm A
|
|
||||||
* or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
|
|
||||||
* An additional wakeup event is detected if the WKUP pin is enabled
|
|
||||||
* (by setting the EWUP bit) when the WKUP pin level is already high.
|
|
||||||
* @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
|
|
||||||
* resumed from StandBy mode.
|
|
||||||
* @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
|
|
||||||
* by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
|
|
||||||
* For this reason, this bit is equal to 0 after Standby or reset
|
|
||||||
* until the PVDE bit is set.
|
|
||||||
* @arg PWR_FLAG_BRR: Backup regulator ready flag. This bit is not reset
|
|
||||||
* when the device wakes up from Standby mode or by a system reset
|
|
||||||
* or power reset.
|
|
||||||
* @arg PWR_FLAG_VOSRDY: This flag indicates that the Regulator voltage
|
|
||||||
* scaling output selection is ready.
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
|
|
||||||
|
|
||||||
/** @brief Clear the PWR's pending flags.
|
|
||||||
* @param __FLAG__: specifies the flag to clear.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg PWR_FLAG_WU: Wake Up flag
|
|
||||||
* @arg PWR_FLAG_SB: StandBy flag
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the PVD Exti Line 16.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the PVD EXTI Line 16.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable event on PVD Exti Line 16.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable event on PVD Exti Line 16.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the PVD Extended Interrupt Rising Trigger.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the PVD Extended Interrupt Rising Trigger.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the PVD Extended Interrupt Falling Trigger.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the PVD Extended Interrupt Falling Trigger.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief PVD EXTI line configuration: set rising & falling edge trigger.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();\
|
|
||||||
__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();\
|
|
||||||
}while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the PVD Extended Interrupt Rising & Falling Trigger.
|
|
||||||
* This parameter can be:
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();\
|
|
||||||
__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();\
|
|
||||||
}while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief checks whether the specified PVD Exti interrupt flag is set or not.
|
|
||||||
* @retval EXTI PVD Line Status.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear the PVD Exti flag.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Generates a Software interrupt on PVD EXTI line.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include PWR HAL Extension module */
|
|
||||||
#include "stm32f4xx_hal_pwr_ex.h"
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup PWR_Exported_Functions PWR Exported Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization and de-initialization functions *****************************/
|
|
||||||
void HAL_PWR_DeInit(void);
|
|
||||||
void HAL_PWR_EnableBkUpAccess(void);
|
|
||||||
void HAL_PWR_DisableBkUpAccess(void);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions **********************************************/
|
|
||||||
/* PVD configuration */
|
|
||||||
void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
|
|
||||||
void HAL_PWR_EnablePVD(void);
|
|
||||||
void HAL_PWR_DisablePVD(void);
|
|
||||||
|
|
||||||
/* WakeUp pins configuration */
|
|
||||||
void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
|
|
||||||
void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
|
|
||||||
|
|
||||||
/* Low Power modes entry */
|
|
||||||
void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
|
|
||||||
void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
|
|
||||||
void HAL_PWR_EnterSTANDBYMode(void);
|
|
||||||
|
|
||||||
/* Power PVD IRQ Handler */
|
|
||||||
void HAL_PWR_PVD_IRQHandler(void);
|
|
||||||
void HAL_PWR_PVDCallback(void);
|
|
||||||
|
|
||||||
/* Cortex System Control functions *******************************************/
|
|
||||||
void HAL_PWR_EnableSleepOnExit(void);
|
|
||||||
void HAL_PWR_DisableSleepOnExit(void);
|
|
||||||
void HAL_PWR_EnableSEVOnPend(void);
|
|
||||||
void HAL_PWR_DisableSEVOnPend(void);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup PWR_Private_Constants PWR Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_PVD_EXTI_Line PWR PVD EXTI Line
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_EXTI_LINE_PVD ((uint32_t)EXTI_IMR_MR16) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_register_alias_address PWR Register alias address
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* ------------- PWR registers bit address in the alias region ---------------*/
|
|
||||||
#define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
|
|
||||||
#define PWR_CR_OFFSET 0x00U
|
|
||||||
#define PWR_CSR_OFFSET 0x04U
|
|
||||||
#define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET)
|
|
||||||
#define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_CR_register_alias PWR CR Register alias address
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* --- CR Register ---*/
|
|
||||||
/* Alias word address of DBP bit */
|
|
||||||
#define DBP_BIT_NUMBER POSITION_VAL(PWR_CR_DBP)
|
|
||||||
#define CR_DBP_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (DBP_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of PVDE bit */
|
|
||||||
#define PVDE_BIT_NUMBER POSITION_VAL(PWR_CR_PVDE)
|
|
||||||
#define CR_PVDE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PVDE_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of PMODE bit */
|
|
||||||
#define PMODE_BIT_NUMBER POSITION_VAL(PWR_CR_PMODE)
|
|
||||||
#define CR_PMODE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PMODE_BIT_NUMBER * 4U))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_CSR_register_alias PWR CSR Register alias address
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* --- CSR Register ---*/
|
|
||||||
/* Alias word address of EWUP bit */
|
|
||||||
#define EWUP_BIT_NUMBER POSITION_VAL(PWR_CSR_EWUP)
|
|
||||||
#define CSR_EWUP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (EWUP_BIT_NUMBER * 4U))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup PWR_Private_Macros PWR Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWR_IS_PWR_Definitions PWR Private macros to check input parameters
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
|
|
||||||
((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
|
|
||||||
((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
|
|
||||||
((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
|
|
||||||
#define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
|
|
||||||
((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
|
|
||||||
((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
|
|
||||||
((MODE) == PWR_PVD_MODE_NORMAL))
|
|
||||||
#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
|
|
||||||
((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
|
|
||||||
#define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
|
|
||||||
#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_PWR_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,372 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_pwr_ex.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of PWR HAL Extension module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_PWR_EX_H
|
|
||||||
#define __STM32F4xx_HAL_PWR_EX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup PWREx
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup PWREx_Exported_Constants PWREx Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
|
|
||||||
/** @defgroup PWREx_Regulator_state_in_UnderDrive_mode PWREx Regulator state in UnderDrive mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
|
|
||||||
#define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWREx_Over_Under_Drive_Flag PWREx Over Under Drive Flag
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_FLAG_ODRDY PWR_CSR_ODRDY
|
|
||||||
#define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
|
|
||||||
#define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
|
|
||||||
|
|
||||||
/** @defgroup PWREx_Regulator_Voltage_Scale PWREx Regulator Voltage Scale
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
|
|
||||||
#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK = 168 MHz. */
|
|
||||||
#define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U /* Scale 2 mode: the maximum value of fHCLK = 144 MHz. */
|
|
||||||
#else
|
|
||||||
#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK is 168 MHz. It can be extended to
|
|
||||||
180 MHz by activating the over-drive mode. */
|
|
||||||
#define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1 /* Scale 2 mode: the maximum value of fHCLK is 144 MHz. It can be extended to
|
|
||||||
168 MHz by activating the over-drive mode. */
|
|
||||||
#define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0 /* Scale 3 mode: the maximum value of fHCLK is 120 MHz. */
|
|
||||||
#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
|
|
||||||
defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
/** @defgroup PWREx_WakeUp_Pins PWREx WakeUp Pins
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define PWR_WAKEUP_PIN2 0x00000080U
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
|
|
||||||
defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
#define PWR_WAKEUP_PIN3 0x00000040U
|
|
||||||
#endif /* STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Zx || STM32F412Vx || \
|
|
||||||
STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx ||
|
|
||||||
STM32F413xx || STM32F423xx */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup PWREx_Exported_Constants PWREx Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
|
|
||||||
/** @brief macros configure the main internal regulator output voltage.
|
|
||||||
* @param __REGULATOR__: specifies the regulator output voltage to achieve
|
|
||||||
* a tradeoff between performance and power consumption when the device does
|
|
||||||
* not operate at the maximum frequency (refer to the datasheets for more details).
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
|
|
||||||
* @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
|
|
||||||
__IO uint32_t tmpreg = 0x00U; \
|
|
||||||
MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
|
|
||||||
/* Delay after an RCC peripheral clock enabling */ \
|
|
||||||
tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
|
|
||||||
UNUSED(tmpreg); \
|
|
||||||
} while(0U)
|
|
||||||
#else
|
|
||||||
/** @brief macros configure the main internal regulator output voltage.
|
|
||||||
* @param __REGULATOR__: specifies the regulator output voltage to achieve
|
|
||||||
* a tradeoff between performance and power consumption when the device does
|
|
||||||
* not operate at the maximum frequency (refer to the datasheets for more details).
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
|
|
||||||
* @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
|
|
||||||
* @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
|
|
||||||
__IO uint32_t tmpreg = 0x00U; \
|
|
||||||
MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
|
|
||||||
/* Delay after an RCC peripheral clock enabling */ \
|
|
||||||
tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
|
|
||||||
UNUSED(tmpreg); \
|
|
||||||
} while(0U)
|
|
||||||
#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
|
|
||||||
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
/** @brief Macros to enable or disable the Over drive mode.
|
|
||||||
* @note These macros can be used only for STM32F42xx/STM3243xx devices.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
|
|
||||||
#define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
|
|
||||||
|
|
||||||
/** @brief Macros to enable or disable the Over drive switching.
|
|
||||||
* @note These macros can be used only for STM32F42xx/STM3243xx devices.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
|
|
||||||
#define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
|
|
||||||
|
|
||||||
/** @brief Macros to enable or disable the Under drive mode.
|
|
||||||
* @note This mode is enabled only with STOP low power mode.
|
|
||||||
* In this mode, the 1.2V domain is preserved in reduced leakage mode. This
|
|
||||||
* mode is only available when the main regulator or the low power regulator
|
|
||||||
* is in low voltage mode.
|
|
||||||
* @note If the Under-drive mode was enabled, it is automatically disabled after
|
|
||||||
* exiting Stop mode.
|
|
||||||
* When the voltage regulator operates in Under-drive mode, an additional
|
|
||||||
* startup delay is induced when waking up from Stop mode.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
|
|
||||||
#define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
|
|
||||||
|
|
||||||
/** @brief Check PWR flag is set or not.
|
|
||||||
* @note These macros can be used only for STM32F42xx/STM3243xx devices.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
|
|
||||||
* is ready
|
|
||||||
* @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
|
|
||||||
* switching is ready
|
|
||||||
* @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
|
|
||||||
* is enabled in Stop mode
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
|
|
||||||
|
|
||||||
/** @brief Clear the Under-Drive Ready flag.
|
|
||||||
* @note These macros can be used only for STM32F42xx/STM3243xx devices.
|
|
||||||
*/
|
|
||||||
#define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
|
|
||||||
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup PWREx_Exported_Functions PWREx Exported Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup PWREx_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
void HAL_PWREx_EnableFlashPowerDown(void);
|
|
||||||
void HAL_PWREx_DisableFlashPowerDown(void);
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
|
|
||||||
uint32_t HAL_PWREx_GetVoltageRange(void);
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling);
|
|
||||||
|
|
||||||
#if defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
void HAL_PWREx_EnableWakeUpPinPolarityRisingEdge(void);
|
|
||||||
void HAL_PWREx_EnableWakeUpPinPolarityFallingEdge(void);
|
|
||||||
#endif /* STM32F469xx || STM32F479xx */
|
|
||||||
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
|
|
||||||
defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
|
|
||||||
defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
void HAL_PWREx_EnableMainRegulatorLowVoltage(void);
|
|
||||||
void HAL_PWREx_DisableMainRegulatorLowVoltage(void);
|
|
||||||
void HAL_PWREx_EnableLowRegulatorLowVoltage(void);
|
|
||||||
void HAL_PWREx_DisableLowRegulatorLowVoltage(void);
|
|
||||||
#endif /* STM32F410xx || STM32F401xC || STM32F401xE || STM32F411xE || STM32F412Zx || STM32F412Vx ||\
|
|
||||||
STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
|
||||||
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
|
|
||||||
defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void);
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void);
|
|
||||||
HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup PWREx_Private_Constants PWREx Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWREx_register_alias_address PWREx Register alias address
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* ------------- PWR registers bit address in the alias region ---------------*/
|
|
||||||
/* --- CR Register ---*/
|
|
||||||
/* Alias word address of FPDS bit */
|
|
||||||
#define FPDS_BIT_NUMBER POSITION_VAL(PWR_CR_FPDS)
|
|
||||||
#define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of ODEN bit */
|
|
||||||
#define ODEN_BIT_NUMBER POSITION_VAL(PWR_CR_ODEN)
|
|
||||||
#define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of ODSWEN bit */
|
|
||||||
#define ODSWEN_BIT_NUMBER POSITION_VAL(PWR_CR_ODSWEN)
|
|
||||||
#define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of MRLVDS bit */
|
|
||||||
#define MRLVDS_BIT_NUMBER POSITION_VAL(PWR_CR_MRLVDS)
|
|
||||||
#define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/* Alias word address of LPLVDS bit */
|
|
||||||
#define LPLVDS_BIT_NUMBER POSITION_VAL(PWR_CR_LPLVDS)
|
|
||||||
#define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWREx_CSR_register_alias PWRx CSR Register alias address
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* --- CSR Register ---*/
|
|
||||||
/* Alias word address of BRE bit */
|
|
||||||
#define BRE_BIT_NUMBER POSITION_VAL(PWR_CSR_BRE)
|
|
||||||
#define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U))
|
|
||||||
|
|
||||||
#if defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
/* Alias word address of WUPP bit */
|
|
||||||
#define WUPP_BIT_NUMBER POSITION_VAL(PWR_CSR_WUPP)
|
|
||||||
#define CSR_WUPP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (WUPP_BIT_NUMBER * 4U))
|
|
||||||
#endif /* STM32F469xx || STM32F479xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup PWREx_Private_Macros PWREx Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
|
||||||
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
|
|
||||||
#define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
|
|
||||||
((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
|
|
||||||
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
|
|
||||||
|
|
||||||
#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
|
|
||||||
#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
|
|
||||||
((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
|
|
||||||
#else
|
|
||||||
#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
|
|
||||||
((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
|
|
||||||
((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
|
|
||||||
#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
|
|
||||||
|
|
||||||
#if defined(STM32F446xx)
|
|
||||||
#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
|
|
||||||
#elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\
|
|
||||||
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
|
|
||||||
defined(STM32F423xx)
|
|
||||||
#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \
|
|
||||||
((PIN) == PWR_WAKEUP_PIN3))
|
|
||||||
#else
|
|
||||||
#define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1)
|
|
||||||
#endif /* STM32F446xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_PWR_EX_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,833 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_rtc.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of RTC HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_RTC_H
|
|
||||||
#define __STM32F4xx_HAL_RTC_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Exported_Types RTC Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL State structures definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
|
|
||||||
HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
|
|
||||||
HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
|
|
||||||
HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
|
|
||||||
HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
|
|
||||||
}HAL_RTCStateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RTC Configuration Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
|
|
||||||
This parameter can be a value of @ref RTC_Hour_Formats */
|
|
||||||
|
|
||||||
uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
|
|
||||||
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
|
|
||||||
|
|
||||||
uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
|
|
||||||
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFFU */
|
|
||||||
|
|
||||||
uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
|
|
||||||
This parameter can be a value of @ref RTC_Output_selection_Definitions */
|
|
||||||
|
|
||||||
uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
|
|
||||||
This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
|
|
||||||
|
|
||||||
uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
|
|
||||||
This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
|
|
||||||
}RTC_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RTC Time structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t Hours; /*!< Specifies the RTC Time Hour.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
|
|
||||||
|
|
||||||
uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
|
||||||
|
|
||||||
uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
|
||||||
|
|
||||||
uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
|
|
||||||
This parameter can be a value of @ref RTC_AM_PM_Definitions */
|
|
||||||
|
|
||||||
uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
|
|
||||||
This parameter corresponds to a time unit range between [0-1] Second
|
|
||||||
with [1 Sec / SecondFraction +1] granularity */
|
|
||||||
|
|
||||||
uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
|
|
||||||
corresponding to Synchronous pre-scaler factor value (PREDIV_S)
|
|
||||||
This parameter corresponds to a time unit range between [0-1] Second
|
|
||||||
with [1 Sec / SecondFraction +1] granularity.
|
|
||||||
This field will be used only by HAL_RTC_GetTime function */
|
|
||||||
|
|
||||||
uint32_t DayLightSaving; /*!< Specifies DayLight Save Operation.
|
|
||||||
This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
|
|
||||||
|
|
||||||
uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
|
|
||||||
in CR register to store the operation.
|
|
||||||
This parameter can be a value of @ref RTC_StoreOperation_Definitions */
|
|
||||||
}RTC_TimeTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RTC Date structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
|
|
||||||
This parameter can be a value of @ref RTC_WeekDay_Definitions */
|
|
||||||
|
|
||||||
uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
|
|
||||||
This parameter can be a value of @ref RTC_Month_Date_Definitions */
|
|
||||||
|
|
||||||
uint8_t Date; /*!< Specifies the RTC Date.
|
|
||||||
This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
|
|
||||||
|
|
||||||
uint8_t Year; /*!< Specifies the RTC Date Year.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
|
|
||||||
|
|
||||||
}RTC_DateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RTC Alarm structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
|
|
||||||
|
|
||||||
uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
|
|
||||||
This parameter can be a value of @ref RTC_AlarmMask_Definitions */
|
|
||||||
|
|
||||||
uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
|
|
||||||
This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
|
|
||||||
|
|
||||||
uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
|
|
||||||
This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
|
|
||||||
|
|
||||||
uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
|
|
||||||
If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
|
|
||||||
If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
|
|
||||||
|
|
||||||
uint32_t Alarm; /*!< Specifies the alarm .
|
|
||||||
This parameter can be a value of @ref RTC_Alarms_Definitions */
|
|
||||||
}RTC_AlarmTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RTC Handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
RTC_TypeDef *Instance; /*!< Register base address */
|
|
||||||
|
|
||||||
RTC_InitTypeDef Init; /*!< RTC required parameters */
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /*!< RTC locking object */
|
|
||||||
|
|
||||||
__IO HAL_RTCStateTypeDef State; /*!< Time communication state */
|
|
||||||
|
|
||||||
}RTC_HandleTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Exported_Constants RTC Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Hour_Formats RTC Hour Formats
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_HOURFORMAT_24 0x00000000U
|
|
||||||
#define RTC_HOURFORMAT_12 0x00000040U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Output_selection_Definitions RTC Output Selection Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_OUTPUT_DISABLE 0x00000000U
|
|
||||||
#define RTC_OUTPUT_ALARMA 0x00200000U
|
|
||||||
#define RTC_OUTPUT_ALARMB 0x00400000U
|
|
||||||
#define RTC_OUTPUT_WAKEUP 0x00600000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_OUTPUT_POLARITY_HIGH 0x00000000U
|
|
||||||
#define RTC_OUTPUT_POLARITY_LOW 0x00100000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_OUTPUT_TYPE_OPENDRAIN 0x00000000U
|
|
||||||
#define RTC_OUTPUT_TYPE_PUSHPULL 0x00040000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
|
|
||||||
#define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_DAYLIGHTSAVING_SUB1H 0x00020000U
|
|
||||||
#define RTC_DAYLIGHTSAVING_ADD1H 0x00010000U
|
|
||||||
#define RTC_DAYLIGHTSAVING_NONE 0x00000000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_STOREOPERATION_RESET 0x00000000U
|
|
||||||
#define RTC_STOREOPERATION_SET 0x00040000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_FORMAT_BIN 0x00000000U
|
|
||||||
#define RTC_FORMAT_BCD 0x00000001U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Coded in BCD format */
|
|
||||||
#define RTC_MONTH_JANUARY ((uint8_t)0x01)
|
|
||||||
#define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
|
|
||||||
#define RTC_MONTH_MARCH ((uint8_t)0x03)
|
|
||||||
#define RTC_MONTH_APRIL ((uint8_t)0x04)
|
|
||||||
#define RTC_MONTH_MAY ((uint8_t)0x05)
|
|
||||||
#define RTC_MONTH_JUNE ((uint8_t)0x06)
|
|
||||||
#define RTC_MONTH_JULY ((uint8_t)0x07)
|
|
||||||
#define RTC_MONTH_AUGUST ((uint8_t)0x08)
|
|
||||||
#define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
|
|
||||||
#define RTC_MONTH_OCTOBER ((uint8_t)0x10)
|
|
||||||
#define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
|
|
||||||
#define RTC_MONTH_DECEMBER ((uint8_t)0x12)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
|
|
||||||
#define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
|
|
||||||
#define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
|
|
||||||
#define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
|
|
||||||
#define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
|
|
||||||
#define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
|
|
||||||
#define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000U
|
|
||||||
#define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY 0x40000000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_ALARMMASK_NONE 0x00000000U
|
|
||||||
#define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
|
|
||||||
#define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
|
|
||||||
#define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
|
|
||||||
#define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
|
|
||||||
#define RTC_ALARMMASK_ALL 0x80808080U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_ALARM_A RTC_CR_ALRAE
|
|
||||||
#define RTC_ALARM_B RTC_CR_ALRBE
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_ALL 0x00000000U /*!< All Alarm SS fields are masked.
|
|
||||||
There is no comparison on sub seconds
|
|
||||||
for Alarm */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_1 0x01000000U /*!< SS[14:1] are don't care in Alarm
|
|
||||||
comparison. Only SS[0] is compared. */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_2 0x02000000U /*!< SS[14:2] are don't care in Alarm
|
|
||||||
comparison. Only SS[1:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_3 0x03000000U /*!< SS[14:3] are don't care in Alarm
|
|
||||||
comparison. Only SS[2:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_4 0x04000000U /*!< SS[14:4] are don't care in Alarm
|
|
||||||
comparison. Only SS[3:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_5 0x05000000U /*!< SS[14:5] are don't care in Alarm
|
|
||||||
comparison. Only SS[4:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_6 0x06000000U /*!< SS[14:6] are don't care in Alarm
|
|
||||||
comparison. Only SS[5:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_7 0x07000000U /*!< SS[14:7] are don't care in Alarm
|
|
||||||
comparison. Only SS[6:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_8 0x08000000U /*!< SS[14:8] are don't care in Alarm
|
|
||||||
comparison. Only SS[7:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_9 0x09000000U /*!< SS[14:9] are don't care in Alarm
|
|
||||||
comparison. Only SS[8:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_10 0x0A000000U /*!< SS[14:10] are don't care in Alarm
|
|
||||||
comparison. Only SS[9:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_11 0x0B000000U /*!< SS[14:11] are don't care in Alarm
|
|
||||||
comparison. Only SS[10:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_12 0x0C000000U /*!< SS[14:12] are don't care in Alarm
|
|
||||||
comparison.Only SS[11:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14_13 0x0D000000U /*!< SS[14:13] are don't care in Alarm
|
|
||||||
comparison. Only SS[12:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_SS14 0x0E000000U /*!< SS[14] is don't care in Alarm
|
|
||||||
comparison.Only SS[13:0] are compared */
|
|
||||||
#define RTC_ALARMSUBSECONDMASK_NONE 0x0F000000U /*!< SS[14:0] are compared and must match
|
|
||||||
to activate alarm. */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_IT_TS 0x00008000U
|
|
||||||
#define RTC_IT_WUT 0x00004000U
|
|
||||||
#define RTC_IT_ALRB 0x00002000U
|
|
||||||
#define RTC_IT_ALRA 0x00001000U
|
|
||||||
#define RTC_IT_TAMP 0x00000004U /* Used only to Enable the Tamper Interrupt */
|
|
||||||
#define RTC_IT_TAMP1 0x00020000U
|
|
||||||
#define RTC_IT_TAMP2 0x00040000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_Flags_Definitions RTC Flags Definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define RTC_FLAG_RECALPF 0x00010000U
|
|
||||||
#define RTC_FLAG_TAMP2F 0x00004000U
|
|
||||||
#define RTC_FLAG_TAMP1F 0x00002000U
|
|
||||||
#define RTC_FLAG_TSOVF 0x00001000U
|
|
||||||
#define RTC_FLAG_TSF 0x00000800U
|
|
||||||
#define RTC_FLAG_WUTF 0x00000400U
|
|
||||||
#define RTC_FLAG_ALRBF 0x00000200U
|
|
||||||
#define RTC_FLAG_ALRAF 0x00000100U
|
|
||||||
#define RTC_FLAG_INITF 0x00000040U
|
|
||||||
#define RTC_FLAG_RSF 0x00000020U
|
|
||||||
#define RTC_FLAG_INITS 0x00000010U
|
|
||||||
#define RTC_FLAG_SHPF 0x00000008U
|
|
||||||
#define RTC_FLAG_WUTWF 0x00000004U
|
|
||||||
#define RTC_FLAG_ALRBWF 0x00000002U
|
|
||||||
#define RTC_FLAG_ALRAWF 0x00000001U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Exported_Macros RTC Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Reset RTC handle state
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the write protection for RTC registers.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
(__HANDLE__)->Instance->WPR = 0xCAU; \
|
|
||||||
(__HANDLE__)->Instance->WPR = 0x53U; \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the write protection for RTC registers.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
(__HANDLE__)->Instance->WPR = 0xFFU; \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the RTC ALARMA peripheral.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the RTC ALARMA peripheral.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the RTC ALARMB peripheral.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the RTC ALARMB peripheral.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the RTC Alarm interrupt.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
|
||||||
* @arg RTC_IT_ALRB: Alarm B interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the RTC Alarm interrupt.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
|
||||||
* @arg RTC_IT_ALRB: Alarm B interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether the specified RTC Alarm interrupt has occurred or not.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt to check.
|
|
||||||
* This parameter can be:
|
|
||||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
|
||||||
* @arg RTC_IT_ALRB: Alarm B interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the selected RTC Alarm's flag status.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __FLAG__: specifies the RTC Alarm Flag to check.
|
|
||||||
* This parameter can be:
|
|
||||||
* @arg RTC_FLAG_ALRAF
|
|
||||||
* @arg RTC_FLAG_ALRBF
|
|
||||||
* @arg RTC_FLAG_ALRAWF
|
|
||||||
* @arg RTC_FLAG_ALRBWF
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear the RTC Alarm's pending flags.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
|
|
||||||
* This parameter can be:
|
|
||||||
* @arg RTC_FLAG_ALRAF
|
|
||||||
* @arg RTC_FLAG_ALRBF
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
|
|
||||||
* @param __HANDLE__: specifies the RTC handle.
|
|
||||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
|
|
||||||
* This parameter can be:
|
|
||||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
|
||||||
* @arg RTC_IT_ALRB: Alarm B interrupt
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable interrupt on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable interrupt on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable event on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable event on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
|
|
||||||
__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();\
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();\
|
|
||||||
__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();\
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
|
|
||||||
* @retval Line Status.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear the RTC Alarm associated Exti line flag.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Generate a Software interrupt on RTC Alarm associated Exti line.
|
|
||||||
* @retval None.
|
|
||||||
*/
|
|
||||||
#define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include RTC HAL Extension module */
|
|
||||||
#include "stm32f4xx_hal_rtc_ex.h"
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup RTC_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization and de-initialization functions ****************************/
|
|
||||||
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
|
|
||||||
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
|
|
||||||
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* RTC Time and Date functions ************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* RTC Alarm functions ********************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
|
|
||||||
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
|
|
||||||
HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
|
||||||
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC_Exported_Functions_Group4
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions ***********************************************/
|
|
||||||
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup RTC_Exported_Functions_Group5
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral State functions *************************************************/
|
|
||||||
HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Private_Constants RTC Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Masks Definition */
|
|
||||||
#define RTC_TR_RESERVED_MASK 0x007F7F7FU
|
|
||||||
#define RTC_DR_RESERVED_MASK 0x00FFFF3FU
|
|
||||||
#define RTC_INIT_MASK 0xFFFFFFFFU
|
|
||||||
#define RTC_RSF_MASK 0xFFFFFF5FU
|
|
||||||
#define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
|
|
||||||
RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \
|
|
||||||
RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \
|
|
||||||
RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \
|
|
||||||
RTC_FLAG_RECALPF | RTC_FLAG_SHPF))
|
|
||||||
|
|
||||||
#define RTC_TIMEOUT_VALUE 1000
|
|
||||||
|
|
||||||
#define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Private_Macros RTC Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
|
|
||||||
((FORMAT) == RTC_HOURFORMAT_24))
|
|
||||||
#define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
|
|
||||||
((OUTPUT) == RTC_OUTPUT_ALARMA) || \
|
|
||||||
((OUTPUT) == RTC_OUTPUT_ALARMB) || \
|
|
||||||
((OUTPUT) == RTC_OUTPUT_WAKEUP))
|
|
||||||
#define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
|
|
||||||
((POL) == RTC_OUTPUT_POLARITY_LOW))
|
|
||||||
#define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
|
|
||||||
((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
|
|
||||||
#define IS_RTC_HOUR12(HOUR) (((HOUR) > 0U) && ((HOUR) <= 12U))
|
|
||||||
#define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U)
|
|
||||||
#define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FU)
|
|
||||||
#define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFFU)
|
|
||||||
#define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U)
|
|
||||||
#define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U)
|
|
||||||
|
|
||||||
#define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM))
|
|
||||||
#define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
|
|
||||||
((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
|
|
||||||
((SAVE) == RTC_DAYLIGHTSAVING_NONE))
|
|
||||||
#define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
|
|
||||||
((OPERATION) == RTC_STOREOPERATION_SET))
|
|
||||||
#define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
|
|
||||||
#define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U)
|
|
||||||
#define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U))
|
|
||||||
#define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U))
|
|
||||||
#define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
|
||||||
#define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0U) && ((DATE) <= 31U))
|
|
||||||
#define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
|
||||||
((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
|
||||||
#define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
|
|
||||||
((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
|
|
||||||
#define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7FU) == (uint32_t)RESET)
|
|
||||||
#define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
|
|
||||||
#define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFFU)
|
|
||||||
|
|
||||||
#define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
|
|
||||||
((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup RTC_Private_Functions RTC Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
|
|
||||||
uint8_t RTC_ByteToBcd2(uint8_t Value);
|
|
||||||
uint8_t RTC_Bcd2ToByte(uint8_t Value);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_RTC_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,587 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_spi.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of SPI HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_SPI_H
|
|
||||||
#define __STM32F4xx_HAL_SPI_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup SPI
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup SPI_Exported_Types SPI Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SPI Configuration Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t Mode; /*!< Specifies the SPI operating mode.
|
|
||||||
This parameter can be a value of @ref SPI_Mode */
|
|
||||||
|
|
||||||
uint32_t Direction; /*!< Specifies the SPI bidirectional mode state.
|
|
||||||
This parameter can be a value of @ref SPI_Direction */
|
|
||||||
|
|
||||||
uint32_t DataSize; /*!< Specifies the SPI data size.
|
|
||||||
This parameter can be a value of @ref SPI_Data_Size */
|
|
||||||
|
|
||||||
uint32_t CLKPolarity; /*!< Specifies the serial clock steady state.
|
|
||||||
This parameter can be a value of @ref SPI_Clock_Polarity */
|
|
||||||
|
|
||||||
uint32_t CLKPhase; /*!< Specifies the clock active edge for the bit capture.
|
|
||||||
This parameter can be a value of @ref SPI_Clock_Phase */
|
|
||||||
|
|
||||||
uint32_t NSS; /*!< Specifies whether the NSS signal is managed by
|
|
||||||
hardware (NSS pin) or by software using the SSI bit.
|
|
||||||
This parameter can be a value of @ref SPI_Slave_Select_management */
|
|
||||||
|
|
||||||
uint32_t BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
|
|
||||||
used to configure the transmit and receive SCK clock.
|
|
||||||
This parameter can be a value of @ref SPI_BaudRate_Prescaler
|
|
||||||
@note The communication clock is derived from the master
|
|
||||||
clock. The slave clock does not need to be set. */
|
|
||||||
|
|
||||||
uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
|
|
||||||
This parameter can be a value of @ref SPI_MSB_LSB_transmission */
|
|
||||||
|
|
||||||
uint32_t TIMode; /*!< Specifies if the TI mode is enabled or not.
|
|
||||||
This parameter can be a value of @ref SPI_TI_mode */
|
|
||||||
|
|
||||||
uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
|
|
||||||
This parameter can be a value of @ref SPI_CRC_Calculation */
|
|
||||||
|
|
||||||
uint32_t CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 65535 */
|
|
||||||
}SPI_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL SPI State structure definition
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_SPI_STATE_RESET = 0x00U, /*!< Peripheral not Initialized */
|
|
||||||
HAL_SPI_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
|
|
||||||
HAL_SPI_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */
|
|
||||||
HAL_SPI_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */
|
|
||||||
HAL_SPI_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */
|
|
||||||
HAL_SPI_STATE_BUSY_TX_RX = 0x05U, /*!< Data Transmission and Reception process is ongoing */
|
|
||||||
HAL_SPI_STATE_ERROR = 0x06U /*!< SPI error state */
|
|
||||||
}HAL_SPI_StateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SPI handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct __SPI_HandleTypeDef
|
|
||||||
{
|
|
||||||
SPI_TypeDef *Instance; /* SPI registers base address */
|
|
||||||
|
|
||||||
SPI_InitTypeDef Init; /* SPI communication parameters */
|
|
||||||
|
|
||||||
uint8_t *pTxBuffPtr; /* Pointer to SPI Tx transfer Buffer */
|
|
||||||
|
|
||||||
uint16_t TxXferSize; /* SPI Tx Transfer size */
|
|
||||||
|
|
||||||
__IO uint16_t TxXferCount; /* SPI Tx Transfer Counter */
|
|
||||||
|
|
||||||
uint8_t *pRxBuffPtr; /* Pointer to SPI Rx transfer Buffer */
|
|
||||||
|
|
||||||
uint16_t RxXferSize; /* SPI Rx Transfer size */
|
|
||||||
|
|
||||||
__IO uint16_t RxXferCount; /* SPI Rx Transfer Counter */
|
|
||||||
|
|
||||||
void (*RxISR)(struct __SPI_HandleTypeDef * hspi); /* function pointer on Rx ISR */
|
|
||||||
|
|
||||||
void (*TxISR)(struct __SPI_HandleTypeDef * hspi); /* function pointer on Tx ISR */
|
|
||||||
|
|
||||||
DMA_HandleTypeDef *hdmatx; /* SPI Tx DMA Handle parameters */
|
|
||||||
|
|
||||||
DMA_HandleTypeDef *hdmarx; /* SPI Rx DMA Handle parameters */
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /* Locking object */
|
|
||||||
|
|
||||||
__IO HAL_SPI_StateTypeDef State; /* SPI communication state */
|
|
||||||
|
|
||||||
__IO uint32_t ErrorCode; /* SPI Error code */
|
|
||||||
|
|
||||||
}SPI_HandleTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup SPI_Exported_Constants SPI Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Error_Code SPI Error Code
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define HAL_SPI_ERROR_NONE 0x00000000U /*!< No error */
|
|
||||||
#define HAL_SPI_ERROR_MODF 0x00000001U /*!< MODF error */
|
|
||||||
#define HAL_SPI_ERROR_CRC 0x00000002U /*!< CRC error */
|
|
||||||
#define HAL_SPI_ERROR_OVR 0x00000004U /*!< OVR error */
|
|
||||||
#define HAL_SPI_ERROR_FRE 0x00000008U /*!< FRE error */
|
|
||||||
#define HAL_SPI_ERROR_DMA 0x00000010U /*!< DMA transfer error */
|
|
||||||
#define HAL_SPI_ERROR_FLAG 0x00000020U /*!< Flag: RXNE,TXE, BSY */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Mode SPI Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_MODE_SLAVE 0x00000000U
|
|
||||||
#define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Direction SPI Direction Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_DIRECTION_2LINES 0x00000000U
|
|
||||||
#define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
|
|
||||||
#define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Data_Size SPI Data Size
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_DATASIZE_8BIT 0x00000000U
|
|
||||||
#define SPI_DATASIZE_16BIT SPI_CR1_DFF
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Clock_Polarity SPI Clock Polarity
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_POLARITY_LOW 0x00000000U
|
|
||||||
#define SPI_POLARITY_HIGH SPI_CR1_CPOL
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Clock_Phase SPI Clock Phase
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_PHASE_1EDGE 0x00000000U
|
|
||||||
#define SPI_PHASE_2EDGE SPI_CR1_CPHA
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Slave_Select_management SPI Slave Select Management
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_NSS_SOFT SPI_CR1_SSM
|
|
||||||
#define SPI_NSS_HARD_INPUT 0x00000000U
|
|
||||||
#define SPI_NSS_HARD_OUTPUT 0x00040000U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_BAUDRATEPRESCALER_2 0x00000000U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_4 0x00000008U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_8 0x00000010U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_16 0x00000018U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_32 0x00000020U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_64 0x00000028U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_128 0x00000030U
|
|
||||||
#define SPI_BAUDRATEPRESCALER_256 0x00000038U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB Transmission
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_FIRSTBIT_MSB 0x00000000U
|
|
||||||
#define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_TI_mode SPI TI Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_TIMODE_DISABLE 0x00000000U
|
|
||||||
#define SPI_TIMODE_ENABLE SPI_CR2_FRF
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_CRC_Calculation SPI CRC Calculation
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_CRCCALCULATION_DISABLE 0x00000000U
|
|
||||||
#define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Interrupt_definition SPI Interrupt Definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_IT_TXE SPI_CR2_TXEIE
|
|
||||||
#define SPI_IT_RXNE SPI_CR2_RXNEIE
|
|
||||||
#define SPI_IT_ERR SPI_CR2_ERRIE
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup SPI_Flags_definition SPI Flags Definition
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SPI_FLAG_RXNE SPI_SR_RXNE /* SPI status flag: Rx buffer not empty flag */
|
|
||||||
#define SPI_FLAG_TXE SPI_SR_TXE /* SPI status flag: Tx buffer empty flag */
|
|
||||||
#define SPI_FLAG_BSY SPI_SR_BSY /* SPI status flag: Busy flag */
|
|
||||||
#define SPI_FLAG_CRCERR SPI_SR_CRCERR /* SPI Error flag: CRC error flag */
|
|
||||||
#define SPI_FLAG_MODF SPI_SR_MODF /* SPI Error flag: Mode fault flag */
|
|
||||||
#define SPI_FLAG_OVR SPI_SR_OVR /* SPI Error flag: Overrun flag */
|
|
||||||
#define SPI_FLAG_FRE SPI_SR_FRE /* SPI Error flag: TI mode frame format error flag */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup SPI_Exported_Macros SPI Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Reset SPI handle state.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
|
|
||||||
|
|
||||||
/** @brief Enable or disable the specified SPI interrupts.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @param __INTERRUPT__: specifies the interrupt source to enable or disable.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
|
||||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
|
||||||
* @arg SPI_IT_ERR: Error interrupt enable
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
|
|
||||||
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
|
|
||||||
|
|
||||||
/** @brief Check whether the specified SPI interrupt source is enabled or not.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @param __INTERRUPT__: specifies the SPI interrupt source to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
|
||||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
|
||||||
* @arg SPI_IT_ERR: Error interrupt enable
|
|
||||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
|
||||||
|
|
||||||
/** @brief Check whether the specified SPI flag is set or not.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
|
|
||||||
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
|
|
||||||
* @arg SPI_FLAG_CRCERR: CRC error flag
|
|
||||||
* @arg SPI_FLAG_MODF: Mode fault flag
|
|
||||||
* @arg SPI_FLAG_OVR: Overrun flag
|
|
||||||
* @arg SPI_FLAG_BSY: Busy flag
|
|
||||||
* @arg SPI_FLAG_FRE: Frame format error flag
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
|
|
||||||
|
|
||||||
/** @brief Clear the SPI CRCERR pending flag.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = (uint16_t)(~SPI_FLAG_CRCERR))
|
|
||||||
|
|
||||||
/** @brief Clear the SPI MODF pending flag.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
__IO uint32_t tmpreg_modf = 0x00U; \
|
|
||||||
tmpreg_modf = (__HANDLE__)->Instance->SR; \
|
|
||||||
(__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE); \
|
|
||||||
UNUSED(tmpreg_modf); \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Clear the SPI OVR pending flag.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
__IO uint32_t tmpreg_ovr = 0x00U; \
|
|
||||||
tmpreg_ovr = (__HANDLE__)->Instance->DR; \
|
|
||||||
tmpreg_ovr = (__HANDLE__)->Instance->SR; \
|
|
||||||
UNUSED(tmpreg_ovr); \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Clear the SPI FRE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
__IO uint32_t tmpreg_fre = 0x00U; \
|
|
||||||
tmpreg_fre = (__HANDLE__)->Instance->SR; \
|
|
||||||
UNUSED(tmpreg_fre); \
|
|
||||||
}while(0U)
|
|
||||||
|
|
||||||
/** @brief Enable the SPI peripheral.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_SPE)
|
|
||||||
|
|
||||||
/** @brief Disable the SPI peripheral.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_SPI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup SPI_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup SPI_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization/de-initialization functions **********************************/
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup SPI_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* I/O operation functions *****************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
|
|
||||||
/* Transfer Abort functions */
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Abort(SPI_HandleTypeDef *hspi);
|
|
||||||
HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi);
|
|
||||||
|
|
||||||
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
void HAL_SPI_AbortCpltCallback(SPI_HandleTypeDef *hspi);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup SPI_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral State and Error functions ***************************************/
|
|
||||||
HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi);
|
|
||||||
uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup SPI_Private_Macros SPI Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Set the SPI transmit-only mode.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define SPI_1LINE_TX(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_BIDIOE)
|
|
||||||
|
|
||||||
/** @brief Set the SPI receive-only mode.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define SPI_1LINE_RX(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_BIDIOE))
|
|
||||||
|
|
||||||
/** @brief Reset the CRC calculation of the SPI.
|
|
||||||
* @param __HANDLE__: specifies the SPI Handle.
|
|
||||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define SPI_RESET_CRC(__HANDLE__) do{(__HANDLE__)->Instance->CR1 &= (uint16_t)(~SPI_CR1_CRCEN);\
|
|
||||||
(__HANDLE__)->Instance->CR1 |= SPI_CR1_CRCEN;}while(0U)
|
|
||||||
|
|
||||||
#define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_SLAVE) || \
|
|
||||||
((MODE) == SPI_MODE_MASTER))
|
|
||||||
|
|
||||||
#define IS_SPI_DIRECTION(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
|
|
||||||
((MODE) == SPI_DIRECTION_2LINES_RXONLY) || \
|
|
||||||
((MODE) == SPI_DIRECTION_1LINE))
|
|
||||||
|
|
||||||
#define IS_SPI_DIRECTION_2LINES(MODE) ((MODE) == SPI_DIRECTION_2LINES)
|
|
||||||
|
|
||||||
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
|
|
||||||
((MODE) == SPI_DIRECTION_1LINE))
|
|
||||||
|
|
||||||
#define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DATASIZE_16BIT) || \
|
|
||||||
((DATASIZE) == SPI_DATASIZE_8BIT))
|
|
||||||
|
|
||||||
#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_POLARITY_LOW) || \
|
|
||||||
((CPOL) == SPI_POLARITY_HIGH))
|
|
||||||
|
|
||||||
#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_PHASE_1EDGE) || \
|
|
||||||
((CPHA) == SPI_PHASE_2EDGE))
|
|
||||||
|
|
||||||
#define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_SOFT) || \
|
|
||||||
((NSS) == SPI_NSS_HARD_INPUT) || \
|
|
||||||
((NSS) == SPI_NSS_HARD_OUTPUT))
|
|
||||||
|
|
||||||
#define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BAUDRATEPRESCALER_2) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_4) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_8) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_16) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_32) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_64) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_128) || \
|
|
||||||
((PRESCALER) == SPI_BAUDRATEPRESCALER_256))
|
|
||||||
|
|
||||||
#define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \
|
|
||||||
((BIT) == SPI_FIRSTBIT_LSB))
|
|
||||||
|
|
||||||
#define IS_SPI_TIMODE(MODE) (((MODE) == SPI_TIMODE_DISABLE) || \
|
|
||||||
((MODE) == SPI_TIMODE_ENABLE))
|
|
||||||
|
|
||||||
#define IS_SPI_CRC_CALCULATION(CALCULATION) (((CALCULATION) == SPI_CRCCALCULATION_DISABLE) || \
|
|
||||||
((CALCULATION) == SPI_CRCCALCULATION_ENABLE))
|
|
||||||
|
|
||||||
#define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) (((POLYNOMIAL) >= 0x01U) && ((POLYNOMIAL) <= 0xFFFFU))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup SPI_Private_Functions SPI Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_SPI_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,370 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_tim_ex.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of TIM HAL Extension module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_TIM_EX_H
|
|
||||||
#define __STM32F4xx_HAL_TIM_EX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup TIMEx_Exported_Types TIM Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TIM Hall sensor Configuration Structure definition
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
|
|
||||||
This parameter can be a value of @ref TIM_Input_Capture_Polarity */
|
|
||||||
|
|
||||||
uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
|
|
||||||
This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
|
|
||||||
|
|
||||||
uint32_t IC1Filter; /*!< Specifies the input capture filter.
|
|
||||||
This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
|
|
||||||
|
|
||||||
uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
|
|
||||||
This parameter can be a number between Min_Data = 0x0000U and Max_Data = 0xFFFFU */
|
|
||||||
} TIM_HallSensor_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TIM Master configuration Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection.
|
|
||||||
This parameter can be a value of @ref TIM_Master_Mode_Selection */
|
|
||||||
|
|
||||||
uint32_t MasterSlaveMode; /*!< Master/slave mode selection.
|
|
||||||
This parameter can be a value of @ref TIM_Master_Slave_Mode */
|
|
||||||
}TIM_MasterConfigTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TIM Break and Dead time configuration Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t OffStateRunMode; /*!< TIM off state in run mode.
|
|
||||||
This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
|
|
||||||
uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode.
|
|
||||||
This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
|
|
||||||
uint32_t LockLevel; /*!< TIM Lock level.
|
|
||||||
This parameter can be a value of @ref TIM_Lock_level */
|
|
||||||
uint32_t DeadTime; /*!< TIM dead Time.
|
|
||||||
This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */
|
|
||||||
uint32_t BreakState; /*!< TIM Break State.
|
|
||||||
This parameter can be a value of @ref TIM_Break_Input_enable_disable */
|
|
||||||
uint32_t BreakPolarity; /*!< TIM Break input polarity.
|
|
||||||
This parameter can be a value of @ref TIM_Break_Polarity */
|
|
||||||
uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state.
|
|
||||||
This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */
|
|
||||||
}TIM_BreakDeadTimeConfigTypeDef;
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup TIMEx_Exported_Constants TIM Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup TIMEx_Remap TIM Remap
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define TIM_TIM2_TIM8_TRGO 0x00000000U
|
|
||||||
#define TIM_TIM2_ETH_PTP 0x00000400U
|
|
||||||
#define TIM_TIM2_USBFS_SOF 0x00000800U
|
|
||||||
#define TIM_TIM2_USBHS_SOF 0x00000C00U
|
|
||||||
#define TIM_TIM5_GPIO 0x00000000U
|
|
||||||
#define TIM_TIM5_LSI 0x00000040U
|
|
||||||
#define TIM_TIM5_LSE 0x00000080U
|
|
||||||
#define TIM_TIM5_RTC 0x000000C0U
|
|
||||||
#define TIM_TIM11_GPIO 0x00000000U
|
|
||||||
#define TIM_TIM11_HSE 0x00000002U
|
|
||||||
|
|
||||||
#if defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
#define TIM_TIM9_TIM3_TRGO 0x10000000U
|
|
||||||
#define TIM_TIM9_LPTIM 0x10000010U
|
|
||||||
#define TIM_TIM5_TIM3_TRGO 0x10000000U
|
|
||||||
#define TIM_TIM5_LPTIM 0x10000008U
|
|
||||||
#define TIM_TIM1_TIM3_TRGO 0x10000000U
|
|
||||||
#define TIM_TIM1_LPTIM 0x10000004U
|
|
||||||
#endif /* STM32F413xx | STM32F423xx */
|
|
||||||
|
|
||||||
#if defined (STM32F446xx)
|
|
||||||
#define TIM_TIM11_SPDIFRX 0x00000001U
|
|
||||||
#endif /* STM32F446xx */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
/** @defgroup TIMEx_SystemBreakInput TIM System Break Input
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define TIM_SYSTEMBREAKINPUT_HARDFAULT 0x00000001U /* Core Lockup lock output(Hardfault) is connected to Break Input of TIM1 and TIM8 */
|
|
||||||
#define TIM_SYSTEMBREAKINPUT_PVD 0x00000004U /* PVD Interrupt is connected to Break Input of TIM1 and TIM8 */
|
|
||||||
#define TIM_SYSTEMBREAKINPUT_HARDFAULT_PVD 0x00000005U /* Core Lockup lock output(Hardfault) and PVD Interrupt are connected to Break Input of TIM1 and TIM8 */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Timer Hall Sensor functions **********************************************/
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef* htim, TIM_HallSensor_InitTypeDef* sConfig);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef* htim);
|
|
||||||
|
|
||||||
void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef* htim);
|
|
||||||
void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef* htim);
|
|
||||||
|
|
||||||
/* Blocking mode: Polling */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef* htim);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef* htim);
|
|
||||||
/* Non-Blocking mode: Interrupt */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef* htim);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef* htim);
|
|
||||||
/* Non-Blocking mode: DMA */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef* htim, uint32_t *pData, uint16_t Length);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef* htim);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Timer Complementary Output Compare functions *****************************/
|
|
||||||
/* Blocking mode: Polling */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
|
|
||||||
/* Non-Blocking mode: Interrupt */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
|
|
||||||
/* Non-Blocking mode: DMA */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Timer Complementary PWM functions ****************************************/
|
|
||||||
/* Blocking mode: Polling */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
|
|
||||||
/* Non-Blocking mode: Interrupt */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
/* Non-Blocking mode: DMA */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef* htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef* htim, uint32_t Channel);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group4
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Timer Complementary One Pulse functions **********************************/
|
|
||||||
/* Blocking mode: Polling */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
|
|
||||||
|
|
||||||
/* Non-Blocking mode: Interrupt */
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef* htim, uint32_t OutputChannel);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group5
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Extension Control functions ************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef* htim, uint32_t InputTrigger, uint32_t CommutationSource);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef* htim, TIM_MasterConfigTypeDef * sMasterConfig);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef* htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
|
|
||||||
HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef* htim, uint32_t Remap);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group6
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Extension Callback *********************************************************/
|
|
||||||
void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef* htim);
|
|
||||||
void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef* htim);
|
|
||||||
void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup TIMEx_Exported_Functions_Group7
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Extension Peripheral State functions **************************************/
|
|
||||||
HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup TIMEx_Private_Macros TIM Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#if defined (STM32F446xx)
|
|
||||||
#define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSI)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSE)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_RTC)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_SPDIFRX)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_HSE))
|
|
||||||
#elif defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
#define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSI)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSE)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_RTC)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_HSE)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM9_TIM3_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM9_LPTIM)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_TIM3_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LPTIM)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM1_TIM3_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM1_LPTIM))
|
|
||||||
#else
|
|
||||||
#define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSI)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_LSE)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM5_RTC)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_GPIO)||\
|
|
||||||
((TIM_REMAP) == TIM_TIM11_HSE))
|
|
||||||
#endif /* STM32F446xx */
|
|
||||||
|
|
||||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
|
||||||
#define IS_TIM_SYSTEMBREAKINPUT(BREAKINPUT) (((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_HARDFAULT)||\
|
|
||||||
((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_PVD)||\
|
|
||||||
((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_HARDFAULT_PVD))
|
|
||||||
|
|
||||||
#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */
|
|
||||||
|
|
||||||
#define IS_TIM_DEADTIME(DEADTIME) ((DEADTIME) <= 0xFFU)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup TIMEx_Private_Functions TIM Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_TIM_EX_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,794 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx_hal_uart.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.7.1
|
|
||||||
* @date 14-April-2017
|
|
||||||
* @brief Header file of UART HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F4xx_HAL_UART_H
|
|
||||||
#define __STM32F4xx_HAL_UART_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f4xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup UART
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Exported_Types UART Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief UART Init Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
|
|
||||||
The baud rate is computed using the following formula:
|
|
||||||
- IntegerDivider = ((PCLKx) / (8 * (OVR8+1) * (huart->Init.BaudRate)))
|
|
||||||
- FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8 * (OVR8+1)) + 0.5
|
|
||||||
Where OVR8 is the "oversampling by 8 mode" configuration bit in the CR1 register. */
|
|
||||||
|
|
||||||
uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
|
|
||||||
This parameter can be a value of @ref UART_Word_Length */
|
|
||||||
|
|
||||||
uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
|
|
||||||
This parameter can be a value of @ref UART_Stop_Bits */
|
|
||||||
|
|
||||||
uint32_t Parity; /*!< Specifies the parity mode.
|
|
||||||
This parameter can be a value of @ref UART_Parity
|
|
||||||
@note When parity is enabled, the computed parity is inserted
|
|
||||||
at the MSB position of the transmitted data (9th bit when
|
|
||||||
the word length is set to 9 data bits; 8th bit when the
|
|
||||||
word length is set to 8 data bits). */
|
|
||||||
|
|
||||||
uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
|
|
||||||
This parameter can be a value of @ref UART_Mode */
|
|
||||||
|
|
||||||
uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
|
|
||||||
or disabled.
|
|
||||||
This parameter can be a value of @ref UART_Hardware_Flow_Control */
|
|
||||||
|
|
||||||
uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8).
|
|
||||||
This parameter can be a value of @ref UART_Over_Sampling */
|
|
||||||
}UART_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief HAL UART State structures definition
|
|
||||||
* @note HAL UART State value is a combination of 2 different substates: gState and RxState.
|
|
||||||
* - gState contains UART state information related to global Handle management
|
|
||||||
* and also information related to Tx operations.
|
|
||||||
* gState value coding follow below described bitmap :
|
|
||||||
* b7-b6 Error information
|
|
||||||
* 00 : No Error
|
|
||||||
* 01 : (Not Used)
|
|
||||||
* 10 : Timeout
|
|
||||||
* 11 : Error
|
|
||||||
* b5 IP initilisation status
|
|
||||||
* 0 : Reset (IP not initialized)
|
|
||||||
* 1 : Init done (IP not initialized. HAL UART Init function already called)
|
|
||||||
* b4-b3 (not used)
|
|
||||||
* xx : Should be set to 00
|
|
||||||
* b2 Intrinsic process state
|
|
||||||
* 0 : Ready
|
|
||||||
* 1 : Busy (IP busy with some configuration or internal operations)
|
|
||||||
* b1 (not used)
|
|
||||||
* x : Should be set to 0
|
|
||||||
* b0 Tx state
|
|
||||||
* 0 : Ready (no Tx operation ongoing)
|
|
||||||
* 1 : Busy (Tx operation ongoing)
|
|
||||||
* - RxState contains information related to Rx operations.
|
|
||||||
* RxState value coding follow below described bitmap :
|
|
||||||
* b7-b6 (not used)
|
|
||||||
* xx : Should be set to 00
|
|
||||||
* b5 IP initilisation status
|
|
||||||
* 0 : Reset (IP not initialized)
|
|
||||||
* 1 : Init done (IP not initialized)
|
|
||||||
* b4-b2 (not used)
|
|
||||||
* xxx : Should be set to 000
|
|
||||||
* b1 Rx state
|
|
||||||
* 0 : Ready (no Rx operation ongoing)
|
|
||||||
* 1 : Busy (Rx operation ongoing)
|
|
||||||
* b0 (not used)
|
|
||||||
* x : Should be set to 0.
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
HAL_UART_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized
|
|
||||||
Value is allowed for gState and RxState */
|
|
||||||
HAL_UART_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
|
|
||||||
Value is allowed for gState and RxState */
|
|
||||||
HAL_UART_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
|
|
||||||
Value is allowed for gState only */
|
|
||||||
HAL_UART_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
|
|
||||||
Value is allowed for gState only */
|
|
||||||
HAL_UART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
|
|
||||||
Value is allowed for RxState only */
|
|
||||||
HAL_UART_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing
|
|
||||||
Not to be used for neither gState nor RxState.
|
|
||||||
Value is result of combination (Or) between gState and RxState values */
|
|
||||||
HAL_UART_STATE_TIMEOUT = 0xA0U, /*!< Timeout state
|
|
||||||
Value is allowed for gState only */
|
|
||||||
HAL_UART_STATE_ERROR = 0xE0U /*!< Error
|
|
||||||
Value is allowed for gState only */
|
|
||||||
}HAL_UART_StateTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief UART handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
USART_TypeDef *Instance; /*!< UART registers base address */
|
|
||||||
|
|
||||||
UART_InitTypeDef Init; /*!< UART communication parameters */
|
|
||||||
|
|
||||||
uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
|
|
||||||
|
|
||||||
uint16_t TxXferSize; /*!< UART Tx Transfer size */
|
|
||||||
|
|
||||||
__IO uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
|
|
||||||
|
|
||||||
uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
|
|
||||||
|
|
||||||
uint16_t RxXferSize; /*!< UART Rx Transfer size */
|
|
||||||
|
|
||||||
__IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
|
|
||||||
|
|
||||||
DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
|
|
||||||
|
|
||||||
DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
|
|
||||||
|
|
||||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
|
||||||
|
|
||||||
__IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management
|
|
||||||
and also related to Tx operations.
|
|
||||||
This parameter can be a value of @ref HAL_UART_StateTypeDef */
|
|
||||||
|
|
||||||
__IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations.
|
|
||||||
This parameter can be a value of @ref HAL_UART_StateTypeDef */
|
|
||||||
|
|
||||||
__IO uint32_t ErrorCode; /*!< UART Error code */
|
|
||||||
|
|
||||||
}UART_HandleTypeDef;
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Exported_Constants UART Exported constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Error_Code UART Error Code
|
|
||||||
* @brief UART Error Code
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define HAL_UART_ERROR_NONE 0x00000000U /*!< No error */
|
|
||||||
#define HAL_UART_ERROR_PE 0x00000001U /*!< Parity error */
|
|
||||||
#define HAL_UART_ERROR_NE 0x00000002U /*!< Noise error */
|
|
||||||
#define HAL_UART_ERROR_FE 0x00000004U /*!< Frame error */
|
|
||||||
#define HAL_UART_ERROR_ORE 0x00000008U /*!< Overrun error */
|
|
||||||
#define HAL_UART_ERROR_DMA 0x00000010U /*!< DMA transfer error */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Word_Length UART Word Length
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_WORDLENGTH_8B 0x00000000U
|
|
||||||
#define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Stop_Bits UART Number of Stop Bits
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_STOPBITS_1 0x00000000U
|
|
||||||
#define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Parity UART Parity
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_PARITY_NONE 0x00000000U
|
|
||||||
#define UART_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
|
|
||||||
#define UART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_HWCONTROL_NONE 0x00000000U
|
|
||||||
#define UART_HWCONTROL_RTS ((uint32_t)USART_CR3_RTSE)
|
|
||||||
#define UART_HWCONTROL_CTS ((uint32_t)USART_CR3_CTSE)
|
|
||||||
#define UART_HWCONTROL_RTS_CTS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Mode UART Transfer Mode
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_MODE_RX ((uint32_t)USART_CR1_RE)
|
|
||||||
#define UART_MODE_TX ((uint32_t)USART_CR1_TE)
|
|
||||||
#define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_State UART State
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_STATE_DISABLE 0x00000000U
|
|
||||||
#define UART_STATE_ENABLE ((uint32_t)USART_CR1_UE)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Over_Sampling UART Over Sampling
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_OVERSAMPLING_16 0x00000000U
|
|
||||||
#define UART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_LIN_Break_Detection_Length UART LIN Break Detection Length
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_LINBREAKDETECTLENGTH_10B 0x00000000U
|
|
||||||
#define UART_LINBREAKDETECTLENGTH_11B 0x00000020U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_WakeUp_functions UART Wakeup Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_WAKEUPMETHOD_IDLELINE 0x00000000U
|
|
||||||
#define UART_WAKEUPMETHOD_ADDRESSMARK 0x00000800U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Flags UART FLags
|
|
||||||
* Elements values convention: 0xXXXX
|
|
||||||
* - 0xXXXX : Flag mask in the SR register
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define UART_FLAG_CTS ((uint32_t)USART_SR_CTS)
|
|
||||||
#define UART_FLAG_LBD ((uint32_t)USART_SR_LBD)
|
|
||||||
#define UART_FLAG_TXE ((uint32_t)USART_SR_TXE)
|
|
||||||
#define UART_FLAG_TC ((uint32_t)USART_SR_TC)
|
|
||||||
#define UART_FLAG_RXNE ((uint32_t)USART_SR_RXNE)
|
|
||||||
#define UART_FLAG_IDLE ((uint32_t)USART_SR_IDLE)
|
|
||||||
#define UART_FLAG_ORE ((uint32_t)USART_SR_ORE)
|
|
||||||
#define UART_FLAG_NE ((uint32_t)USART_SR_NE)
|
|
||||||
#define UART_FLAG_FE ((uint32_t)USART_SR_FE)
|
|
||||||
#define UART_FLAG_PE ((uint32_t)USART_SR_PE)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup UART_Interrupt_definition UART Interrupt Definitions
|
|
||||||
* Elements values convention: 0xY000XXXX
|
|
||||||
* - XXXX : Interrupt mask (16 bits) in the Y register
|
|
||||||
* - Y : Interrupt source register (2bits)
|
|
||||||
* - 0001: CR1 register
|
|
||||||
* - 0010: CR2 register
|
|
||||||
* - 0011: CR3 register
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UART_IT_PE ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_PEIE))
|
|
||||||
#define UART_IT_TXE ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_TXEIE))
|
|
||||||
#define UART_IT_TC ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_TCIE))
|
|
||||||
#define UART_IT_RXNE ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE))
|
|
||||||
#define UART_IT_IDLE ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE))
|
|
||||||
|
|
||||||
#define UART_IT_LBD ((uint32_t)(UART_CR2_REG_INDEX << 28U | USART_CR2_LBDIE))
|
|
||||||
|
|
||||||
#define UART_IT_CTS ((uint32_t)(UART_CR3_REG_INDEX << 28U | USART_CR3_CTSIE))
|
|
||||||
#define UART_IT_ERR ((uint32_t)(UART_CR3_REG_INDEX << 28U | USART_CR3_EIE))
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Exported_Macros UART Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief Reset UART handle gstate & RxState
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
|
|
||||||
(__HANDLE__)->gState = HAL_UART_STATE_RESET; \
|
|
||||||
(__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Flushes the UART DR register
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR)
|
|
||||||
|
|
||||||
/** @brief Checks whether the specified UART flag is set or not.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5)
|
|
||||||
* @arg UART_FLAG_LBD: LIN Break detection flag
|
|
||||||
* @arg UART_FLAG_TXE: Transmit data register empty flag
|
|
||||||
* @arg UART_FLAG_TC: Transmission Complete flag
|
|
||||||
* @arg UART_FLAG_RXNE: Receive data register not empty flag
|
|
||||||
* @arg UART_FLAG_IDLE: Idle Line detection flag
|
|
||||||
* @arg UART_FLAG_ORE: Overrun Error flag
|
|
||||||
* @arg UART_FLAG_NE: Noise Error flag
|
|
||||||
* @arg UART_FLAG_FE: Framing Error flag
|
|
||||||
* @arg UART_FLAG_PE: Parity Error flag
|
|
||||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
|
|
||||||
|
|
||||||
/** @brief Clears the specified UART pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @param __FLAG__: specifies the flag to check.
|
|
||||||
* This parameter can be any combination of the following values:
|
|
||||||
* @arg UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5).
|
|
||||||
* @arg UART_FLAG_LBD: LIN Break detection flag.
|
|
||||||
* @arg UART_FLAG_TC: Transmission Complete flag.
|
|
||||||
* @arg UART_FLAG_RXNE: Receive data register not empty flag.
|
|
||||||
*
|
|
||||||
* @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun
|
|
||||||
* error) and IDLE (Idle line detected) flags are cleared by software
|
|
||||||
* sequence: a read operation to USART_SR register followed by a read
|
|
||||||
* operation to USART_DR register.
|
|
||||||
* @note RXNE flag can be also cleared by a read to the USART_DR register.
|
|
||||||
* @note TC flag can be also cleared by software sequence: a read operation to
|
|
||||||
* USART_SR register followed by a write operation to USART_DR register.
|
|
||||||
* @note TXE flag is cleared only by a write to the USART_DR register.
|
|
||||||
*
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
|
|
||||||
|
|
||||||
/** @brief Clear the UART PE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
__IO uint32_t tmpreg = 0x00U; \
|
|
||||||
tmpreg = (__HANDLE__)->Instance->SR; \
|
|
||||||
tmpreg = (__HANDLE__)->Instance->DR; \
|
|
||||||
UNUSED(tmpreg); \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Clear the UART FE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
|
|
||||||
|
|
||||||
/** @brief Clear the UART NE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
|
|
||||||
|
|
||||||
/** @brief Clear the UART ORE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
|
|
||||||
|
|
||||||
/** @brief Clear the UART IDLE pending flag.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
|
|
||||||
|
|
||||||
/** @brief Enable the specified UART interrupt.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @param __INTERRUPT__: specifies the UART interrupt source to enable.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg UART_IT_CTS: CTS change interrupt
|
|
||||||
* @arg UART_IT_LBD: LIN Break detection interrupt
|
|
||||||
* @arg UART_IT_TXE: Transmit Data Register empty interrupt
|
|
||||||
* @arg UART_IT_TC: Transmission complete interrupt
|
|
||||||
* @arg UART_IT_RXNE: Receive Data register not empty interrupt
|
|
||||||
* @arg UART_IT_IDLE: Idle line detection interrupt
|
|
||||||
* @arg UART_IT_PE: Parity Error interrupt
|
|
||||||
* @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define UART_IT_MASK 0x0000FFFFU
|
|
||||||
#define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & UART_IT_MASK)): \
|
|
||||||
(((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & UART_IT_MASK)): \
|
|
||||||
((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & UART_IT_MASK)))
|
|
||||||
/** @brief Disable the specified UART interrupt.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @param __INTERRUPT__: specifies the UART interrupt source to disable.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg UART_IT_CTS: CTS change interrupt
|
|
||||||
* @arg UART_IT_LBD: LIN Break detection interrupt
|
|
||||||
* @arg UART_IT_TXE: Transmit Data Register empty interrupt
|
|
||||||
* @arg UART_IT_TC: Transmission complete interrupt
|
|
||||||
* @arg UART_IT_RXNE: Receive Data register not empty interrupt
|
|
||||||
* @arg UART_IT_IDLE: Idle line detection interrupt
|
|
||||||
* @arg UART_IT_PE: Parity Error interrupt
|
|
||||||
* @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
|
|
||||||
(((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
|
|
||||||
((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & UART_IT_MASK)))
|
|
||||||
|
|
||||||
/** @brief Checks whether the specified UART interrupt has occurred or not.
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
|
|
||||||
* UART peripheral.
|
|
||||||
* @param __IT__: specifies the UART interrupt source to check.
|
|
||||||
* This parameter can be one of the following values:
|
|
||||||
* @arg UART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
|
|
||||||
* @arg UART_IT_LBD: LIN Break detection interrupt
|
|
||||||
* @arg UART_IT_TXE: Transmit Data Register empty interrupt
|
|
||||||
* @arg UART_IT_TC: Transmission complete interrupt
|
|
||||||
* @arg UART_IT_RXNE: Receive Data register not empty interrupt
|
|
||||||
* @arg UART_IT_IDLE: Idle line detection interrupt
|
|
||||||
* @arg USART_IT_ERR: Error interrupt
|
|
||||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == 2U)? \
|
|
||||||
(__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & UART_IT_MASK))
|
|
||||||
|
|
||||||
/** @brief Enable CTS flow control
|
|
||||||
* This macro allows to enable CTS hardware flow control for a given UART instance,
|
|
||||||
* without need to call HAL_UART_Init() function.
|
|
||||||
* As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
|
|
||||||
* @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
|
|
||||||
* for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
|
|
||||||
* - UART instance should have already been initialised (through call of HAL_UART_Init() )
|
|
||||||
* - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
|
|
||||||
* and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* The Handle Instance can be USART1, USART2 or LPUART.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
|
|
||||||
(__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Disable CTS flow control
|
|
||||||
* This macro allows to disable CTS hardware flow control for a given UART instance,
|
|
||||||
* without need to call HAL_UART_Init() function.
|
|
||||||
* As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
|
|
||||||
* @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
|
|
||||||
* for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
|
|
||||||
* - UART instance should have already been initialised (through call of HAL_UART_Init() )
|
|
||||||
* - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
|
|
||||||
* and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* The Handle Instance can be USART1, USART2 or LPUART.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
|
|
||||||
(__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Enable RTS flow control
|
|
||||||
* This macro allows to enable RTS hardware flow control for a given UART instance,
|
|
||||||
* without need to call HAL_UART_Init() function.
|
|
||||||
* As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
|
|
||||||
* @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
|
|
||||||
* for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
|
|
||||||
* - UART instance should have already been initialised (through call of HAL_UART_Init() )
|
|
||||||
* - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
|
|
||||||
* and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* The Handle Instance can be USART1, USART2 or LPUART.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
|
|
||||||
(__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief Disable RTS flow control
|
|
||||||
* This macro allows to disable RTS hardware flow control for a given UART instance,
|
|
||||||
* without need to call HAL_UART_Init() function.
|
|
||||||
* As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
|
|
||||||
* @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
|
|
||||||
* for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
|
|
||||||
* - UART instance should have already been initialised (through call of HAL_UART_Init() )
|
|
||||||
* - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
|
|
||||||
* and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* The Handle Instance can be USART1, USART2 or LPUART.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
|
|
||||||
do{ \
|
|
||||||
CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
|
|
||||||
(__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
|
|
||||||
} while(0U)
|
|
||||||
|
|
||||||
/** @brief macros to enables the UART's one bit sample method
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
|
|
||||||
|
|
||||||
/** @brief macros to disables the UART's one bit sample method
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))
|
|
||||||
|
|
||||||
/** @brief Enable UART
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
|
|
||||||
|
|
||||||
/** @brief Disable UART
|
|
||||||
* @param __HANDLE__: specifies the UART Handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @addtogroup UART_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup UART_Exported_Functions_Group1
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization/de-initialization functions **********************************/
|
|
||||||
HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
|
|
||||||
HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
|
|
||||||
HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_MspInit(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup UART_Exported_Functions_Group2
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* IO operation functions *******************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
|
||||||
HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
|
|
||||||
/* Transfer Abort functions */
|
|
||||||
HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart);
|
|
||||||
|
|
||||||
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_AbortCpltCallback (UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_AbortTransmitCpltCallback (UART_HandleTypeDef *huart);
|
|
||||||
void HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef *huart);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup UART_Exported_Functions_Group3
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral Control functions ************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_MultiProcessor_ExitMuteMode(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
|
|
||||||
HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup UART_Exported_Functions_Group4
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Peripheral State functions **************************************************/
|
|
||||||
HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
|
|
||||||
uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Private_Constants UART Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @brief UART interruptions flag mask
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define UART_CR1_REG_INDEX 1U
|
|
||||||
#define UART_CR2_REG_INDEX 2U
|
|
||||||
#define UART_CR3_REG_INDEX 3U
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Private_Macros UART Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B) || \
|
|
||||||
((LENGTH) == UART_WORDLENGTH_9B))
|
|
||||||
#define IS_UART_LIN_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B))
|
|
||||||
#define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
|
|
||||||
((STOPBITS) == UART_STOPBITS_2))
|
|
||||||
#define IS_UART_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
|
|
||||||
((PARITY) == UART_PARITY_EVEN) || \
|
|
||||||
((PARITY) == UART_PARITY_ODD))
|
|
||||||
#define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)\
|
|
||||||
(((CONTROL) == UART_HWCONTROL_NONE) || \
|
|
||||||
((CONTROL) == UART_HWCONTROL_RTS) || \
|
|
||||||
((CONTROL) == UART_HWCONTROL_CTS) || \
|
|
||||||
((CONTROL) == UART_HWCONTROL_RTS_CTS))
|
|
||||||
#define IS_UART_MODE(MODE) ((((MODE) & 0x0000FFF3U) == 0x00U) && ((MODE) != 0x00U))
|
|
||||||
#define IS_UART_STATE(STATE) (((STATE) == UART_STATE_DISABLE) || \
|
|
||||||
((STATE) == UART_STATE_ENABLE))
|
|
||||||
#define IS_UART_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16) || \
|
|
||||||
((SAMPLING) == UART_OVERSAMPLING_8))
|
|
||||||
#define IS_UART_LIN_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16))
|
|
||||||
#define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH) (((LENGTH) == UART_LINBREAKDETECTLENGTH_10B) || \
|
|
||||||
((LENGTH) == UART_LINBREAKDETECTLENGTH_11B))
|
|
||||||
#define IS_UART_WAKEUPMETHOD(WAKEUP) (((WAKEUP) == UART_WAKEUPMETHOD_IDLELINE) || \
|
|
||||||
((WAKEUP) == UART_WAKEUPMETHOD_ADDRESSMARK))
|
|
||||||
#define IS_UART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001U)
|
|
||||||
#define IS_UART_ADDRESS(ADDRESS) ((ADDRESS) <= 0x0FU)
|
|
||||||
|
|
||||||
#define UART_DIV_SAMPLING16(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(4U*(_BAUD_)))
|
|
||||||
#define UART_DIVMANT_SAMPLING16(_PCLK_, _BAUD_) (UART_DIV_SAMPLING16((_PCLK_), (_BAUD_))/100U)
|
|
||||||
#define UART_DIVFRAQ_SAMPLING16(_PCLK_, _BAUD_) (((UART_DIV_SAMPLING16((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING16((_PCLK_), (_BAUD_)) * 100U)) * 16U + 50U) / 100U)
|
|
||||||
/* UART BRR = mantissa + overflow + fraction
|
|
||||||
= (UART DIVMANT << 4) + (UART DIVFRAQ & 0xF0) + (UART DIVFRAQ & 0x0FU) */
|
|
||||||
#define UART_BRR_SAMPLING16(_PCLK_, _BAUD_) (((UART_DIVMANT_SAMPLING16((_PCLK_), (_BAUD_)) << 4U) + \
|
|
||||||
(UART_DIVFRAQ_SAMPLING16((_PCLK_), (_BAUD_)) & 0xF0U)) + \
|
|
||||||
(UART_DIVFRAQ_SAMPLING16((_PCLK_), (_BAUD_)) & 0x0FU))
|
|
||||||
|
|
||||||
#define UART_DIV_SAMPLING8(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(2U*(_BAUD_)))
|
|
||||||
#define UART_DIVMANT_SAMPLING8(_PCLK_, _BAUD_) (UART_DIV_SAMPLING8((_PCLK_), (_BAUD_))/100U)
|
|
||||||
#define UART_DIVFRAQ_SAMPLING8(_PCLK_, _BAUD_) (((UART_DIV_SAMPLING8((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) * 100U)) * 8U + 50U) / 100U)
|
|
||||||
/* UART BRR = mantissa + overflow + fraction
|
|
||||||
= (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07U) */
|
|
||||||
#define UART_BRR_SAMPLING8(_PCLK_, _BAUD_) (((UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) << 4U) + \
|
|
||||||
((UART_DIVFRAQ_SAMPLING8((_PCLK_), (_BAUD_)) & 0xF8U) << 1U)) + \
|
|
||||||
(UART_DIVFRAQ_SAMPLING8((_PCLK_), (_BAUD_)) & 0x07U))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/** @defgroup UART_Private_Functions UART Private Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_UART_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
|
||||||
*
|
|
||||||
* $Date: 19. October 2015
|
|
||||||
* $Revision: V.1.4.5 a
|
|
||||||
*
|
|
||||||
* Project: CMSIS DSP Library
|
|
||||||
* Title: arm_common_tables.h
|
|
||||||
*
|
|
||||||
* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
|
|
||||||
*
|
|
||||||
* Target Processor: Cortex-M4/Cortex-M3
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* - Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* - Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* - Neither the name of ARM LIMITED nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* -------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _ARM_COMMON_TABLES_H
|
|
||||||
#define _ARM_COMMON_TABLES_H
|
|
||||||
|
|
||||||
#include "arm_math.h"
|
|
||||||
|
|
||||||
extern const uint16_t armBitRevTable[1024];
|
|
||||||
extern const q15_t armRecipTableQ15[64];
|
|
||||||
extern const q31_t armRecipTableQ31[64];
|
|
||||||
/* extern const q31_t realCoefAQ31[1024]; */
|
|
||||||
/* extern const q31_t realCoefBQ31[1024]; */
|
|
||||||
extern const float32_t twiddleCoef_16[32];
|
|
||||||
extern const float32_t twiddleCoef_32[64];
|
|
||||||
extern const float32_t twiddleCoef_64[128];
|
|
||||||
extern const float32_t twiddleCoef_128[256];
|
|
||||||
extern const float32_t twiddleCoef_256[512];
|
|
||||||
extern const float32_t twiddleCoef_512[1024];
|
|
||||||
extern const float32_t twiddleCoef_1024[2048];
|
|
||||||
extern const float32_t twiddleCoef_2048[4096];
|
|
||||||
extern const float32_t twiddleCoef_4096[8192];
|
|
||||||
#define twiddleCoef twiddleCoef_4096
|
|
||||||
extern const q31_t twiddleCoef_16_q31[24];
|
|
||||||
extern const q31_t twiddleCoef_32_q31[48];
|
|
||||||
extern const q31_t twiddleCoef_64_q31[96];
|
|
||||||
extern const q31_t twiddleCoef_128_q31[192];
|
|
||||||
extern const q31_t twiddleCoef_256_q31[384];
|
|
||||||
extern const q31_t twiddleCoef_512_q31[768];
|
|
||||||
extern const q31_t twiddleCoef_1024_q31[1536];
|
|
||||||
extern const q31_t twiddleCoef_2048_q31[3072];
|
|
||||||
extern const q31_t twiddleCoef_4096_q31[6144];
|
|
||||||
extern const q15_t twiddleCoef_16_q15[24];
|
|
||||||
extern const q15_t twiddleCoef_32_q15[48];
|
|
||||||
extern const q15_t twiddleCoef_64_q15[96];
|
|
||||||
extern const q15_t twiddleCoef_128_q15[192];
|
|
||||||
extern const q15_t twiddleCoef_256_q15[384];
|
|
||||||
extern const q15_t twiddleCoef_512_q15[768];
|
|
||||||
extern const q15_t twiddleCoef_1024_q15[1536];
|
|
||||||
extern const q15_t twiddleCoef_2048_q15[3072];
|
|
||||||
extern const q15_t twiddleCoef_4096_q15[6144];
|
|
||||||
extern const float32_t twiddleCoef_rfft_32[32];
|
|
||||||
extern const float32_t twiddleCoef_rfft_64[64];
|
|
||||||
extern const float32_t twiddleCoef_rfft_128[128];
|
|
||||||
extern const float32_t twiddleCoef_rfft_256[256];
|
|
||||||
extern const float32_t twiddleCoef_rfft_512[512];
|
|
||||||
extern const float32_t twiddleCoef_rfft_1024[1024];
|
|
||||||
extern const float32_t twiddleCoef_rfft_2048[2048];
|
|
||||||
extern const float32_t twiddleCoef_rfft_4096[4096];
|
|
||||||
|
|
||||||
|
|
||||||
/* floating-point bit reversal tables */
|
|
||||||
#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
|
|
||||||
#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
|
|
||||||
#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
|
|
||||||
#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
|
|
||||||
#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
|
|
||||||
#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
|
|
||||||
#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
|
|
||||||
#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
|
|
||||||
#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
|
|
||||||
|
|
||||||
extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
|
|
||||||
|
|
||||||
/* fixed-point bit reversal tables */
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 )
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
|
|
||||||
#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
|
|
||||||
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
|
|
||||||
extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
|
|
||||||
|
|
||||||
/* Tables for Fast Math Sine and Cosine */
|
|
||||||
extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
|
|
||||||
extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
|
|
||||||
extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
|
|
||||||
|
|
||||||
#endif /* ARM_COMMON_TABLES_H */
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
|
||||||
*
|
|
||||||
* $Date: 19. March 2015
|
|
||||||
* $Revision: V.1.4.5
|
|
||||||
*
|
|
||||||
* Project: CMSIS DSP Library
|
|
||||||
* Title: arm_const_structs.h
|
|
||||||
*
|
|
||||||
* Description: This file has constant structs that are initialized for
|
|
||||||
* user convenience. For example, some can be given as
|
|
||||||
* arguments to the arm_cfft_f32() function.
|
|
||||||
*
|
|
||||||
* Target Processor: Cortex-M4/Cortex-M3
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* - Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* - Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* - Neither the name of ARM LIMITED nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* -------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _ARM_CONST_STRUCTS_H
|
|
||||||
#define _ARM_CONST_STRUCTS_H
|
|
||||||
|
|
||||||
#include "arm_math.h"
|
|
||||||
#include "arm_common_tables.h"
|
|
||||||
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
|
|
||||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
|
|
||||||
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
|
|
||||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
|
|
||||||
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
|
|
||||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,734 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file cmsis_armcc.h
|
|
||||||
* @brief CMSIS Cortex-M Core Function/Instruction Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CMSIS_ARMCC_H
|
|
||||||
#define __CMSIS_ARMCC_H
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
|
|
||||||
#error "Please use ARM Compiler Toolchain V4.0.677 or later!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ########################### Core Function Access ########################### */
|
|
||||||
/** \ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* intrinsic void __enable_irq(); */
|
|
||||||
/* intrinsic void __disable_irq(); */
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Control Register
|
|
||||||
\details Returns the content of the Control Register.
|
|
||||||
\return Control Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_CONTROL(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regControl __ASM("control");
|
|
||||||
return(__regControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Control Register
|
|
||||||
\details Writes the given value to the Control Register.
|
|
||||||
\param [in] control Control Register value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_CONTROL(uint32_t control)
|
|
||||||
{
|
|
||||||
register uint32_t __regControl __ASM("control");
|
|
||||||
__regControl = control;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get IPSR Register
|
|
||||||
\details Returns the content of the IPSR Register.
|
|
||||||
\return IPSR Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_IPSR(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regIPSR __ASM("ipsr");
|
|
||||||
return(__regIPSR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get APSR Register
|
|
||||||
\details Returns the content of the APSR Register.
|
|
||||||
\return APSR Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_APSR(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regAPSR __ASM("apsr");
|
|
||||||
return(__regAPSR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get xPSR Register
|
|
||||||
\details Returns the content of the xPSR Register.
|
|
||||||
\return xPSR Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_xPSR(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regXPSR __ASM("xpsr");
|
|
||||||
return(__regXPSR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Process Stack Pointer
|
|
||||||
\details Returns the current value of the Process Stack Pointer (PSP).
|
|
||||||
\return PSP Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_PSP(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regProcessStackPointer __ASM("psp");
|
|
||||||
return(__regProcessStackPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Process Stack Pointer
|
|
||||||
\details Assigns the given value to the Process Stack Pointer (PSP).
|
|
||||||
\param [in] topOfProcStack Process Stack Pointer value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
|
|
||||||
{
|
|
||||||
register uint32_t __regProcessStackPointer __ASM("psp");
|
|
||||||
__regProcessStackPointer = topOfProcStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Main Stack Pointer
|
|
||||||
\details Returns the current value of the Main Stack Pointer (MSP).
|
|
||||||
\return MSP Register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_MSP(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regMainStackPointer __ASM("msp");
|
|
||||||
return(__regMainStackPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Main Stack Pointer
|
|
||||||
\details Assigns the given value to the Main Stack Pointer (MSP).
|
|
||||||
\param [in] topOfMainStack Main Stack Pointer value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
|
|
||||||
{
|
|
||||||
register uint32_t __regMainStackPointer __ASM("msp");
|
|
||||||
__regMainStackPointer = topOfMainStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Priority Mask
|
|
||||||
\details Returns the current state of the priority mask bit from the Priority Mask Register.
|
|
||||||
\return Priority Mask value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_PRIMASK(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regPriMask __ASM("primask");
|
|
||||||
return(__regPriMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Priority Mask
|
|
||||||
\details Assigns the given value to the Priority Mask Register.
|
|
||||||
\param [in] priMask Priority Mask
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
|
|
||||||
{
|
|
||||||
register uint32_t __regPriMask __ASM("primask");
|
|
||||||
__regPriMask = (priMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Enable FIQ
|
|
||||||
\details Enables FIQ interrupts by clearing the F-bit in the CPSR.
|
|
||||||
Can only be executed in Privileged modes.
|
|
||||||
*/
|
|
||||||
#define __enable_fault_irq __enable_fiq
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Disable FIQ
|
|
||||||
\details Disables FIQ interrupts by setting the F-bit in the CPSR.
|
|
||||||
Can only be executed in Privileged modes.
|
|
||||||
*/
|
|
||||||
#define __disable_fault_irq __disable_fiq
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Base Priority
|
|
||||||
\details Returns the current value of the Base Priority register.
|
|
||||||
\return Base Priority register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_BASEPRI(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regBasePri __ASM("basepri");
|
|
||||||
return(__regBasePri);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Base Priority
|
|
||||||
\details Assigns the given value to the Base Priority register.
|
|
||||||
\param [in] basePri Base Priority value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
|
|
||||||
{
|
|
||||||
register uint32_t __regBasePri __ASM("basepri");
|
|
||||||
__regBasePri = (basePri & 0xFFU);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Base Priority with condition
|
|
||||||
\details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
|
|
||||||
or the new value increases the BASEPRI priority level.
|
|
||||||
\param [in] basePri Base Priority value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
|
|
||||||
{
|
|
||||||
register uint32_t __regBasePriMax __ASM("basepri_max");
|
|
||||||
__regBasePriMax = (basePri & 0xFFU);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Fault Mask
|
|
||||||
\details Returns the current value of the Fault Mask register.
|
|
||||||
\return Fault Mask register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_FAULTMASK(void)
|
|
||||||
{
|
|
||||||
register uint32_t __regFaultMask __ASM("faultmask");
|
|
||||||
return(__regFaultMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Fault Mask
|
|
||||||
\details Assigns the given value to the Fault Mask register.
|
|
||||||
\param [in] faultMask Fault Mask value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
|
|
||||||
{
|
|
||||||
register uint32_t __regFaultMask __ASM("faultmask");
|
|
||||||
__regFaultMask = (faultMask & (uint32_t)1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */
|
|
||||||
|
|
||||||
|
|
||||||
#if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get FPSCR
|
|
||||||
\details Returns the current value of the Floating Point Status/Control register.
|
|
||||||
\return Floating Point Status/Control register value
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t __get_FPSCR(void)
|
|
||||||
{
|
|
||||||
#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
|
|
||||||
register uint32_t __regfpscr __ASM("fpscr");
|
|
||||||
return(__regfpscr);
|
|
||||||
#else
|
|
||||||
return(0U);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set FPSCR
|
|
||||||
\details Assigns the given value to the Floating Point Status/Control register.
|
|
||||||
\param [in] fpscr Floating Point Status/Control value to set
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
|
|
||||||
{
|
|
||||||
#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
|
|
||||||
register uint32_t __regfpscr __ASM("fpscr");
|
|
||||||
__regfpscr = (fpscr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_RegAccFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################## Core Instruction Access ######################### */
|
|
||||||
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
|
|
||||||
Access to dedicated instructions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief No Operation
|
|
||||||
\details No Operation does nothing. This instruction can be used for code alignment purposes.
|
|
||||||
*/
|
|
||||||
#define __NOP __nop
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Wait For Interrupt
|
|
||||||
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
|
|
||||||
*/
|
|
||||||
#define __WFI __wfi
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Wait For Event
|
|
||||||
\details Wait For Event is a hint instruction that permits the processor to enter
|
|
||||||
a low-power state until one of a number of events occurs.
|
|
||||||
*/
|
|
||||||
#define __WFE __wfe
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Send Event
|
|
||||||
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
|
|
||||||
*/
|
|
||||||
#define __SEV __sev
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Instruction Synchronization Barrier
|
|
||||||
\details Instruction Synchronization Barrier flushes the pipeline in the processor,
|
|
||||||
so that all instructions following the ISB are fetched from cache or memory,
|
|
||||||
after the instruction has been completed.
|
|
||||||
*/
|
|
||||||
#define __ISB() do {\
|
|
||||||
__schedule_barrier();\
|
|
||||||
__isb(0xF);\
|
|
||||||
__schedule_barrier();\
|
|
||||||
} while (0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Data Synchronization Barrier
|
|
||||||
\details Acts as a special kind of Data Memory Barrier.
|
|
||||||
It completes when all explicit memory accesses before this instruction complete.
|
|
||||||
*/
|
|
||||||
#define __DSB() do {\
|
|
||||||
__schedule_barrier();\
|
|
||||||
__dsb(0xF);\
|
|
||||||
__schedule_barrier();\
|
|
||||||
} while (0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Data Memory Barrier
|
|
||||||
\details Ensures the apparent order of the explicit memory operations before
|
|
||||||
and after the instruction, without ensuring their completion.
|
|
||||||
*/
|
|
||||||
#define __DMB() do {\
|
|
||||||
__schedule_barrier();\
|
|
||||||
__dmb(0xF);\
|
|
||||||
__schedule_barrier();\
|
|
||||||
} while (0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Reverse byte order (32 bit)
|
|
||||||
\details Reverses the byte order in integer value.
|
|
||||||
\param [in] value Value to reverse
|
|
||||||
\return Reversed value
|
|
||||||
*/
|
|
||||||
#define __REV __rev
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Reverse byte order (16 bit)
|
|
||||||
\details Reverses the byte order in two unsigned short values.
|
|
||||||
\param [in] value Value to reverse
|
|
||||||
\return Reversed value
|
|
||||||
*/
|
|
||||||
#ifndef __NO_EMBEDDED_ASM
|
|
||||||
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
|
|
||||||
{
|
|
||||||
rev16 r0, r0
|
|
||||||
bx lr
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Reverse byte order in signed short value
|
|
||||||
\details Reverses the byte order in a signed short value with sign extension to integer.
|
|
||||||
\param [in] value Value to reverse
|
|
||||||
\return Reversed value
|
|
||||||
*/
|
|
||||||
#ifndef __NO_EMBEDDED_ASM
|
|
||||||
__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
|
|
||||||
{
|
|
||||||
revsh r0, r0
|
|
||||||
bx lr
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Rotate Right in unsigned value (32 bit)
|
|
||||||
\details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
|
|
||||||
\param [in] value Value to rotate
|
|
||||||
\param [in] value Number of Bits to rotate
|
|
||||||
\return Rotated value
|
|
||||||
*/
|
|
||||||
#define __ROR __ror
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Breakpoint
|
|
||||||
\details Causes the processor to enter Debug state.
|
|
||||||
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
|
|
||||||
\param [in] value is ignored by the processor.
|
|
||||||
If required, a debugger can use it to store additional information about the breakpoint.
|
|
||||||
*/
|
|
||||||
#define __BKPT(value) __breakpoint(value)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Reverse bit order of value
|
|
||||||
\details Reverses the bit order of the given value.
|
|
||||||
\param [in] value Value to reverse
|
|
||||||
\return Reversed value
|
|
||||||
*/
|
|
||||||
#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
|
|
||||||
#define __RBIT __rbit
|
|
||||||
#else
|
|
||||||
__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
|
|
||||||
{
|
|
||||||
uint32_t result;
|
|
||||||
int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
|
|
||||||
|
|
||||||
result = value; /* r will be reversed bits of v; first get LSB of v */
|
|
||||||
for (value >>= 1U; value; value >>= 1U)
|
|
||||||
{
|
|
||||||
result <<= 1U;
|
|
||||||
result |= value & 1U;
|
|
||||||
s--;
|
|
||||||
}
|
|
||||||
result <<= s; /* shift when v's highest bits are zero */
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Count leading zeros
|
|
||||||
\details Counts the number of leading zeros of a data value.
|
|
||||||
\param [in] value Value to count the leading zeros
|
|
||||||
\return number of leading zeros in value
|
|
||||||
*/
|
|
||||||
#define __CLZ __clz
|
|
||||||
|
|
||||||
|
|
||||||
#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDR Exclusive (8 bit)
|
|
||||||
\details Executes a exclusive LDR instruction for 8 bit value.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint8_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
|
|
||||||
#else
|
|
||||||
#define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDR Exclusive (16 bit)
|
|
||||||
\details Executes a exclusive LDR instruction for 16 bit values.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint16_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
|
|
||||||
#else
|
|
||||||
#define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDR Exclusive (32 bit)
|
|
||||||
\details Executes a exclusive LDR instruction for 32 bit values.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint32_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
|
|
||||||
#else
|
|
||||||
#define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STR Exclusive (8 bit)
|
|
||||||
\details Executes a exclusive STR instruction for 8 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
\return 0 Function succeeded
|
|
||||||
\return 1 Function failed
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __STREXB(value, ptr) __strex(value, ptr)
|
|
||||||
#else
|
|
||||||
#define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STR Exclusive (16 bit)
|
|
||||||
\details Executes a exclusive STR instruction for 16 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
\return 0 Function succeeded
|
|
||||||
\return 1 Function failed
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __STREXH(value, ptr) __strex(value, ptr)
|
|
||||||
#else
|
|
||||||
#define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STR Exclusive (32 bit)
|
|
||||||
\details Executes a exclusive STR instruction for 32 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
\return 0 Function succeeded
|
|
||||||
\return 1 Function failed
|
|
||||||
*/
|
|
||||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
|
||||||
#define __STREXW(value, ptr) __strex(value, ptr)
|
|
||||||
#else
|
|
||||||
#define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Remove the exclusive lock
|
|
||||||
\details Removes the exclusive lock which is created by LDREX.
|
|
||||||
*/
|
|
||||||
#define __CLREX __clrex
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Signed Saturate
|
|
||||||
\details Saturates a signed value.
|
|
||||||
\param [in] value Value to be saturated
|
|
||||||
\param [in] sat Bit position to saturate to (1..32)
|
|
||||||
\return Saturated value
|
|
||||||
*/
|
|
||||||
#define __SSAT __ssat
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Unsigned Saturate
|
|
||||||
\details Saturates an unsigned value.
|
|
||||||
\param [in] value Value to be saturated
|
|
||||||
\param [in] sat Bit position to saturate to (0..31)
|
|
||||||
\return Saturated value
|
|
||||||
*/
|
|
||||||
#define __USAT __usat
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Rotate Right with Extend (32 bit)
|
|
||||||
\details Moves each bit of a bitstring right by one bit.
|
|
||||||
The carry input is shifted in at the left end of the bitstring.
|
|
||||||
\param [in] value Value to rotate
|
|
||||||
\return Rotated value
|
|
||||||
*/
|
|
||||||
#ifndef __NO_EMBEDDED_ASM
|
|
||||||
__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
|
|
||||||
{
|
|
||||||
rrx r0, r0
|
|
||||||
bx lr
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDRT Unprivileged (8 bit)
|
|
||||||
\details Executes a Unprivileged LDRT instruction for 8 bit value.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint8_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDRT Unprivileged (16 bit)
|
|
||||||
\details Executes a Unprivileged LDRT instruction for 16 bit values.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint16_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief LDRT Unprivileged (32 bit)
|
|
||||||
\details Executes a Unprivileged LDRT instruction for 32 bit values.
|
|
||||||
\param [in] ptr Pointer to data
|
|
||||||
\return value of type uint32_t at (*ptr)
|
|
||||||
*/
|
|
||||||
#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STRT Unprivileged (8 bit)
|
|
||||||
\details Executes a Unprivileged STRT instruction for 8 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
*/
|
|
||||||
#define __STRBT(value, ptr) __strt(value, ptr)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STRT Unprivileged (16 bit)
|
|
||||||
\details Executes a Unprivileged STRT instruction for 16 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
*/
|
|
||||||
#define __STRHT(value, ptr) __strt(value, ptr)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief STRT Unprivileged (32 bit)
|
|
||||||
\details Executes a Unprivileged STRT instruction for 32 bit values.
|
|
||||||
\param [in] value Value to store
|
|
||||||
\param [in] ptr Pointer to location
|
|
||||||
*/
|
|
||||||
#define __STRT(value, ptr) __strt(value, ptr)
|
|
||||||
|
|
||||||
#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */
|
|
||||||
|
|
||||||
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
|
|
||||||
|
|
||||||
|
|
||||||
/* ################### Compiler specific Intrinsics ########################### */
|
|
||||||
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
|
|
||||||
Access to dedicated SIMD instructions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */
|
|
||||||
|
|
||||||
#define __SADD8 __sadd8
|
|
||||||
#define __QADD8 __qadd8
|
|
||||||
#define __SHADD8 __shadd8
|
|
||||||
#define __UADD8 __uadd8
|
|
||||||
#define __UQADD8 __uqadd8
|
|
||||||
#define __UHADD8 __uhadd8
|
|
||||||
#define __SSUB8 __ssub8
|
|
||||||
#define __QSUB8 __qsub8
|
|
||||||
#define __SHSUB8 __shsub8
|
|
||||||
#define __USUB8 __usub8
|
|
||||||
#define __UQSUB8 __uqsub8
|
|
||||||
#define __UHSUB8 __uhsub8
|
|
||||||
#define __SADD16 __sadd16
|
|
||||||
#define __QADD16 __qadd16
|
|
||||||
#define __SHADD16 __shadd16
|
|
||||||
#define __UADD16 __uadd16
|
|
||||||
#define __UQADD16 __uqadd16
|
|
||||||
#define __UHADD16 __uhadd16
|
|
||||||
#define __SSUB16 __ssub16
|
|
||||||
#define __QSUB16 __qsub16
|
|
||||||
#define __SHSUB16 __shsub16
|
|
||||||
#define __USUB16 __usub16
|
|
||||||
#define __UQSUB16 __uqsub16
|
|
||||||
#define __UHSUB16 __uhsub16
|
|
||||||
#define __SASX __sasx
|
|
||||||
#define __QASX __qasx
|
|
||||||
#define __SHASX __shasx
|
|
||||||
#define __UASX __uasx
|
|
||||||
#define __UQASX __uqasx
|
|
||||||
#define __UHASX __uhasx
|
|
||||||
#define __SSAX __ssax
|
|
||||||
#define __QSAX __qsax
|
|
||||||
#define __SHSAX __shsax
|
|
||||||
#define __USAX __usax
|
|
||||||
#define __UQSAX __uqsax
|
|
||||||
#define __UHSAX __uhsax
|
|
||||||
#define __USAD8 __usad8
|
|
||||||
#define __USADA8 __usada8
|
|
||||||
#define __SSAT16 __ssat16
|
|
||||||
#define __USAT16 __usat16
|
|
||||||
#define __UXTB16 __uxtb16
|
|
||||||
#define __UXTAB16 __uxtab16
|
|
||||||
#define __SXTB16 __sxtb16
|
|
||||||
#define __SXTAB16 __sxtab16
|
|
||||||
#define __SMUAD __smuad
|
|
||||||
#define __SMUADX __smuadx
|
|
||||||
#define __SMLAD __smlad
|
|
||||||
#define __SMLADX __smladx
|
|
||||||
#define __SMLALD __smlald
|
|
||||||
#define __SMLALDX __smlaldx
|
|
||||||
#define __SMUSD __smusd
|
|
||||||
#define __SMUSDX __smusdx
|
|
||||||
#define __SMLSD __smlsd
|
|
||||||
#define __SMLSDX __smlsdx
|
|
||||||
#define __SMLSLD __smlsld
|
|
||||||
#define __SMLSLDX __smlsldx
|
|
||||||
#define __SEL __sel
|
|
||||||
#define __QADD __qadd
|
|
||||||
#define __QSUB __qsub
|
|
||||||
|
|
||||||
#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
|
|
||||||
((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
|
|
||||||
|
|
||||||
#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
|
|
||||||
((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
|
|
||||||
|
|
||||||
#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
|
|
||||||
((int64_t)(ARG3) << 32U) ) >> 32U))
|
|
||||||
|
|
||||||
#endif /* (__CORTEX_M >= 0x04) */
|
|
||||||
/*@} end of group CMSIS_SIMD_intrinsics */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CMSIS_ARMCC_H */
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,798 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_cm0.h
|
|
||||||
* @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_CM0_H_GENERIC
|
|
||||||
#define __CORE_CM0_H_GENERIC
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
\page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
|
|
||||||
CMSIS violates the following MISRA-C:2004 rules:
|
|
||||||
|
|
||||||
\li Required Rule 8.5, object/function definition in header file.<br>
|
|
||||||
Function definitions in header files are used to allow 'inlining'.
|
|
||||||
|
|
||||||
\li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
|
|
||||||
Unions are used for effective representation of core registers.
|
|
||||||
|
|
||||||
\li Advisory Rule 19.7, Function-like macro defined.<br>
|
|
||||||
Function-like macros are used to allow more efficient code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* CMSIS definitions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\ingroup Cortex_M0
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* CMSIS CM0 definitions */
|
|
||||||
#define __CM0_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */
|
|
||||||
#define __CM0_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */
|
|
||||||
#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
|
|
||||||
__CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
|
|
||||||
|
|
||||||
#define __CORTEX_M (0x00U) /*!< Cortex-M Core */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for IAR Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TI CCS Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#define __packed
|
|
||||||
#define __ASM _asm /*!< asm keyword for COSMIC Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Unknown compiler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** __FPU_USED indicates whether an FPU is used or not.
|
|
||||||
This core does not support an FPU at all
|
|
||||||
*/
|
|
||||||
#define __FPU_USED 0U
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#if defined __TARGET_FPU_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#if defined __ARM_PCS_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#if defined __ARMVFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#if defined __TI_VFP_SUPPORT__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#if defined __FPU_VFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#if ( __CSMC__ & 0x400U)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "core_cmInstr.h" /* Core Instruction Access */
|
|
||||||
#include "core_cmFunc.h" /* Core Function Access */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_CM0_H_GENERIC */
|
|
||||||
|
|
||||||
#ifndef __CMSIS_GENERIC
|
|
||||||
|
|
||||||
#ifndef __CORE_CM0_H_DEPENDANT
|
|
||||||
#define __CORE_CM0_H_DEPENDANT
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* check device defines and use defaults */
|
|
||||||
#if defined __CHECK_DEVICE_DEFINES
|
|
||||||
#ifndef __CM0_REV
|
|
||||||
#define __CM0_REV 0x0000U
|
|
||||||
#warning "__CM0_REV not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __NVIC_PRIO_BITS
|
|
||||||
#define __NVIC_PRIO_BITS 2U
|
|
||||||
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __Vendor_SysTickConfig
|
|
||||||
#define __Vendor_SysTickConfig 0U
|
|
||||||
#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* IO definitions (access restrictions to peripheral registers) */
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_glob_defs CMSIS Global Defines
|
|
||||||
|
|
||||||
<strong>IO Type Qualifiers</strong> are used
|
|
||||||
\li to specify the access to peripheral variables.
|
|
||||||
\li for automatic generation of peripheral register debug information.
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define __I volatile /*!< Defines 'read only' permissions */
|
|
||||||
#else
|
|
||||||
#define __I volatile const /*!< Defines 'read only' permissions */
|
|
||||||
#endif
|
|
||||||
#define __O volatile /*!< Defines 'write only' permissions */
|
|
||||||
#define __IO volatile /*!< Defines 'read / write' permissions */
|
|
||||||
|
|
||||||
/* following defines should be used for structure members */
|
|
||||||
#define __IM volatile const /*! Defines 'read only' structure member permissions */
|
|
||||||
#define __OM volatile /*! Defines 'write only' structure member permissions */
|
|
||||||
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
|
|
||||||
|
|
||||||
/*@} end of group Cortex_M0 */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Register Abstraction
|
|
||||||
Core Register contain:
|
|
||||||
- Core Register
|
|
||||||
- Core NVIC Register
|
|
||||||
- Core SCB Register
|
|
||||||
- Core SysTick Register
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_core_register Defines and Type Definitions
|
|
||||||
\brief Type definitions and defines for Cortex-M processor based devices.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CORE Status and Control Registers
|
|
||||||
\brief Core Register type definitions.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Application Program Status Register (APSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} APSR_Type;
|
|
||||||
|
|
||||||
/* APSR Register Definitions */
|
|
||||||
#define APSR_N_Pos 31U /*!< APSR: N Position */
|
|
||||||
#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
|
|
||||||
|
|
||||||
#define APSR_Z_Pos 30U /*!< APSR: Z Position */
|
|
||||||
#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
|
|
||||||
|
|
||||||
#define APSR_C_Pos 29U /*!< APSR: C Position */
|
|
||||||
#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
|
|
||||||
|
|
||||||
#define APSR_V_Pos 28U /*!< APSR: V Position */
|
|
||||||
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Interrupt Program Status Register (IPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} IPSR_Type;
|
|
||||||
|
|
||||||
/* IPSR Register Definitions */
|
|
||||||
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
|
|
||||||
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
|
||||||
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
|
||||||
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} xPSR_Type;
|
|
||||||
|
|
||||||
/* xPSR Register Definitions */
|
|
||||||
#define xPSR_N_Pos 31U /*!< xPSR: N Position */
|
|
||||||
#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
|
|
||||||
|
|
||||||
#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
|
|
||||||
#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
|
|
||||||
|
|
||||||
#define xPSR_C_Pos 29U /*!< xPSR: C Position */
|
|
||||||
#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
|
|
||||||
|
|
||||||
#define xPSR_V_Pos 28U /*!< xPSR: V Position */
|
|
||||||
#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
|
|
||||||
|
|
||||||
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
|
|
||||||
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
|
|
||||||
|
|
||||||
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
|
|
||||||
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Control Registers (CONTROL).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t _reserved0:1; /*!< bit: 0 Reserved */
|
|
||||||
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
|
||||||
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} CONTROL_Type;
|
|
||||||
|
|
||||||
/* CONTROL Register Definitions */
|
|
||||||
#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
|
|
||||||
#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_CORE */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
|
|
||||||
\brief Type definitions for the NVIC Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
|
||||||
uint32_t RESERVED0[31U];
|
|
||||||
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
|
||||||
uint32_t RSERVED1[31U];
|
|
||||||
__IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
|
||||||
uint32_t RESERVED2[31U];
|
|
||||||
__IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
|
||||||
uint32_t RESERVED3[31U];
|
|
||||||
uint32_t RESERVED4[64U];
|
|
||||||
__IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
|
||||||
} NVIC_Type;
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_NVIC */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SCB System Control Block (SCB)
|
|
||||||
\brief Type definitions for the System Control Block Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Control Block (SCB).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
|
||||||
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
|
||||||
uint32_t RESERVED0;
|
|
||||||
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
|
||||||
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
|
||||||
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
|
||||||
uint32_t RESERVED1;
|
|
||||||
__IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
|
||||||
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
|
||||||
} SCB_Type;
|
|
||||||
|
|
||||||
/* SCB CPUID Register Definitions */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
|
|
||||||
#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
|
|
||||||
#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
|
|
||||||
#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
|
|
||||||
|
|
||||||
/* SCB Interrupt Control State Register Definitions */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
|
|
||||||
#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
|
|
||||||
#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
|
|
||||||
#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
|
|
||||||
#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
|
|
||||||
|
|
||||||
/* SCB Application Interrupt and Reset Control Register Definitions */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
|
|
||||||
|
|
||||||
/* SCB System Control Register Definitions */
|
|
||||||
#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
|
|
||||||
#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
|
|
||||||
|
|
||||||
/* SCB Configuration Control Register Definitions */
|
|
||||||
#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
|
|
||||||
#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
|
|
||||||
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
|
|
||||||
|
|
||||||
/* SCB System Handler Control and State Register Definitions */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SCB */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
|
|
||||||
\brief Type definitions for the System Timer Registers.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Timer (SysTick).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
|
||||||
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
|
||||||
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
|
||||||
__IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
|
||||||
} SysTick_Type;
|
|
||||||
|
|
||||||
/* SysTick Control / Status Register Definitions */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
|
|
||||||
#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
|
|
||||||
#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
|
|
||||||
|
|
||||||
/* SysTick Reload Register Definitions */
|
|
||||||
#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
|
|
||||||
#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
|
|
||||||
|
|
||||||
/* SysTick Current Register Definitions */
|
|
||||||
#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
|
|
||||||
#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
|
|
||||||
|
|
||||||
/* SysTick Calibration Register Definitions */
|
|
||||||
#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
|
|
||||||
#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
|
|
||||||
#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
|
|
||||||
#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SysTick */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
|
|
||||||
\brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
|
|
||||||
Therefore they are not covered by the Cortex-M0 header file.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
/*@} end of group CMSIS_CoreDebug */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_bitfield Core register bit field macros
|
|
||||||
\brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a bit field value for use in a register bit range.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of the bit field.
|
|
||||||
\return Masked and shifted value.
|
|
||||||
*/
|
|
||||||
#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a register value to extract a bit filed value.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of register.
|
|
||||||
\return Masked and shifted bit field value.
|
|
||||||
*/
|
|
||||||
#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos)
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_core_bitfield */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_base Core Definitions
|
|
||||||
\brief Definitions for base addresses, unions, and structures.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Memory mapping of Cortex-M0 Hardware */
|
|
||||||
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
|
|
||||||
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
|
|
||||||
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
|
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
|
|
||||||
|
|
||||||
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
|
|
||||||
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
|
|
||||||
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
|
||||||
|
|
||||||
|
|
||||||
/*@} */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Hardware Abstraction Layer
|
|
||||||
Core Function Interface contains:
|
|
||||||
- Core NVIC Functions
|
|
||||||
- Core SysTick Functions
|
|
||||||
- Core Register Access Functions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################## NVIC functions #################################### */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_NVICFunctions NVIC Functions
|
|
||||||
\brief Functions that manage interrupts and exceptions via the NVIC.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Interrupt Priorities are WORD accessible only under ARMv6M */
|
|
||||||
/* The following MACROS handle generation of the register offset and byte masks */
|
|
||||||
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
|
|
||||||
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
|
|
||||||
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Enable External Interrupt
|
|
||||||
\details Enables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Disable External Interrupt
|
|
||||||
\details Disables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Pending Interrupt
|
|
||||||
\details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return 0 Interrupt status is not pending.
|
|
||||||
\return 1 Interrupt status is pending.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Pending Interrupt
|
|
||||||
\details Sets the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn Interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Clear Pending Interrupt
|
|
||||||
\details Clears the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Interrupt Priority
|
|
||||||
\details Sets the priority of an interrupt.
|
|
||||||
\note The priority cannot be set for every core interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\param [in] priority Priority to set.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|
||||||
{
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Interrupt Priority
|
|
||||||
\details Reads the priority of an interrupt.
|
|
||||||
The interrupt number can be positive to specify an external (device specific) interrupt,
|
|
||||||
or negative to specify an internal (core) interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return Interrupt Priority.
|
|
||||||
Value is aligned automatically to the implemented priority bits of the microcontroller.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Reset
|
|
||||||
\details Initiates a system reset request to reset the MCU.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SystemReset(void)
|
|
||||||
{
|
|
||||||
__DSB(); /* Ensure all outstanding memory accesses included
|
|
||||||
buffered write are completed before reset */
|
|
||||||
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
|
||||||
SCB_AIRCR_SYSRESETREQ_Msk);
|
|
||||||
__DSB(); /* Ensure completion of memory access */
|
|
||||||
|
|
||||||
for(;;) /* wait until reset */
|
|
||||||
{
|
|
||||||
__NOP();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_NVICFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ################################## SysTick function ############################################ */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_SysTickFunctions SysTick Functions
|
|
||||||
\brief Functions that configure the System.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__Vendor_SysTickConfig == 0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Tick Configuration
|
|
||||||
\details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
|
|
||||||
Counter is in free running mode to generate periodic interrupts.
|
|
||||||
\param [in] ticks Number of ticks between two interrupts.
|
|
||||||
\return 0 Function succeeded.
|
|
||||||
\return 1 Function failed.
|
|
||||||
\note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
|
|
||||||
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
|
|
||||||
must contain a vendor-specific implementation of this function.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
|
||||||
{
|
|
||||||
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
|
||||||
{
|
|
||||||
return (1UL); /* Reload value impossible */
|
|
||||||
}
|
|
||||||
|
|
||||||
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
|
||||||
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
|
||||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
|
||||||
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
|
||||||
SysTick_CTRL_TICKINT_Msk |
|
|
||||||
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
|
||||||
return (0UL); /* Function successful */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_SysTickFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_CM0_H_DEPENDANT */
|
|
||||||
|
|
||||||
#endif /* __CMSIS_GENERIC */
|
|
||||||
@@ -1,914 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_cm0plus.h
|
|
||||||
* @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_CM0PLUS_H_GENERIC
|
|
||||||
#define __CORE_CM0PLUS_H_GENERIC
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
\page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
|
|
||||||
CMSIS violates the following MISRA-C:2004 rules:
|
|
||||||
|
|
||||||
\li Required Rule 8.5, object/function definition in header file.<br>
|
|
||||||
Function definitions in header files are used to allow 'inlining'.
|
|
||||||
|
|
||||||
\li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
|
|
||||||
Unions are used for effective representation of core registers.
|
|
||||||
|
|
||||||
\li Advisory Rule 19.7, Function-like macro defined.<br>
|
|
||||||
Function-like macros are used to allow more efficient code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* CMSIS definitions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\ingroup Cortex-M0+
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* CMSIS CM0+ definitions */
|
|
||||||
#define __CM0PLUS_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */
|
|
||||||
#define __CM0PLUS_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */
|
|
||||||
#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \
|
|
||||||
__CM0PLUS_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
|
|
||||||
|
|
||||||
#define __CORTEX_M (0x00U) /*!< Cortex-M Core */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for IAR Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TI CCS Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#define __packed
|
|
||||||
#define __ASM _asm /*!< asm keyword for COSMIC Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Unknown compiler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** __FPU_USED indicates whether an FPU is used or not.
|
|
||||||
This core does not support an FPU at all
|
|
||||||
*/
|
|
||||||
#define __FPU_USED 0U
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#if defined __TARGET_FPU_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#if defined __ARM_PCS_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#if defined __ARMVFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#if defined __TI_VFP_SUPPORT__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#if defined __FPU_VFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#if ( __CSMC__ & 0x400U)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "core_cmInstr.h" /* Core Instruction Access */
|
|
||||||
#include "core_cmFunc.h" /* Core Function Access */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_CM0PLUS_H_GENERIC */
|
|
||||||
|
|
||||||
#ifndef __CMSIS_GENERIC
|
|
||||||
|
|
||||||
#ifndef __CORE_CM0PLUS_H_DEPENDANT
|
|
||||||
#define __CORE_CM0PLUS_H_DEPENDANT
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* check device defines and use defaults */
|
|
||||||
#if defined __CHECK_DEVICE_DEFINES
|
|
||||||
#ifndef __CM0PLUS_REV
|
|
||||||
#define __CM0PLUS_REV 0x0000U
|
|
||||||
#warning "__CM0PLUS_REV not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __MPU_PRESENT
|
|
||||||
#define __MPU_PRESENT 0U
|
|
||||||
#warning "__MPU_PRESENT not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __VTOR_PRESENT
|
|
||||||
#define __VTOR_PRESENT 0U
|
|
||||||
#warning "__VTOR_PRESENT not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __NVIC_PRIO_BITS
|
|
||||||
#define __NVIC_PRIO_BITS 2U
|
|
||||||
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __Vendor_SysTickConfig
|
|
||||||
#define __Vendor_SysTickConfig 0U
|
|
||||||
#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* IO definitions (access restrictions to peripheral registers) */
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_glob_defs CMSIS Global Defines
|
|
||||||
|
|
||||||
<strong>IO Type Qualifiers</strong> are used
|
|
||||||
\li to specify the access to peripheral variables.
|
|
||||||
\li for automatic generation of peripheral register debug information.
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define __I volatile /*!< Defines 'read only' permissions */
|
|
||||||
#else
|
|
||||||
#define __I volatile const /*!< Defines 'read only' permissions */
|
|
||||||
#endif
|
|
||||||
#define __O volatile /*!< Defines 'write only' permissions */
|
|
||||||
#define __IO volatile /*!< Defines 'read / write' permissions */
|
|
||||||
|
|
||||||
/* following defines should be used for structure members */
|
|
||||||
#define __IM volatile const /*! Defines 'read only' structure member permissions */
|
|
||||||
#define __OM volatile /*! Defines 'write only' structure member permissions */
|
|
||||||
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
|
|
||||||
|
|
||||||
/*@} end of group Cortex-M0+ */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Register Abstraction
|
|
||||||
Core Register contain:
|
|
||||||
- Core Register
|
|
||||||
- Core NVIC Register
|
|
||||||
- Core SCB Register
|
|
||||||
- Core SysTick Register
|
|
||||||
- Core MPU Register
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_core_register Defines and Type Definitions
|
|
||||||
\brief Type definitions and defines for Cortex-M processor based devices.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CORE Status and Control Registers
|
|
||||||
\brief Core Register type definitions.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Application Program Status Register (APSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} APSR_Type;
|
|
||||||
|
|
||||||
/* APSR Register Definitions */
|
|
||||||
#define APSR_N_Pos 31U /*!< APSR: N Position */
|
|
||||||
#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
|
|
||||||
|
|
||||||
#define APSR_Z_Pos 30U /*!< APSR: Z Position */
|
|
||||||
#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
|
|
||||||
|
|
||||||
#define APSR_C_Pos 29U /*!< APSR: C Position */
|
|
||||||
#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
|
|
||||||
|
|
||||||
#define APSR_V_Pos 28U /*!< APSR: V Position */
|
|
||||||
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Interrupt Program Status Register (IPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} IPSR_Type;
|
|
||||||
|
|
||||||
/* IPSR Register Definitions */
|
|
||||||
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
|
|
||||||
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
|
||||||
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
|
||||||
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} xPSR_Type;
|
|
||||||
|
|
||||||
/* xPSR Register Definitions */
|
|
||||||
#define xPSR_N_Pos 31U /*!< xPSR: N Position */
|
|
||||||
#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
|
|
||||||
|
|
||||||
#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
|
|
||||||
#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
|
|
||||||
|
|
||||||
#define xPSR_C_Pos 29U /*!< xPSR: C Position */
|
|
||||||
#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
|
|
||||||
|
|
||||||
#define xPSR_V_Pos 28U /*!< xPSR: V Position */
|
|
||||||
#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
|
|
||||||
|
|
||||||
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
|
|
||||||
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
|
|
||||||
|
|
||||||
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
|
|
||||||
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Control Registers (CONTROL).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
|
|
||||||
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
|
||||||
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} CONTROL_Type;
|
|
||||||
|
|
||||||
/* CONTROL Register Definitions */
|
|
||||||
#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
|
|
||||||
#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
|
|
||||||
|
|
||||||
#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
|
|
||||||
#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_CORE */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
|
|
||||||
\brief Type definitions for the NVIC Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
|
||||||
uint32_t RESERVED0[31U];
|
|
||||||
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
|
||||||
uint32_t RSERVED1[31U];
|
|
||||||
__IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
|
||||||
uint32_t RESERVED2[31U];
|
|
||||||
__IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
|
||||||
uint32_t RESERVED3[31U];
|
|
||||||
uint32_t RESERVED4[64U];
|
|
||||||
__IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
|
||||||
} NVIC_Type;
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_NVIC */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SCB System Control Block (SCB)
|
|
||||||
\brief Type definitions for the System Control Block Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Control Block (SCB).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
|
||||||
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
|
||||||
#if (__VTOR_PRESENT == 1U)
|
|
||||||
__IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
|
|
||||||
#else
|
|
||||||
uint32_t RESERVED0;
|
|
||||||
#endif
|
|
||||||
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
|
||||||
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
|
||||||
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
|
||||||
uint32_t RESERVED1;
|
|
||||||
__IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
|
||||||
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
|
||||||
} SCB_Type;
|
|
||||||
|
|
||||||
/* SCB CPUID Register Definitions */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
|
|
||||||
#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
|
|
||||||
#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
|
|
||||||
#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
|
|
||||||
|
|
||||||
/* SCB Interrupt Control State Register Definitions */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
|
|
||||||
#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
|
|
||||||
#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
|
|
||||||
#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
|
|
||||||
#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
|
|
||||||
|
|
||||||
#if (__VTOR_PRESENT == 1U)
|
|
||||||
/* SCB Interrupt Control State Register Definitions */
|
|
||||||
#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */
|
|
||||||
#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SCB Application Interrupt and Reset Control Register Definitions */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
|
|
||||||
|
|
||||||
/* SCB System Control Register Definitions */
|
|
||||||
#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
|
|
||||||
#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
|
|
||||||
|
|
||||||
/* SCB Configuration Control Register Definitions */
|
|
||||||
#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
|
|
||||||
#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
|
|
||||||
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
|
|
||||||
|
|
||||||
/* SCB System Handler Control and State Register Definitions */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SCB */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
|
|
||||||
\brief Type definitions for the System Timer Registers.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Timer (SysTick).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
|
||||||
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
|
||||||
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
|
||||||
__IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
|
||||||
} SysTick_Type;
|
|
||||||
|
|
||||||
/* SysTick Control / Status Register Definitions */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
|
|
||||||
#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
|
|
||||||
#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
|
|
||||||
|
|
||||||
/* SysTick Reload Register Definitions */
|
|
||||||
#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
|
|
||||||
#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
|
|
||||||
|
|
||||||
/* SysTick Current Register Definitions */
|
|
||||||
#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
|
|
||||||
#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
|
|
||||||
|
|
||||||
/* SysTick Calibration Register Definitions */
|
|
||||||
#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
|
|
||||||
#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
|
|
||||||
#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
|
|
||||||
#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SysTick */
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_MPU Memory Protection Unit (MPU)
|
|
||||||
\brief Type definitions for the Memory Protection Unit (MPU)
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the Memory Protection Unit (MPU).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
|
|
||||||
__IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
|
|
||||||
__IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
|
|
||||||
__IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
|
|
||||||
__IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
|
|
||||||
} MPU_Type;
|
|
||||||
|
|
||||||
/* MPU Type Register Definitions */
|
|
||||||
#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
|
|
||||||
#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
|
|
||||||
|
|
||||||
#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
|
|
||||||
#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
|
|
||||||
|
|
||||||
#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
|
|
||||||
#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
|
|
||||||
|
|
||||||
/* MPU Control Register Definitions */
|
|
||||||
#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
|
|
||||||
#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
|
|
||||||
|
|
||||||
#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
|
|
||||||
#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
|
|
||||||
|
|
||||||
#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
|
|
||||||
#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
|
|
||||||
|
|
||||||
/* MPU Region Number Register Definitions */
|
|
||||||
#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
|
|
||||||
#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
|
|
||||||
|
|
||||||
/* MPU Region Base Address Register Definitions */
|
|
||||||
#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
|
|
||||||
#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
|
|
||||||
|
|
||||||
#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
|
|
||||||
#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
|
|
||||||
|
|
||||||
#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
|
|
||||||
#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
|
|
||||||
|
|
||||||
/* MPU Region Attribute and Size Register Definitions */
|
|
||||||
#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
|
|
||||||
#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
|
|
||||||
#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
|
|
||||||
#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
|
|
||||||
#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
|
|
||||||
#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
|
|
||||||
#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
|
|
||||||
#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
|
|
||||||
#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
|
|
||||||
#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
|
|
||||||
#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_MPU */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
|
|
||||||
\brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
|
|
||||||
Therefore they are not covered by the Cortex-M0+ header file.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
/*@} end of group CMSIS_CoreDebug */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_bitfield Core register bit field macros
|
|
||||||
\brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a bit field value for use in a register bit range.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of the bit field.
|
|
||||||
\return Masked and shifted value.
|
|
||||||
*/
|
|
||||||
#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a register value to extract a bit filed value.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of register.
|
|
||||||
\return Masked and shifted bit field value.
|
|
||||||
*/
|
|
||||||
#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos)
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_core_bitfield */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_base Core Definitions
|
|
||||||
\brief Definitions for base addresses, unions, and structures.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Memory mapping of Cortex-M0+ Hardware */
|
|
||||||
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
|
|
||||||
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
|
|
||||||
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
|
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
|
|
||||||
|
|
||||||
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
|
|
||||||
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
|
|
||||||
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
|
|
||||||
#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Hardware Abstraction Layer
|
|
||||||
Core Function Interface contains:
|
|
||||||
- Core NVIC Functions
|
|
||||||
- Core SysTick Functions
|
|
||||||
- Core Register Access Functions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################## NVIC functions #################################### */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_NVICFunctions NVIC Functions
|
|
||||||
\brief Functions that manage interrupts and exceptions via the NVIC.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Interrupt Priorities are WORD accessible only under ARMv6M */
|
|
||||||
/* The following MACROS handle generation of the register offset and byte masks */
|
|
||||||
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
|
|
||||||
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
|
|
||||||
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Enable External Interrupt
|
|
||||||
\details Enables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Disable External Interrupt
|
|
||||||
\details Disables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Pending Interrupt
|
|
||||||
\details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return 0 Interrupt status is not pending.
|
|
||||||
\return 1 Interrupt status is pending.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Pending Interrupt
|
|
||||||
\details Sets the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn Interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Clear Pending Interrupt
|
|
||||||
\details Clears the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Interrupt Priority
|
|
||||||
\details Sets the priority of an interrupt.
|
|
||||||
\note The priority cannot be set for every core interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\param [in] priority Priority to set.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|
||||||
{
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Interrupt Priority
|
|
||||||
\details Reads the priority of an interrupt.
|
|
||||||
The interrupt number can be positive to specify an external (device specific) interrupt,
|
|
||||||
or negative to specify an internal (core) interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return Interrupt Priority.
|
|
||||||
Value is aligned automatically to the implemented priority bits of the microcontroller.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Reset
|
|
||||||
\details Initiates a system reset request to reset the MCU.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SystemReset(void)
|
|
||||||
{
|
|
||||||
__DSB(); /* Ensure all outstanding memory accesses included
|
|
||||||
buffered write are completed before reset */
|
|
||||||
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
|
||||||
SCB_AIRCR_SYSRESETREQ_Msk);
|
|
||||||
__DSB(); /* Ensure completion of memory access */
|
|
||||||
|
|
||||||
for(;;) /* wait until reset */
|
|
||||||
{
|
|
||||||
__NOP();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_NVICFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ################################## SysTick function ############################################ */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_SysTickFunctions SysTick Functions
|
|
||||||
\brief Functions that configure the System.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__Vendor_SysTickConfig == 0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Tick Configuration
|
|
||||||
\details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
|
|
||||||
Counter is in free running mode to generate periodic interrupts.
|
|
||||||
\param [in] ticks Number of ticks between two interrupts.
|
|
||||||
\return 0 Function succeeded.
|
|
||||||
\return 1 Function failed.
|
|
||||||
\note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
|
|
||||||
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
|
|
||||||
must contain a vendor-specific implementation of this function.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
|
||||||
{
|
|
||||||
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
|
||||||
{
|
|
||||||
return (1UL); /* Reload value impossible */
|
|
||||||
}
|
|
||||||
|
|
||||||
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
|
||||||
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
|
||||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
|
||||||
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
|
||||||
SysTick_CTRL_TICKINT_Msk |
|
|
||||||
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
|
||||||
return (0UL); /* Function successful */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_SysTickFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_CM0PLUS_H_DEPENDANT */
|
|
||||||
|
|
||||||
#endif /* __CMSIS_GENERIC */
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,87 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_cmFunc.h
|
|
||||||
* @brief CMSIS Cortex-M Core Function Access Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_CMFUNC_H
|
|
||||||
#define __CORE_CMFUNC_H
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################### Core Function Access ########################### */
|
|
||||||
/** \ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ RealView Compiler -----------------*/
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#include "cmsis_armcc.h"
|
|
||||||
|
|
||||||
/*------------------ ARM Compiler V6 -------------------*/
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#include "cmsis_armcc_V6.h"
|
|
||||||
|
|
||||||
/*------------------ GNU Compiler ----------------------*/
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#include "cmsis_gcc.h"
|
|
||||||
|
|
||||||
/*------------------ ICC Compiler ----------------------*/
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#include <cmsis_iar.h>
|
|
||||||
|
|
||||||
/*------------------ TI CCS Compiler -------------------*/
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#include <cmsis_ccs.h>
|
|
||||||
|
|
||||||
/*------------------ TASKING Compiler ------------------*/
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
/*
|
|
||||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
|
||||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
|
||||||
* Including the CMSIS ones.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ COSMIC Compiler -------------------*/
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#include <cmsis_csm.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_RegAccFunctions */
|
|
||||||
|
|
||||||
#endif /* __CORE_CMFUNC_H */
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_cmInstr.h
|
|
||||||
* @brief CMSIS Cortex-M Core Instruction Access Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_CMINSTR_H
|
|
||||||
#define __CORE_CMINSTR_H
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################## Core Instruction Access ######################### */
|
|
||||||
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
|
|
||||||
Access to dedicated instructions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ RealView Compiler -----------------*/
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#include "cmsis_armcc.h"
|
|
||||||
|
|
||||||
/*------------------ ARM Compiler V6 -------------------*/
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#include "cmsis_armcc_V6.h"
|
|
||||||
|
|
||||||
/*------------------ GNU Compiler ----------------------*/
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#include "cmsis_gcc.h"
|
|
||||||
|
|
||||||
/*------------------ ICC Compiler ----------------------*/
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#include <cmsis_iar.h>
|
|
||||||
|
|
||||||
/*------------------ TI CCS Compiler -------------------*/
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#include <cmsis_ccs.h>
|
|
||||||
|
|
||||||
/*------------------ TASKING Compiler ------------------*/
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
/*
|
|
||||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
|
||||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
|
||||||
* Including the CMSIS ones.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ COSMIC Compiler -------------------*/
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#include <cmsis_csm.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
|
|
||||||
|
|
||||||
#endif /* __CORE_CMINSTR_H */
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_cmSimd.h
|
|
||||||
* @brief CMSIS Cortex-M SIMD Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_CMSIMD_H
|
|
||||||
#define __CORE_CMSIMD_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ################### Compiler specific Intrinsics ########################### */
|
|
||||||
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
|
|
||||||
Access to dedicated SIMD instructions
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ RealView Compiler -----------------*/
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#include "cmsis_armcc.h"
|
|
||||||
|
|
||||||
/*------------------ ARM Compiler V6 -------------------*/
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#include "cmsis_armcc_V6.h"
|
|
||||||
|
|
||||||
/*------------------ GNU Compiler ----------------------*/
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#include "cmsis_gcc.h"
|
|
||||||
|
|
||||||
/*------------------ ICC Compiler ----------------------*/
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#include <cmsis_iar.h>
|
|
||||||
|
|
||||||
/*------------------ TI CCS Compiler -------------------*/
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#include <cmsis_ccs.h>
|
|
||||||
|
|
||||||
/*------------------ TASKING Compiler ------------------*/
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
/*
|
|
||||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
|
||||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
|
||||||
* Including the CMSIS ones.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*------------------ COSMIC Compiler -------------------*/
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#include <cmsis_csm.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SIMD_intrinsics */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_CMSIMD_H */
|
|
||||||
@@ -1,926 +0,0 @@
|
|||||||
/**************************************************************************//**
|
|
||||||
* @file core_sc000.h
|
|
||||||
* @brief CMSIS SC000 Core Peripheral Access Layer Header File
|
|
||||||
* @version V4.30
|
|
||||||
* @date 20. October 2015
|
|
||||||
******************************************************************************/
|
|
||||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of ARM nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
*
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
#pragma system_include /* treat file as system include file for MISRA check */
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#pragma clang system_header /* treat file as system include file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CORE_SC000_H_GENERIC
|
|
||||||
#define __CORE_SC000_H_GENERIC
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
\page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
|
|
||||||
CMSIS violates the following MISRA-C:2004 rules:
|
|
||||||
|
|
||||||
\li Required Rule 8.5, object/function definition in header file.<br>
|
|
||||||
Function definitions in header files are used to allow 'inlining'.
|
|
||||||
|
|
||||||
\li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
|
|
||||||
Unions are used for effective representation of core registers.
|
|
||||||
|
|
||||||
\li Advisory Rule 19.7, Function-like macro defined.<br>
|
|
||||||
Function-like macros are used to allow more efficient code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* CMSIS definitions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\ingroup SC000
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* CMSIS SC000 definitions */
|
|
||||||
#define __SC000_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */
|
|
||||||
#define __SC000_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */
|
|
||||||
#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
|
|
||||||
__SC000_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
|
|
||||||
|
|
||||||
#define __CORTEX_SC (000U) /*!< Cortex secure core */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
|
||||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
|
||||||
#define __STATIC_INLINE static __inline
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for IAR Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TI CCS Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#define __packed
|
|
||||||
#define __ASM _asm /*!< asm keyword for COSMIC Compiler */
|
|
||||||
#define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
|
|
||||||
#define __STATIC_INLINE static inline
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Unknown compiler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** __FPU_USED indicates whether an FPU is used or not.
|
|
||||||
This core does not support an FPU at all
|
|
||||||
*/
|
|
||||||
#define __FPU_USED 0U
|
|
||||||
|
|
||||||
#if defined ( __CC_ARM )
|
|
||||||
#if defined __TARGET_FPU_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
||||||
#if defined __ARM_PCS_VFP
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __GNUC__ )
|
|
||||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __ICCARM__ )
|
|
||||||
#if defined __ARMVFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TMS470__ )
|
|
||||||
#if defined __TI_VFP_SUPPORT__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __TASKING__ )
|
|
||||||
#if defined __FPU_VFP__
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined ( __CSMC__ )
|
|
||||||
#if ( __CSMC__ & 0x400U)
|
|
||||||
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "core_cmInstr.h" /* Core Instruction Access */
|
|
||||||
#include "core_cmFunc.h" /* Core Function Access */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_SC000_H_GENERIC */
|
|
||||||
|
|
||||||
#ifndef __CMSIS_GENERIC
|
|
||||||
|
|
||||||
#ifndef __CORE_SC000_H_DEPENDANT
|
|
||||||
#define __CORE_SC000_H_DEPENDANT
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* check device defines and use defaults */
|
|
||||||
#if defined __CHECK_DEVICE_DEFINES
|
|
||||||
#ifndef __SC000_REV
|
|
||||||
#define __SC000_REV 0x0000U
|
|
||||||
#warning "__SC000_REV not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __MPU_PRESENT
|
|
||||||
#define __MPU_PRESENT 0U
|
|
||||||
#warning "__MPU_PRESENT not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __NVIC_PRIO_BITS
|
|
||||||
#define __NVIC_PRIO_BITS 2U
|
|
||||||
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __Vendor_SysTickConfig
|
|
||||||
#define __Vendor_SysTickConfig 0U
|
|
||||||
#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* IO definitions (access restrictions to peripheral registers) */
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_glob_defs CMSIS Global Defines
|
|
||||||
|
|
||||||
<strong>IO Type Qualifiers</strong> are used
|
|
||||||
\li to specify the access to peripheral variables.
|
|
||||||
\li for automatic generation of peripheral register debug information.
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define __I volatile /*!< Defines 'read only' permissions */
|
|
||||||
#else
|
|
||||||
#define __I volatile const /*!< Defines 'read only' permissions */
|
|
||||||
#endif
|
|
||||||
#define __O volatile /*!< Defines 'write only' permissions */
|
|
||||||
#define __IO volatile /*!< Defines 'read / write' permissions */
|
|
||||||
|
|
||||||
/* following defines should be used for structure members */
|
|
||||||
#define __IM volatile const /*! Defines 'read only' structure member permissions */
|
|
||||||
#define __OM volatile /*! Defines 'write only' structure member permissions */
|
|
||||||
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
|
|
||||||
|
|
||||||
/*@} end of group SC000 */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Register Abstraction
|
|
||||||
Core Register contain:
|
|
||||||
- Core Register
|
|
||||||
- Core NVIC Register
|
|
||||||
- Core SCB Register
|
|
||||||
- Core SysTick Register
|
|
||||||
- Core MPU Register
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_core_register Defines and Type Definitions
|
|
||||||
\brief Type definitions and defines for Cortex-M processor based devices.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CORE Status and Control Registers
|
|
||||||
\brief Core Register type definitions.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Application Program Status Register (APSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} APSR_Type;
|
|
||||||
|
|
||||||
/* APSR Register Definitions */
|
|
||||||
#define APSR_N_Pos 31U /*!< APSR: N Position */
|
|
||||||
#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
|
|
||||||
|
|
||||||
#define APSR_Z_Pos 30U /*!< APSR: Z Position */
|
|
||||||
#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
|
|
||||||
|
|
||||||
#define APSR_C_Pos 29U /*!< APSR: C Position */
|
|
||||||
#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
|
|
||||||
|
|
||||||
#define APSR_V_Pos 28U /*!< APSR: V Position */
|
|
||||||
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Interrupt Program Status Register (IPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} IPSR_Type;
|
|
||||||
|
|
||||||
/* IPSR Register Definitions */
|
|
||||||
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
|
|
||||||
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
||||||
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
|
||||||
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
|
||||||
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
|
||||||
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
||||||
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
||||||
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
||||||
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} xPSR_Type;
|
|
||||||
|
|
||||||
/* xPSR Register Definitions */
|
|
||||||
#define xPSR_N_Pos 31U /*!< xPSR: N Position */
|
|
||||||
#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
|
|
||||||
|
|
||||||
#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
|
|
||||||
#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
|
|
||||||
|
|
||||||
#define xPSR_C_Pos 29U /*!< xPSR: C Position */
|
|
||||||
#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
|
|
||||||
|
|
||||||
#define xPSR_V_Pos 28U /*!< xPSR: V Position */
|
|
||||||
#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
|
|
||||||
|
|
||||||
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
|
|
||||||
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
|
|
||||||
|
|
||||||
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
|
|
||||||
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Union type to access the Control Registers (CONTROL).
|
|
||||||
*/
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint32_t _reserved0:1; /*!< bit: 0 Reserved */
|
|
||||||
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
|
||||||
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
|
||||||
} b; /*!< Structure used for bit access */
|
|
||||||
uint32_t w; /*!< Type used for word access */
|
|
||||||
} CONTROL_Type;
|
|
||||||
|
|
||||||
/* CONTROL Register Definitions */
|
|
||||||
#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
|
|
||||||
#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_CORE */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
|
|
||||||
\brief Type definitions for the NVIC Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
|
||||||
uint32_t RESERVED0[31U];
|
|
||||||
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
|
||||||
uint32_t RSERVED1[31U];
|
|
||||||
__IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
|
||||||
uint32_t RESERVED2[31U];
|
|
||||||
__IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
|
||||||
uint32_t RESERVED3[31U];
|
|
||||||
uint32_t RESERVED4[64U];
|
|
||||||
__IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
|
||||||
} NVIC_Type;
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_NVIC */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SCB System Control Block (SCB)
|
|
||||||
\brief Type definitions for the System Control Block Registers
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Control Block (SCB).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
|
||||||
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
|
||||||
__IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
|
|
||||||
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
|
||||||
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
|
||||||
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
|
||||||
uint32_t RESERVED0[1U];
|
|
||||||
__IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
|
||||||
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
|
||||||
uint32_t RESERVED1[154U];
|
|
||||||
__IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
|
|
||||||
} SCB_Type;
|
|
||||||
|
|
||||||
/* SCB CPUID Register Definitions */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
|
|
||||||
#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
|
|
||||||
#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
|
|
||||||
#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
|
|
||||||
#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
|
|
||||||
|
|
||||||
#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
|
|
||||||
#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
|
|
||||||
|
|
||||||
/* SCB Interrupt Control State Register Definitions */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
|
|
||||||
#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
|
|
||||||
#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
|
|
||||||
#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
|
|
||||||
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
|
|
||||||
#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
|
|
||||||
#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
|
|
||||||
#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
|
|
||||||
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
|
|
||||||
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
|
|
||||||
|
|
||||||
/* SCB Interrupt Control State Register Definitions */
|
|
||||||
#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
|
|
||||||
#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
|
|
||||||
|
|
||||||
/* SCB Application Interrupt and Reset Control Register Definitions */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
|
|
||||||
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
|
|
||||||
#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
|
|
||||||
#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
|
|
||||||
#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
|
|
||||||
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
|
|
||||||
#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
|
|
||||||
|
|
||||||
/* SCB System Control Register Definitions */
|
|
||||||
#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
|
|
||||||
#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
|
|
||||||
#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
|
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
|
|
||||||
#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
|
|
||||||
|
|
||||||
/* SCB Configuration Control Register Definitions */
|
|
||||||
#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
|
|
||||||
#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
|
|
||||||
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
|
|
||||||
#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
|
|
||||||
|
|
||||||
/* SCB System Handler Control and State Register Definitions */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
|
|
||||||
#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SCB */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
|
|
||||||
\brief Type definitions for the System Control and ID Register not in the SCB
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Control and ID Register not in the SCB.
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t RESERVED0[2U];
|
|
||||||
__IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
|
|
||||||
} SCnSCB_Type;
|
|
||||||
|
|
||||||
/* Auxiliary Control Register Definitions */
|
|
||||||
#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
|
|
||||||
#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SCnotSCB */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
|
|
||||||
\brief Type definitions for the System Timer Registers.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the System Timer (SysTick).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
|
||||||
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
|
||||||
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
|
||||||
__IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
|
||||||
} SysTick_Type;
|
|
||||||
|
|
||||||
/* SysTick Control / Status Register Definitions */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
|
|
||||||
#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
|
|
||||||
#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
|
|
||||||
#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
|
|
||||||
|
|
||||||
#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
|
|
||||||
#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
|
|
||||||
|
|
||||||
/* SysTick Reload Register Definitions */
|
|
||||||
#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
|
|
||||||
#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
|
|
||||||
|
|
||||||
/* SysTick Current Register Definitions */
|
|
||||||
#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
|
|
||||||
#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
|
|
||||||
|
|
||||||
/* SysTick Calibration Register Definitions */
|
|
||||||
#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
|
|
||||||
#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
|
|
||||||
#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
|
|
||||||
|
|
||||||
#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
|
|
||||||
#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_SysTick */
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_MPU Memory Protection Unit (MPU)
|
|
||||||
\brief Type definitions for the Memory Protection Unit (MPU)
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Structure type to access the Memory Protection Unit (MPU).
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
|
|
||||||
__IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
|
|
||||||
__IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
|
|
||||||
__IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
|
|
||||||
__IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
|
|
||||||
} MPU_Type;
|
|
||||||
|
|
||||||
/* MPU Type Register Definitions */
|
|
||||||
#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
|
|
||||||
#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
|
|
||||||
|
|
||||||
#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
|
|
||||||
#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
|
|
||||||
|
|
||||||
#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
|
|
||||||
#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
|
|
||||||
|
|
||||||
/* MPU Control Register Definitions */
|
|
||||||
#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
|
|
||||||
#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
|
|
||||||
|
|
||||||
#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
|
|
||||||
#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
|
|
||||||
|
|
||||||
#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
|
|
||||||
#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
|
|
||||||
|
|
||||||
/* MPU Region Number Register Definitions */
|
|
||||||
#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
|
|
||||||
#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
|
|
||||||
|
|
||||||
/* MPU Region Base Address Register Definitions */
|
|
||||||
#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
|
|
||||||
#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
|
|
||||||
|
|
||||||
#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
|
|
||||||
#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
|
|
||||||
|
|
||||||
#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
|
|
||||||
#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
|
|
||||||
|
|
||||||
/* MPU Region Attribute and Size Register Definitions */
|
|
||||||
#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
|
|
||||||
#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
|
|
||||||
#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
|
|
||||||
#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
|
|
||||||
#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
|
|
||||||
#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
|
|
||||||
#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
|
|
||||||
#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
|
|
||||||
#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
|
|
||||||
#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
|
|
||||||
|
|
||||||
#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
|
|
||||||
#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_MPU */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
|
|
||||||
\brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
|
|
||||||
Therefore they are not covered by the SC000 header file.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
/*@} end of group CMSIS_CoreDebug */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_bitfield Core register bit field macros
|
|
||||||
\brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a bit field value for use in a register bit range.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of the bit field.
|
|
||||||
\return Masked and shifted value.
|
|
||||||
*/
|
|
||||||
#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Mask and shift a register value to extract a bit filed value.
|
|
||||||
\param[in] field Name of the register bit field.
|
|
||||||
\param[in] value Value of register.
|
|
||||||
\return Masked and shifted bit field value.
|
|
||||||
*/
|
|
||||||
#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos)
|
|
||||||
|
|
||||||
/*@} end of group CMSIS_core_bitfield */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_core_register
|
|
||||||
\defgroup CMSIS_core_base Core Definitions
|
|
||||||
\brief Definitions for base addresses, unions, and structures.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Memory mapping of SC000 Hardware */
|
|
||||||
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
|
|
||||||
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
|
|
||||||
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
|
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
|
|
||||||
|
|
||||||
#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
|
|
||||||
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
|
|
||||||
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
|
|
||||||
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
|
||||||
|
|
||||||
#if (__MPU_PRESENT == 1U)
|
|
||||||
#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
|
|
||||||
#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Hardware Abstraction Layer
|
|
||||||
Core Function Interface contains:
|
|
||||||
- Core NVIC Functions
|
|
||||||
- Core SysTick Functions
|
|
||||||
- Core Register Access Functions
|
|
||||||
******************************************************************************/
|
|
||||||
/**
|
|
||||||
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ########################## NVIC functions #################################### */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_NVICFunctions NVIC Functions
|
|
||||||
\brief Functions that manage interrupts and exceptions via the NVIC.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Interrupt Priorities are WORD accessible only under ARMv6M */
|
|
||||||
/* The following MACROS handle generation of the register offset and byte masks */
|
|
||||||
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
|
|
||||||
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
|
|
||||||
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Enable External Interrupt
|
|
||||||
\details Enables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Disable External Interrupt
|
|
||||||
\details Disables a device-specific interrupt in the NVIC interrupt controller.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Pending Interrupt
|
|
||||||
\details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return 0 Interrupt status is not pending.
|
|
||||||
\return 1 Interrupt status is pending.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Pending Interrupt
|
|
||||||
\details Sets the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn Interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Clear Pending Interrupt
|
|
||||||
\details Clears the pending bit of an external interrupt.
|
|
||||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Set Interrupt Priority
|
|
||||||
\details Sets the priority of an interrupt.
|
|
||||||
\note The priority cannot be set for every core interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\param [in] priority Priority to set.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|
||||||
{
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
||||||
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Get Interrupt Priority
|
|
||||||
\details Reads the priority of an interrupt.
|
|
||||||
The interrupt number can be positive to specify an external (device specific) interrupt,
|
|
||||||
or negative to specify an internal (core) interrupt.
|
|
||||||
\param [in] IRQn Interrupt number.
|
|
||||||
\return Interrupt Priority.
|
|
||||||
Value is aligned automatically to the implemented priority bits of the microcontroller.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((int32_t)(IRQn) < 0)
|
|
||||||
{
|
|
||||||
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Reset
|
|
||||||
\details Initiates a system reset request to reset the MCU.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void NVIC_SystemReset(void)
|
|
||||||
{
|
|
||||||
__DSB(); /* Ensure all outstanding memory accesses included
|
|
||||||
buffered write are completed before reset */
|
|
||||||
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
|
||||||
SCB_AIRCR_SYSRESETREQ_Msk);
|
|
||||||
__DSB(); /* Ensure completion of memory access */
|
|
||||||
|
|
||||||
for(;;) /* wait until reset */
|
|
||||||
{
|
|
||||||
__NOP();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_NVICFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ################################## SysTick function ############################################ */
|
|
||||||
/**
|
|
||||||
\ingroup CMSIS_Core_FunctionInterface
|
|
||||||
\defgroup CMSIS_Core_SysTickFunctions SysTick Functions
|
|
||||||
\brief Functions that configure the System.
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (__Vendor_SysTickConfig == 0U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief System Tick Configuration
|
|
||||||
\details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
|
|
||||||
Counter is in free running mode to generate periodic interrupts.
|
|
||||||
\param [in] ticks Number of ticks between two interrupts.
|
|
||||||
\return 0 Function succeeded.
|
|
||||||
\return 1 Function failed.
|
|
||||||
\note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
|
|
||||||
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
|
|
||||||
must contain a vendor-specific implementation of this function.
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
|
||||||
{
|
|
||||||
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
|
||||||
{
|
|
||||||
return (1UL); /* Reload value impossible */
|
|
||||||
}
|
|
||||||
|
|
||||||
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
|
||||||
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
|
||||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
|
||||||
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
|
||||||
SysTick_CTRL_TICKINT_Msk |
|
|
||||||
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
|
||||||
return (0UL); /* Function successful */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@} end of CMSIS_Core_SysTickFunctions */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __CORE_SC000_H_DEPENDANT */
|
|
||||||
|
|
||||||
#endif /* __CMSIS_GENERIC */
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,271 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f4xx.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V2.6.1
|
|
||||||
* @date 14-February-2017
|
|
||||||
* @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
|
|
||||||
*
|
|
||||||
* The file is the unique include file that the application programmer
|
|
||||||
* is using in the C source code, usually in main.c. This file contains:
|
|
||||||
* - Configuration section that allows to select:
|
|
||||||
* - The STM32F4xx device used in the target application
|
|
||||||
* - To use or not the peripheral’s drivers in application code(i.e.
|
|
||||||
* code will be based on direct access to peripheral’s registers
|
|
||||||
* rather than drivers API), this option is controlled by
|
|
||||||
* "#define USE_HAL_DRIVER"
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CMSIS
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup stm32f4xx
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __STM32F4xx_H
|
|
||||||
#define __STM32F4xx_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
/** @addtogroup Library_configuration_section
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief STM32 Family
|
|
||||||
*/
|
|
||||||
#if !defined (STM32F4)
|
|
||||||
#define STM32F4
|
|
||||||
#endif /* STM32F4 */
|
|
||||||
|
|
||||||
/* Uncomment the line below according to the target STM32 device used in your
|
|
||||||
application
|
|
||||||
*/
|
|
||||||
#if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
|
|
||||||
!defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
|
|
||||||
!defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F410Tx) && !defined (STM32F410Cx) && \
|
|
||||||
!defined (STM32F410Rx) && !defined (STM32F411xE) && !defined (STM32F446xx) && !defined (STM32F469xx) && \
|
|
||||||
!defined (STM32F479xx) && !defined (STM32F412Cx) && !defined (STM32F412Rx) && !defined (STM32F412Vx) && \
|
|
||||||
!defined (STM32F412Zx) && !defined (STM32F413xx) && !defined (STM32F423xx)
|
|
||||||
/* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
|
|
||||||
/* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
|
|
||||||
/* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
|
|
||||||
/* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
|
|
||||||
/* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
|
|
||||||
/* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
|
|
||||||
/* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
|
|
||||||
STM32F439NI, STM32F429IG and STM32F429II Devices */
|
|
||||||
/* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
|
|
||||||
STM32F439NI, STM32F439IG and STM32F439II Devices */
|
|
||||||
/* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
|
|
||||||
/* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
|
|
||||||
/* #define STM32F410Tx */ /*!< STM32F410T8 and STM32F410TB Devices */
|
|
||||||
/* #define STM32F410Cx */ /*!< STM32F410C8 and STM32F410CB Devices */
|
|
||||||
/* #define STM32F410Rx */ /*!< STM32F410R8 and STM32F410RB Devices */
|
|
||||||
/* #define STM32F411xE */ /*!< STM32F411CC, STM32F411RC, STM32F411VC, STM32F411CE, STM32F411RE and STM32F411VE Devices */
|
|
||||||
/* #define STM32F446xx */ /*!< STM32F446MC, STM32F446ME, STM32F446RC, STM32F446RE, STM32F446VC, STM32F446VE, STM32F446ZC,
|
|
||||||
and STM32F446ZE Devices */
|
|
||||||
/* #define STM32F469xx */ /*!< STM32F469AI, STM32F469II, STM32F469BI, STM32F469NI, STM32F469AG, STM32F469IG, STM32F469BG,
|
|
||||||
STM32F469NG, STM32F469AE, STM32F469IE, STM32F469BE and STM32F469NE Devices */
|
|
||||||
/* #define STM32F479xx */ /*!< STM32F479AI, STM32F479II, STM32F479BI, STM32F479NI, STM32F479AG, STM32F479IG, STM32F479BG
|
|
||||||
and STM32F479NG Devices */
|
|
||||||
/* #define STM32F412Cx */ /*!< STM32F412CEU and STM32F412CGU Devices */
|
|
||||||
/* #define STM32F412Zx */ /*!< STM32F412ZET, STM32F412ZGT, STM32F412ZEJ and STM32F412ZGJ Devices */
|
|
||||||
/* #define STM32F412Vx */ /*!< STM32F412VET, STM32F412VGT, STM32F412VEH and STM32F412VGH Devices */
|
|
||||||
/* #define STM32F412Rx */ /*!< STM32F412RET, STM32F412RGT, STM32F412REY and STM32F412RGY Devices */
|
|
||||||
/* #define STM32F413xx */ /*!< STM32F413CH, STM32F413MH, STM32F413RH, STM32F413VH, STM32F413ZH, STM32F413CG, STM32F413MG,
|
|
||||||
STM32F413RG, STM32F413VG and STM32F413ZG Devices */
|
|
||||||
/* #define STM32F423xx */ /*!< STM32F423CH, STM32F423RH, STM32F423VH and STM32F423ZH Devices */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Tip: To avoid modifying this file each time you need to switch between these
|
|
||||||
devices, you can define the device in your toolchain compiler preprocessor.
|
|
||||||
*/
|
|
||||||
#if !defined (USE_HAL_DRIVER)
|
|
||||||
/**
|
|
||||||
* @brief Comment the line below if you will not use the peripherals drivers.
|
|
||||||
In this case, these drivers will not be included and the application code will
|
|
||||||
be based on direct access to peripherals registers
|
|
||||||
*/
|
|
||||||
/*#define USE_HAL_DRIVER */
|
|
||||||
#endif /* USE_HAL_DRIVER */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CMSIS version number V2.6.1
|
|
||||||
*/
|
|
||||||
#define __STM32F4xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
|
|
||||||
#define __STM32F4xx_CMSIS_VERSION_SUB1 (0x06U) /*!< [23:16] sub1 version */
|
|
||||||
#define __STM32F4xx_CMSIS_VERSION_SUB2 (0x01U) /*!< [15:8] sub2 version */
|
|
||||||
#define __STM32F4xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
|
||||||
#define __STM32F4xx_CMSIS_VERSION ((__STM32F4xx_CMSIS_VERSION_MAIN << 24)\
|
|
||||||
|(__STM32F4xx_CMSIS_VERSION_SUB1 << 16)\
|
|
||||||
|(__STM32F4xx_CMSIS_VERSION_SUB2 << 8 )\
|
|
||||||
|(__STM32F4xx_CMSIS_VERSION))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup Device_Included
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(STM32F405xx)
|
|
||||||
#include "stm32f405xx.h"
|
|
||||||
#elif defined(STM32F415xx)
|
|
||||||
#include "stm32f415xx.h"
|
|
||||||
#elif defined(STM32F407xx)
|
|
||||||
#include "stm32f407xx.h"
|
|
||||||
#elif defined(STM32F417xx)
|
|
||||||
#include "stm32f417xx.h"
|
|
||||||
#elif defined(STM32F427xx)
|
|
||||||
#include "stm32f427xx.h"
|
|
||||||
#elif defined(STM32F437xx)
|
|
||||||
#include "stm32f437xx.h"
|
|
||||||
#elif defined(STM32F429xx)
|
|
||||||
#include "stm32f429xx.h"
|
|
||||||
#elif defined(STM32F439xx)
|
|
||||||
#include "stm32f439xx.h"
|
|
||||||
#elif defined(STM32F401xC)
|
|
||||||
#include "stm32f401xc.h"
|
|
||||||
#elif defined(STM32F401xE)
|
|
||||||
#include "stm32f401xe.h"
|
|
||||||
#elif defined(STM32F410Tx)
|
|
||||||
#include "stm32f410tx.h"
|
|
||||||
#elif defined(STM32F410Cx)
|
|
||||||
#include "stm32f410cx.h"
|
|
||||||
#elif defined(STM32F410Rx)
|
|
||||||
#include "stm32f410rx.h"
|
|
||||||
#elif defined(STM32F411xE)
|
|
||||||
#include "stm32f411xe.h"
|
|
||||||
#elif defined(STM32F446xx)
|
|
||||||
#include "stm32f446xx.h"
|
|
||||||
#elif defined(STM32F469xx)
|
|
||||||
#include "stm32f469xx.h"
|
|
||||||
#elif defined(STM32F479xx)
|
|
||||||
#include "stm32f479xx.h"
|
|
||||||
#elif defined(STM32F412Cx)
|
|
||||||
#include "stm32f412cx.h"
|
|
||||||
#elif defined(STM32F412Zx)
|
|
||||||
#include "stm32f412zx.h"
|
|
||||||
#elif defined(STM32F412Rx)
|
|
||||||
#include "stm32f412rx.h"
|
|
||||||
#elif defined(STM32F412Vx)
|
|
||||||
#include "stm32f412vx.h"
|
|
||||||
#elif defined(STM32F413xx)
|
|
||||||
#include "stm32f413xx.h"
|
|
||||||
#elif defined(STM32F423xx)
|
|
||||||
#include "stm32f423xx.h"
|
|
||||||
#else
|
|
||||||
#error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup Exported_types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
RESET = 0U,
|
|
||||||
SET = !RESET
|
|
||||||
} FlagStatus, ITStatus;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
DISABLE = 0U,
|
|
||||||
ENABLE = !DISABLE
|
|
||||||
} FunctionalState;
|
|
||||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
ERROR = 0U,
|
|
||||||
SUCCESS = !ERROR
|
|
||||||
} ErrorStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup Exported_macro
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
|
|
||||||
|
|
||||||
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
|
|
||||||
|
|
||||||
#define READ_BIT(REG, BIT) ((REG) & (BIT))
|
|
||||||
|
|
||||||
#define CLEAR_REG(REG) ((REG) = (0x0))
|
|
||||||
|
|
||||||
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
|
|
||||||
|
|
||||||
#define READ_REG(REG) ((REG))
|
|
||||||
|
|
||||||
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
|
||||||
|
|
||||||
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined (USE_HAL_DRIVER)
|
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#endif /* USE_HAL_DRIVER */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* __STM32F4xx_H */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file system_stm32f4xx.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V2.6.1
|
|
||||||
* @date 14-February-2017
|
|
||||||
* @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CMSIS
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup stm32f4xx_system
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Define to prevent recursive inclusion
|
|
||||||
*/
|
|
||||||
#ifndef __SYSTEM_STM32F4XX_H
|
|
||||||
#define __SYSTEM_STM32F4XX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_System_Includes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_System_Exported_types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* This variable is updated in three ways:
|
|
||||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
|
||||||
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
|
|
||||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
|
||||||
Note: If you use this function to configure the system clock; then there
|
|
||||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
|
||||||
variable is updated automatically.
|
|
||||||
*/
|
|
||||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
|
||||||
|
|
||||||
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
|
|
||||||
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_System_Exported_Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_System_Exported_Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F4xx_System_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void SystemInit(void);
|
|
||||||
extern void SystemCoreClockUpdate(void);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__SYSTEM_STM32F4XX_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* File Name : main.h
|
|
||||||
* Description : This file contains the common defines of the application
|
|
||||||
******************************************************************************
|
|
||||||
* This notice applies to any and all portions of this file
|
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
|
||||||
* USER CODE END. Other portions of this file, whether
|
|
||||||
* inserted by the user or by software development tools
|
|
||||||
* are owned by their respective copyright owners.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
|
||||||
* contributors to this software may be used to endorse or promote products
|
|
||||||
* derived from this software without specific written permission.
|
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
|
||||||
* this license is void and will automatically terminate your rights under
|
|
||||||
* this license.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __MAIN_H
|
|
||||||
#define __MAIN_H
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define PWR1_Pin GPIO_PIN_2
|
|
||||||
#define PWR1_GPIO_Port GPIOH
|
|
||||||
#define PWR2_Pin GPIO_PIN_3
|
|
||||||
#define PWR2_GPIO_Port GPIOH
|
|
||||||
#define PWR3_Pin GPIO_PIN_4
|
|
||||||
#define PWR3_GPIO_Port GPIOH
|
|
||||||
#define PWR4_Pin GPIO_PIN_5
|
|
||||||
#define PWR4_GPIO_Port GPIOH
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
void _Error_Handler(char *, int);
|
|
||||||
|
|
||||||
#define Error_Handler() _Error_Handler(__FILE__, __LINE__)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* __MAIN_H */
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user