Open FFBoard
Open source force feedback firmware
TMCDebugBridge.h
Go to the documentation of this file.
1/*
2 * TMCDebugBridge.h
3 *
4 * Created on: 23.01.2020
5 * Author: Yannick
6 */
7
8#ifndef TMCDebugBridge_H_
9#define TMCDebugBridge_H_
10
11#include "constants.h"
12#ifdef TMCDEBUG
13#include <FFBoardMain.h>
14#include <vector>
15#include "TMC4671.h"
16
17extern "C"{
18#include "main.h"
19}
20
21
22extern SPI_HandleTypeDef HSPIDRV;
23
25 enum class TMCDebugBridge_commands : uint32_t{
27 };
28public:
29
31 virtual ~TMCDebugBridge();
32
35 static bool isCreatable() {return true;};
36
37 void cdcRcv(char* Buf, uint32_t *Len);
38 CommandStatus command(const ParsedCommand& cmd,std::vector<CommandReply>& replies);
39 void registerCommands();
40 std::string getHelpstring(){return "Compatible with TMCL-IDE. To use the FOC modes position, velocity and torque you first must manually select the encoder and wait for alignment.";}
41
42
43private:
45 .fluxI = 400,
46 .fluxP = 400,
47 .torqueI = 400,
48 .torqueP = 300,
49 .velocityI = 10,
50 .velocityP = 500,
51 .positionI = 0,
52 .positionP = 40,
53 .sequentialPI = true});
54
56 .pid_torque_flux_ddt = 32767,
57 .pid_uq_ud = 30000,
58 .pid_torque_flux = 32767,
59 .pid_acc_lim = 50, // Safety
60 .pid_vel_lim = 2147483647,
61 .pid_pos_low = -2147483647,
62 .pid_pos_high = 2147483647
63 });
64 static void sendCdc(char* dat, uint32_t len);
65 std::unique_ptr<TMC4671> drv;
66
67 uint8_t checksum(std::vector<uint8_t> *buffer,uint8_t len);
68 HAL_StatusTypeDef SPI_transmit_receive(uint8_t *tx_data,uint8_t *rx_data,uint16_t len,uint32_t timeout);
69};
70
71#endif /* TMCDebugBridge_H_ */
72#endif
CommandStatus
SPI_HandleTypeDef HSPIDRV
virtual ~TMCDebugBridge()
const TMC4671PIDConf tmcpids
const ClassIdentifier getInfo()
static bool isCreatable()
std::string getHelpstring()
uint8_t checksum(std::vector< uint8_t > *buffer, uint8_t len)
CommandStatus command(const ParsedCommand &cmd, std::vector< CommandReply > &replies)
static void sendCdc(char *dat, uint32_t len)
const TMC4671Limits tmclimits
HAL_StatusTypeDef SPI_transmit_receive(uint8_t *tx_data, uint8_t *rx_data, uint16_t len, uint32_t timeout)
void cdcRcv(char *Buf, uint32_t *Len)
std::unique_ptr< TMC4671 > drv
static ClassIdentifier info
uint8_t const * buffer
Definition: midi_device.h:100