TDC-GP22(SSP1922)高精度时间测量

SSP1922头文件

#ifndef _SSP1922_H_
#define _SSP1922_H_

#include "gd32f3x0_gpio.h"
#include "systick.h"
//#include "core_cmInstr.h"

extern uint8_t ALU_INT_FLAG;
//extern uint8_t	count;

	//TDC_RST	--	PA1
	//SPI_SCLK	--	PA5
	//SPI_MOSI	--	PA7	
	
	//SPI_CS	--	PB0
	//EN_START	--	PB3		//START信号使能	
	
	//TDC_INTN	--	PA3		//ALU计算中断输入
	//SPI_MISO	--	PA6	 	//SPI数据输入
#define TDC_RST_H		gpio_bit_set(GPIOA, GPIO_PIN_1)
#define TDC_RST_L		gpio_bit_reset(GPIOA, GPIO_PIN_1)

#define SPI_SCLK_H		gpio_bit_set(GPIOA, GPIO_PIN_5)
#define SPI_SCLK_L		gpio_bit_reset(GPIOA, GPIO_PIN_5)

#define SPI_MOSI_H		gpio_bit_set(GPIOA, GPIO_PIN_7)
#define SPI_MOSI_L		gpio_bit_reset(GPIOA, GPIO_PIN_7)

#define SPI_CS_H		gpio_bit_set(GPIOB, GPIO_PIN_0)	
#define SPI_CS_L		gpio_bit_reset(GPIOB, GPIO_PIN_0)

#define EN_START_H		gpio_bit_set(GPIOB, GPIO_PIN_3)
#define EN_START_L		gpio_bit_reset(GPIOB, GPIO_PIN_3)

#define SPI_MISO_IN		gpio_input_bit_get(GPIOA, GPIO_PIN_6)


#define Init()					Write_Order(0x70)
#define Power_on_Reset()		Write_Order(0X50)
#define Start_TOF()				Write_Order(0X01)
#define Start_Temp()			Write_Order(0X02)
#define Start_Cal_Resonator()	Write_Order(0X03)
#define Start_Cal_TDC()			Write_Order(0X04)
#define Start_TOF_Restart()		Write_Order(0X05)
#define Start_Temp_Restart()	Write_Order(0X06)

void GPIO_Config(void);
void RST_TDC(void);
void SPI_Init(void);
void SPI_ENABLE(void);
void SPI_DISABLE(void);
void SEND_0(void);
void SEND_1(void);
void SPI_WRITE8(uint8_t wbuf8);
uint8_t SPI_READ8(void);
void SPI_WRITE32(uint32_t wbuf32);
uint32_t SPI_READ32(void);
uint16_t SPI_READ16(void);
void Write_Reg(uint8_t RegNum,uint32_t RegData);
uint32_t Read_Reg(uint8_t RegNum);
uint16_t Rea
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值