motor_cs103/User/lib/driver/tmc2240.h

29 lines
535 B
C

#ifndef __TMC2240_H
#define __TMC2240_H
#include "main.h"
#include "spis.h"
#define TMC2240_REG_GCONF 0x00
typedef enum
{
TMC2240_1,
TMC2240_MAX,
} tmc2240_index_e;
typedef struct
{
spi_t *spi;
struct
{
int32_t gconf;
int32_t position;
} data;
} tmc2240_t;
void tmc2240_init(tmc2240_index_e index, spi_gpio_group_t *gpios);
void tmc2240_config(tmc2240_index_e index);
tmc2240_t *tmc2240_get(tmc2240_index_e index);
int32_t tmc2240_position_read(tmc2240_index_e index);
#endif // __TMC2240_H