#include "main.h"
#include "thread.h"
#include "GPIO.H"
#include "DR70X.h"
#include "Drive_time.h"
#include "drive_spi.h"
void delay(uint16_t n)
{
uint32_t i = 25;
while(i --);
}
void DR70x_Init(void)
{
SLEEP_LOW;
delay(1000);
SLEEP_HIGH; //nSleep high to power on DR70xQ
MODE_LOW; //Control Interface: Mode_0: PH/EN; Mode_1:Independent PWM Control Interface; Mode_2 Hiz: Standard PWM
TimePwm.Instance = 14;//PC12 IN2_EN
TimePwm.Period = 0x5dc0;
TimePwm.Pulse = 0x32;
Timex_Init(TimePwm.Instance);//24khz 50%pulse
TimePwm.Instance = 16;//PB8 IN1_PH
Timex_Init(TimePwm.Instance);//24khz
}
/*Mode_0: Take PH/EN control (MODE_LOW) as an example. other mode, pleaes refer to Table 14/15 in datasheet*/
//////////////////////////////////////////////////////
void DR70x_Mode0_Brake(void)
{
TimePwm.Instance = 16;//PC12 IN2_EN
TimePwm.Pulse = 0;
Timex_Start(TimePwm.Instance);
}
void DR70x_Mode0_Reverse(uint8_t pulse)
{
TimePwm.Instance = 14;//PB8 IN1_EN
TimePwm.Pulse = 0;
Timex_Start(TimePwm.Instance);
TimePwm.Instance = 16;//PC12 IN2_EN
TimePwm.Pulse = pulse;
Timex_Start(TimePwm.Instance);
}
void DR70x_Mode0_Forward(uint8_t pulse)
{
TimePwm.Instance = 14;//PB8 IN1_EN
TimePwm.Pulse = 100;
Timex_Start(TimePwm.Instance);
TimePwm.Instance = 16;//PC12 IN2_EN
TimePwm.Pulse = pulse;
Timex_Start(TimePwm.Instance);
}
//////////////////////////////////////////////////////
void DR70x_Transmit(uint8_t addess, uint8_t data)
{
uint8_t buff[2] = {0,0},buff1[2];
buff[0] = (addess << 3);
buff[1] = data;
DR703_SPI_TransmitReceive(buff,buff1,2);
}
uint8_t DR70x_Recive(uint8_t addess)
{
uint8_t buff[2] = {0,0},buff1[2];
buff[0] = (addess << 3) + 0x80;
DR703_SPI_TransmitReceive(buff,buff1,2);
return buff1[1];
}
类比半导体DR703驱动
需积分: 0 151 浏览量
2024-03-21
09:45:40
上传
评论
收藏 2KB ZIP 举报
许同
- 粉丝: 572
- 资源: 21
最新资源
- Screenshot_2024_0531_203438.png
- 旋转相册,上传图片替换即可使用
- 基于单通道脑电信号的自动睡眠分期研究python源码+使用说明+模型+数据(高分项目)
- 使用STM32实现对多个步进电机的位置自由控制,可使用编码器、函数等控制步进电机
- 基于宏晶STC单片机开发ISP程序Demo-使用Y-Modem协议软件源码+文档说明资料.zip
- 基于Vue+Echarts开发的风力发电机中传感器的数据展示监控
- 新普_软包电池_三是调试工程05301.zip
- 基于python遥感毕业设计TOA深度学习反演PM2.5源码+文档说明(高分项目)
- 基于stc8A系列单片机和ov7670模块制作的人脸识别系统
- 基于python的系统设计与实现博客系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈