This repository has been archived on 2025-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
torsion/User/board/board.h

45 lines
996 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __BOARD_H__
#define __BOARD_H__
#include "main.h"
#include "adcs.h"
#include "uarts.h"
#define UART_RXSIZE (240u) // 接收240个字节
#define UART_TXSIZE (240u) // 发送240个字节
#define PULSE_REV (18000.0 * 5) /* 每圈脉冲数 */
#define MAX_STEP_ANGLE (360 / PULSE_REV) /* 最小步距(360/PULSE_REV) */
#define ANGLE 180 // 步进电机180度转盘转动1度
typedef enum
{
UART_NUM_1,
UART_NUM_2,
UART_NUM_3,
UART_NUM_4,
UART_NUM_5,
UART_NUM_MAX,
} uart_num_e;
typedef enum
{
MOTOR_IDEL,
MOTOR_RUN,
MOTOR_STOP,
MOTOR_STEP,
} motor_process_t;
typedef struct
{
uint8_t dir;
float32 angle;
} motor_ctrl_t;
extern void board_init(void);
extern void motor_process_init(void);
extern void motor_process(void);
extern float32 torsion_detect(uint16_t adc);
extern float32 pressure_detect(uint16_t adc);
extern float32 flow_detect(uint16_t adc);
#endif // __BOARD_H__