You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
/**
* @file drv8710.hpp * @author zhaohe (h_zhaohe@163.com) * @brief * @version 0.1 * @date 2023-04-14 * * @copyright Copyright (c) 2023 * * */ #include <stdint.h>
#include "sdk/os/zos.hpp"
#include "sdk\chip\zpwm_generator_muti_channel.hpp"
//
namespace iflytop { // SUPPORT REG
/**
* @brief Cubemx���� * * 1. ʹ��һ����ʱ������In1�������ó�PWM���� */ class DRV8710 { public: typedef struct { ZPWMGeneratorMutiChannel::hardware_config_t pwm_cfg; int32_t in1_chnannel_index;
Pin_t in2; Pin_t nsleep; Pin_t nfault; Pin_t sensePin; bool shaft; bool enableTrace;
} config_t;
ZPWMGeneratorMutiChannel m_pwmCtrl;
ZGPIO m_in2; ZGPIO m_nsleep; ZGPIO m_nfault; ZGPIO m_nsensePin;
config_t m_cfg; // ZGPIO so;
public: DRV8710(){};
void initialize(config_t* cfg);
void enable(bool varenable);
void moveForward(int32_t duty); // 0->100
void moveBackward(int32_t duty); // 0->100
void move(int32_t duty); // -100->100
bool isFault(); bool getSensePinState() { return m_nsensePin.getState(); }
private: void set_direcetion(bool direcetion); };
} // namespace iflytop
|