ARM1138@库函数速查
1. GPIO库函数
可实现的功能:
获得/设置指定管脚的方向(输入、输出)和模式(硬件控制)
获取/设置指定管脚的配置(驱动强度2/4/8/8_SCmA、管脚模式:推挽(弱上拉/弱下拉)/开漏(弱上拉/弱下拉)/模拟输入)
读取/写入管脚上值
——————————————
使能/关闭/清除相应管脚的中断
获取/设置管脚的中断类型(高电平、低电平、上升沿、下降沿、双边沿)
获取GPIO端口的中断状态(屏蔽的还是原始的中断状态)
注册/注销GPIO端口的一个中断处理程序
——————————————
配置管脚,使其作为(模数转换输入使用/一个CAN器件/一个模拟比较器的输入/GPIO输入/GPIO输出/GPIO开漏输出/供I2C外设使用/供PWM外设使用/供QEI外设使用/供SSI外设使用/供定时器外设使用/供UART外设使用/供USB外设使用 )
库函数声明结构:
unsigned long GPIODirModeGet (unsigned long ulPort, unsigned char ucPin);
void GPIODirModeSet (unsigned long ulPort, unsigned char ucPins,unsigned long ulPinIO);
void GPIOPadConfigGet (unsigned long ulPort, unsigned char ucPin, unsigned long*pulStrength, unsigned long *pulPinType);
void GPIOPadConfigSet (unsigned long ulPort, unsigned char ucPins,unsigned long ulStrength, unsigned long ulPinType);
long GPIOPinRead (unsigned long ulPort, unsigned char ucPins);
void GPIOPinWrite (unsigned long ulPort, unsigned char ucPins, unsigned char ucVal);
——————————————
void GPIOPinIntClear (unsigned long ulPort, unsigned char ucPins);
void GPIOPinIntDisable (unsigned long ulPort, unsigned char ucPins);
unsigned long GPIOIntTypeGet (unsigned long ulPort, unsigned char ucPin);
void GPIOIntTypeSet (unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType);
void GPIOPinIntEnable (unsigned long ulPort, unsigned char ucPins);
long GPIOPinIntStatus (unsigned long ulPort, tBoolean bMasked);
void GPIOPortIntRegister (unsigned long ulPort, void (*pfnIntHandler)(void));
void GPIOPortIntUnregister (unsigned long ulPort)
——————————————
void GPIOPinTypeADC (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeCAN (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeComparator (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeGPIOInput (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeGPIOOutput (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeGPIOOutputOD (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeI2C (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypePWM (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeQEI (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeSSI (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeTimer (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeUART (unsigned long ulPort, unsigned char ucPins);
void GPIOPinTypeUSBDigital (unsigned long ulPort, unsigned char ucPins);
int iVal;
//
// 注册端口级别的中断处理程序。对于所有管脚中断来说,这个处理程序是所有管脚中断的
// 第一级别的中断处理程序。
//
GPIOPortIntRegister(GPIO_PORTA_BASE, PortAIntHandler);
//
// 初始化GPIO管脚配置。
//
// 设置管脚2、 4和5作为输入,由软件控制。
//
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5);
//
// 设置管脚0和3作为输出,软件控制。
//
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_3);
//
// 使得在管脚2和4的上升沿触发中断。
//
GPIOIntTypeSet(GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_4),GPIO_RISING_EDGE);
//
// 使得在管脚5的高电平触发中断。
//
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_HIGH_LEVEL);
//
// 读取一些管脚。
//
iVal = GPIOPinRead(GPIO_PORTA_BASE, (GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 |GPIO_PIN_4 | GPIO_PIN_5));
//
// 写一些管脚。尽管管脚2、4和5被指定,它们也不受这个写操作的影响,因为它们配置用作输入。
// 在这个写操作结束时,管脚0的值将为0,管脚3的值将为1。
//
GPIOPinWrite(GPIO_PORTA_BASE, (GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 |GPIO_PIN_4 | GPIO_PIN_5), 0xF4);
//
// 使能管脚中断。
//
GPIOPinIntEnable(GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5));
2. Timer库函数 src/timer.c src/timer.h
实现的功能:
配置定时器(32 位单次触发定时器/32 位周期定时器/32 位实时时钟定时器/2 个 16 位的定时器/16 位的单次触发定时器/16 位的周期定时器/16 位的边沿计数捕获/16 位的边沿时间捕获/16 位 PWM 输出/TIMER_CFG_B_*值和 ulConfig 的逻辑或)
在捕获模式中触发定时器的信号沿(TIMER_EVENT_POS_EDGE 、TIMER_EVENT_NEG_EDGE 或 TIMER_EVENT_BOTH_EDGES)
设置指定定时器的 PWM 输出电平(Ture低电平,false高电平)
控制指定定时器的停止响应。如果 bStall 参数为 True,则定时器将在处理器进入调试模式时停止计数;否则,在调试模式中定时器将继续运行
控制指定定时器的触发输出。如果参数 bEnable 为 True,则使能定时器的输出触发;否则,禁止定时器的输出触发
使能/禁止定时器
清除指定的定时器中断源,使其不再有效。这必须在中断处理程序中处理,以防在退出时再次对其立即进行调用。
使能/禁止单个定时器中断源
注销/注册一个定时器中断的中断处理程序
获取当前的中断状态
设置/获取定时器装载值
设置/获取定时器匹配值
设置/获取定时器预分频器的值
禁止 RTC 计数
获取当前的定时器值
库函数声明结构:
void TimerConfigure (unsigned long ulBase, unsigned long ulConfig);
void TimerControlEvent (unsigned long ulBase, unsigned long ulTimer, unsigned long ulEvent);
ARM1138@库函数速查的更多相关文章
- CC254x/CC2540/CC2541库函数速查(转)
hci.h 转自:http://blog.csdn.net/xiaoleiacmer/article/details/44036607#t1 //分配内存,应用程序不应该调用这个函数. void *H ...
- HTML、CSS、JS、JQ速查笔记
一.HTML 1.编写html文件 a.格式 <!DOCTYPE html> <html> <head> <title>标题</title& ...
- Standard C 语言标准函数库速查(彩色的函数列表,十分清楚)
Standard C 语言标准函数库速查 (Cheat Sheet) wcstombs 函数说明 #include <stdlib.h> size_t mbstowcs(wchar_t * ...
- 常用的14种HTTP状态码速查手册
分类 1xx \> Information(信息) // 接收的请求正在处理 2xx \> Success(成功) // 请求正常处理完毕 3xx \> Redirection(重定 ...
- jQuery 常用速查
jQuery 速查 基础 $("css 选择器") 选择元素,创建jquery对象 $("html字符串") 创建jquery对象 $(callback) $( ...
- 简明 Git 命令速查表(中文版)
原文引用地址:https://github.com/flyhigher139/Git-Cheat-Sheet/blob/master/Git%20Cheat%20Sheet-Zh.md在Github上 ...
- 《zw版·Halcon-delphi系列原创教程》 zw版-Halcon常用函数Top100中文速查手册
<zw版·Halcon-delphi系列原创教程> zw版-Halcon常用函数Top100中文速查手册 Halcon函数库非常庞大,v11版有1900多个算子(函数). 这个Top版,对 ...
- .htaccess下Flags速查表
Flags是可选参数,当有多个标志同时出现时,彼此间以逗号分隔. 速查表: RewirteRule 标记 含义 描述 R Redirect 发出一个HTTP重定向 F Forbidden 禁止对URL ...
- IL指令速查
名称 说明 Add 将两个值相加并将结果推送到计算堆栈上. Add.Ovf 将两个整数相加,执行溢出检查,并且将结果推送到计算堆栈上. Add.Ovf.Un 将两个无符号整数值相加,执行溢出检查,并且 ...
随机推荐
- Xp 消息队列的使用
1.安装消息队列3.0: 控制面板/添加删除程序/添加window组件/找到消息队列/选择->详细信息->MSMQ HTTP支持. 注意:如果计算机没有连接到域需要去掉Active Dir ...
- php 未配置curl
用到PHP的curl功能,发现服务器上的PHP并没有配置curl,进而查询PHP官方文档,得知编译PHP时需要带上 –with-curl参数,才能把curl模块编译进去.我现在PHP已经编译安装进服务 ...
- MongoDB C#驱动中Query几个方法 (转)
Query.All("name", "a", "b");//通过多个元素来匹配数组 Query.And(Query.EQ("nam ...
- IIS6的session丢失问题
解决办法: a IIS6中相比IIS5增加了一个应用程序池,默认是使用DefaultAppPool. b 先为站点建立一个应用程序池,打开IIS管理器,右键点击应用程序池-新建 ...
- N个元素组成二叉树的种类
<算法>中的二叉查找树一节的一道习题. N个元素组成的二叉树固定一个根节点,这个根节点的左右子树组合数为(0,n-1),(1,n-2),(2,n-3)...(n-1,0),假设N个元素组成 ...
- UVA1476 三分法
单峰函数(即先递增后递减,有极大值的函数),都可以用三分法来求 #include <iostream> #include <cmath> #include <cstdio ...
- jqGrid详解及高级应用(十四)
一:jqGrid 是一个用来显示网格数据的jQuery插件,文档比较全面,附带中文版本. 二:官方主页http://www.jqgrid.com/目前最新版本:jqGrid 3.7 Beta在线文档 ...
- Redis - 介绍及安装
Redis属于key-value数据库,与传统的数据库存在很大区别,Redis以命令的方式代替了复杂的SQL语句,并且属于内存库性质,所以运行速度非常快.内存数据会生成数据库文件保证数据持久化. Re ...
- 简单的多线程(活用OD解决运行时错误)
代码源自<VC++深入详解>第15章 “多线程”,位于第563页 - 566 页. 程序的目的是展示多线程运行的效果: #include <windows.h> #includ ...
- HDU2222 (AC自动机)
AC自动机模板题. 被卡内存了 死活A不掉.. AC自动机参考教程: http://www.cppblog.com/menjitianya/archive/2014/07/10/207604.html ...