123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /*
- * @Description:
- * @version:
- * @Author: Joe
- * @Date: 2021-11-13 21:55:17
- * @LastEditTime: 2021-11-13 21:55:18
- */
- #ifndef __KINCO_H__
- #define __KINCO_H__
- #include <rtthread.h>
- #include <rtdevice.h>
- #include <board.h>
- #define SEND_ADCC_EN
- #define SEND_MODE_EN
- #define SEND_RPM_EN
- typedef struct
- {
- uint8_t mode; /*电机模式*/
- uint16_t err; /*故障*/
- int16_t rpm; /*转速*/
- uint32_t id; /*电机id*/
- uint8_t control; /*电机控制字*/
-
- uint8_t acc :1; /*设置好加减速*/
- uint8_t dcc :1; /*设置好加减速*/
- uint8_t :4;
- } MOTOR_TypeDef;
- #if defined SEND_ADCC_EN
- uint8_t get_motor_acc(void);
- uint8_t get_motor_dcc(void);
- struct rt_can_msg send_motor_acc(void);
- struct rt_can_msg send_motor_dcc(void);
- #endif /* SEND_ADCC_EN */
- #if defined SEND_MODE_EN
- #define mode_pos 0x06
- #define mode_speed 0x02
- uint8_t get_motor_mode(void);
- struct rt_can_msg send_motor_speed_mode(void);
- struct rt_can_msg send_motor_control_mode(void) ;
- #endif /* SEND_MODE_EN */
- #if defined SEND_RPM_EN
- void set_motor_rpm(int16_t rpm);
- int16_t get_motor_real_rpm(void);
- struct rt_can_msg send_motor_rpm(void) ;
- #endif /* SEND_RPM_EN */
- struct rt_can_msg send_motor_reset(void) ;
- uint8_t motor_msg_parse(struct rt_can_msg *msg);
- void check_motor_miss(void);
- uint8_t get_motor_err(void);
- uint8_t get_motor_miss_err(void);
- uint8_t motor_init_ok(void);
- #endif
|