当前位置:网站首页>[Bit band operation to register assignment] GPIO multiplexing mode initialization based on ADuCM4050
[Bit band operation to register assignment] GPIO multiplexing mode initialization based on ADuCM4050
2022-08-07 09:32:00 【NetEase Exclusive Musician Mike Zhou】
【A ribbon gymnastics against the register assignment】基于ADuCM4050的GPIOMultiplexing mode initialization
#define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bitnum<<2))
#define MEM_ADDR(addr) *((volatile unsigned long *)(addr))
#define BIT_ADDR(addr, bitnum) MEM_ADDR(BITBAND(addr, bitnum))
#define GPIO0_MUL_Addr (ADI_GPIO0_BASE+0) //0x40020000
#define P0_M(n) BIT_ADDR(GPIO0_MUL_Addr,n)
#define GPIO1_MUL_Addr (ADI_GPIO1_BASE+0) //0x40020000
#define P1_M(n) BIT_ADDR(GPIO1_MUL_Addr,n)
#define GPIO2_MUL_Addr (ADI_GPIO2_BASE+0) //0x40020000
#define P2_M(n) BIT_ADDR(GPIO2_MUL_Addr,n)
#define GPIO3_MUL_Addr (ADI_GPIO3_BASE+0) //0x40020000
#define P3_M(n) BIT_ADDR(GPIO3_MUL_Addr,n)
void mux_GPIO(uint8_t ports,uint8_t pins,uint8_t mux)
{
uint8_t a,b;
a = pins*2-1;
b = pins*2;
uint8_t c,d;
c=mux>>1;
c=0x01 & c;
d=0x01 & mux;
if(ports == 0)
{
P0_M(a) = c;
P0_M(b) = d;
}
else if(ports == 1)
{
P1_M(a) = c;
P1_M(b) = d;
}
else if(ports == 2)
{
P2_M(a) = c;
P2_M(b) = d;
}
else if(ports == 3)
{
P3_M(a) = c;
P3_M(b) = d;
}
else{
}
}
边栏推荐
- MASA Stack 第三期社区例会
- LVS+Keepalived高可用群集部署
- MES生产管理系统是什么?有ERP系统了为什么还要上
- What is MES production management system? Why do we need to use ERP system?
- 解决typora的文件内容复制到csdn上图片显示不出来的问题
- openharmony new contribution guide
- [Image classification] 2022-RepLKNet CVPR 31x31 convolution to understand
- LeetCode #100. 相同的树
- 关于常用构建工具的一些总结
- 隐式类型转换问题(c语言)
猜你喜欢

redis的原理和源码-事件机制的介绍和源码解析(eventloop、fileevent、timeevent)
![#yyds Dry Goods Inventory# [Yugong Series] August 2022 Go Teaching Course 004-Go Code Comments](/img/0e/a9e2757b0108621917f43d03ee9c26.png)
#yyds Dry Goods Inventory# [Yugong Series] August 2022 Go Teaching Course 004-Go Code Comments

微突发丢包的艺术

Unity 3D 游戏通用系统设置页面,自定义按键设置,背景虚化,图像设置,亮度对比度饱和度音量调节,分辨率窗口化,帧率垂直同步,抗锯齿,阴影质量,纹理质量设置

The baud rate of STM32 is wrong. The baud rate we want to set is 9600, but the actual baud rate is 14400. Why is this?

leetcode 27. 移除元素

360企业安全云亮相2022全球数字经济大会 夯实中小微企业数字化底座
![[Image classification] 2022-RepLKNet CVPR 31x31 convolution to understand](/img/40/7b5183d51f05800dce872d031b42c3.png)
[Image classification] 2022-RepLKNet CVPR 31x31 convolution to understand
![[C language] Tower of Hanoi](/img/4a/331a88cf1d21b3aed537883940d3d6.png)
[C language] Tower of Hanoi
![[Punctuality Atom STM32 Serial] Chapter 5 Introduction to STM32 Basics Excerpted from [Punctuality Atom] MiniPro STM32H750 Development Guide_V1.1](/img/04/96eab9886e767f23a060256b254db8.png)
[Punctuality Atom STM32 Serial] Chapter 5 Introduction to STM32 Basics Excerpted from [Punctuality Atom] MiniPro STM32H750 Development Guide_V1.1
随机推荐
Addition, deletion, search and modification of doubly linked list
pytorch中的优化器
4.2 实现注册与登录模块
今天的思考
Assignment of major and minor device numbers for character devices
[Punctuality Atom STM32 Serial] Chapter 7 Understanding the HAL Library Excerpted from [Punctual Atom] MiniPro STM32H750 Development Guide_V1.1
【NPM使用相关】NPM 源设置
STM32出现波特率不对问题,我们要设定的波特率是9600,而实际的波特率竟然是14400,这是为什么呢?
Selection sort (simple selection sort and heap sort)
数组的创建以及常见的方法
关于在物联网公司实习这几天的收获
二分查找(搜索区间为左闭右开)
基于密码芯片的 DDR 加速器的设计与实现
为了高性能、超大规模的模型训练,这个组合“出道”了
[Punctuality Atom STM32 Serial] Chapter 6 New Register Version MDK Project Excerpted from [Punctual Atom] MiniPro STM32H750 Development Guide_V1.1
LeetCode #94.二叉树的中序遍历
【C语言】汉诺塔
归并排序(2路归并排序)
今日睡眠质量记录74分
Solve the problem that the file content of typora is copied to csdn and the picture cannot be displayed