资源简介
ti ads7142驱动程序,调通可用,只需在.h头文件里修改对应引脚即可 资料包括ads7142数据手册

代码片段和文件信息
#include “ads7142.h“
#include “bsp.h“
#include “adsxx.h“
/*
static void DelayNus(uint32_t N)
{
uint8_t i;
do{
for(i=6;i>0;i--) //8MHZ:=7; 12MHZ:=11
;
}while(--N);
}
*/
/**
* @brief IIC Init
* @param None
* @retval None
*/
static void ads7142_gpio_init(void)
{
ADS7142_SDA_SET_OUT();
ADS7142_SCL_SET();
ADS7142_BSY_SET();
ADS7142_CLK_SET();
}
/**
* @brief Set SDA Pin as Output Mode
* @param None
* @retval None
*/
static void SDA_OUT(void)
{
ADS7142_SDA_SET_OUT();
}
/**
* @brief Set SDA Pin as Input Mode
* @param None
* @retval None
*/
static void SDA_IN()
{
ADS7142_SDA_SET_IN();
}
/**
* @brief create start signal
* @param None
* @retval 1 or 0
*/
static uint8_t IIC_Start(void)
{
SDA_OUT(); //sda output
SDA_H;
SCL_H;
DelayNus(6);
if(!SDA_read)
{
return 0;
}
SDA_L;
DelayNus(6);
if(SDA_read)
{
return 0;
}
SDA_L;
DelayNus(6);
return 1;
}
/**
* @brief Simulate IIC conmunication : Create Stop signal
* @param None
* @retval None
*/
static void IIC_Stop(void)
{
SCL_L;
SDA_OUT(); //sda output mode
DelayNus(6);
SDA_L;
DelayNus(6);
SCL_H;
DelayNus(6);
SDA_H;
DelayNus(6);
}
/**
* @brief Simulate IIC conmunication : wait for target device‘s ACK
* @param None
* @retval ACK (1) : receive success
* NACK(0) : receive unsuccess
*/
static uint8_t IIC_WaitAck(void)
{
uint8_t err_time = 0;
SCL_L;
SDA_IN(); //set as input mode
DelayNus(6);
SDA_H;
DelayNus(6);
SCL_H;
DelayNus(6);
while(SDA_read)
{
err_time++;
if (err_time > 250)
{
return 0;
}
}
SCL_L;
return 1;
}
/**
* @brief Simulate IIC conmunication : make an ACK
* @param None
* @retval None
*/
static void IIC_Ack(void)
{
SCL_L;
SDA_OUT();
DelayNus(6);
SDA_L;
DelayNus(6);
SCL_H;
DelayNus(6);
SCL_L;
DelayNus(6);
}
/**
* @brief Simulate IIC conmunication : don‘t make an ACK
* @retval None
*/
static void IIC_NoAck(void)
{
SCL_L;
SDA_OUT();
DelayNus(6);
SDA_H;
DelayNus(6);
SCL_H;
DelayNus(6);
SCL_L;
DelayNus(6);
}
/**
* @brief Simulate IIC conmunication : Transmit one byte Data
* @param SendByte: data to be transmit
* @retval None
*/
static void IIC_SendByte(uint8_t SendByte)
{
uint8_t i=8;
SDA_OUT();
while(i--)
{
SCL_L;
DelayNus(6);
if(SendByte&0x80)
SDA_H;
else
SDA_L;
SendByte <<= 1;
DelayNus(6);
SCL_H;
DelayNus(6);
}
SCL_L;
}
/**
* @brief Simulate IIC conmunication : Receive one byte Data
* @param ack ->Whether transm
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9949 2018-09-06 15:39 ads7142\ads7142.c
文件 21466 2018-09-06 15:47 ads7142\ads7142.h
文件 2008363 2018-09-06 14:16 ads7142\ads7142.pdf
目录 0 2018-11-01 17:42 ads7142\
- 上一篇:h264编码流程概述
- 下一篇:2019年aws的sap专业架构师考试题库英文版
相关资源
- 实验三 消息中间件应用开发:Active
- AsyncTask文件控制暂停和继续,在状态
- SpringBoot+H2+mybatis-plus59130
- Rational Rose Common破解文件
- umeshmotion网格推移
- Wolfram Mathematica 矩阵初等变换函数(
- 基本放大电路multisim仿真.ms14
-
Actionsc
ript 1.0实现能跟随鼠标运动的 - CCS5.05.1可使用的license
- TI CCS V5.4 安装步骤及破解文件
- 由浅入深,蓝牙4.0/BLE协议栈开发攻略
- The direction of synaptic plasticity mediated
- Reparatory Effects of Nicotine on NMDA Recepto
- Apolipoprotein E4 Impairs in vivo Hippocampal
- Histamine excites rat lateral vestibular nucle
- Diltiazem augmented pentobarbital-induced LORR
- LenovoTinkPad; Marker 5.01
- Fabrication and all-optical poling characteris
- Rtx51_tiny_RTOS中文版.pdf
- porting.RTEMS移植指南.双语.V20131224.pdf
- mybatis连接oracle实例
- adams vibration 练习原文件
-
开源tinyxm
l - 一个测试报告的模板,有点用
- VESA Computer Display Monitor Timing (DMT)
- 画图程序MFC/VC/VC CRectTracker 串行化
- Tone-Reservation
- 可编辑的CListctrl 支持CEDIT文本框,C
- Multisim 10 阶梯波电路
- jdbcTemplate分页彻底解决,使用游标滚
评论
共有 条评论