65 lines
1.7 KiB
C
65 lines
1.7 KiB
C
/*
|
|
* @Author : stark1898y 1658608470@qq.com
|
|
* @Date : 2024-08-29 13:44:16
|
|
* @LastEditors : stark1898y 1658608470@qq.com
|
|
* @LastEditTime : 2024-08-29 14:06:06
|
|
* @FilePath : \JT-DT-YD4N02A_RTT-Nano\bsp\inc\bsp_emv.h
|
|
* @Description :
|
|
*
|
|
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
|
*/
|
|
#ifndef __BSP_EMV__
|
|
#define __BSP_EMV__
|
|
|
|
#include "board.h"
|
|
#include "drv_gpio.h"
|
|
|
|
/*机械手引脚定义*/
|
|
#define MACHINE_HAND_SLEEP_PIN GET_PIN(A, 5) // 高电平进入正常工作状态
|
|
#define MACHINE_HAND_COIL_A_PIN GET_PIN(A, 6)
|
|
#define MACHINE_HAND_COIL_B_PIN GET_PIN(A, 7)
|
|
|
|
/*控制逻辑
|
|
A:1 B 0 SLEEP 1 正向
|
|
A:0 B 1 SLEEP 1 反向
|
|
A:1 B 1 SLEEP 1 停止
|
|
*/
|
|
|
|
/*正向*/
|
|
#define EMV_FORWARD_ON(x) do\
|
|
{\
|
|
rt_pin_write(MACHINE_HAND_SLEEP_PIN, PIN_HIGH);\
|
|
rt_pin_write(MACHINE_HAND_COIL_A_PIN, PIN_HIGH);\
|
|
rt_pin_write(MACHINE_HAND_COIL_B_PIN, PIN_LOW);\
|
|
rt_thread_mdelay(x);\
|
|
rt_pin_write(MACHINE_HAND_SLEEP_PIN, PIN_LOW);\
|
|
rt_pin_write(MACHINE_HAND_COIL_A_PIN, PIN_LOW);\
|
|
}\
|
|
while (0);
|
|
|
|
/*反向*/
|
|
#define EMV_BACKWARD_ON(x) do\
|
|
{\
|
|
rt_pin_write(MACHINE_HAND_SLEEP_PIN, PIN_HIGH);\
|
|
rt_pin_write(MACHINE_HAND_COIL_A_PIN, PIN_LOW);\
|
|
rt_pin_write(MACHINE_HAND_COIL_B_PIN, PIN_HIGH);\
|
|
rt_thread_mdelay(x);\
|
|
rt_pin_write(MACHINE_HAND_SLEEP_PIN, PIN_LOW);\
|
|
rt_pin_write(MACHINE_HAND_COIL_B_PIN, PIN_LOW);\
|
|
}\
|
|
while (0);
|
|
|
|
|
|
// #define EMV_PIN GET_PIN(B, 0)
|
|
|
|
// // 保持不动
|
|
// #define EMV_ON rt_pin_write(EMV_PIN, PIN_LOW)
|
|
// // 高电平 关闭电磁阀
|
|
// #define EMV_OFF rt_pin_write(EMV_PIN, PIN_HIGH)
|
|
|
|
// extern volatile rt_uint16_t emv_state_flag;
|
|
// int BSP_Set_Emv_Status(rt_bool_t status);
|
|
int BSP_EMV_Init(void);
|
|
|
|
#endif // !__BSP_EMV__
|