41 lines
784 B
C
41 lines
784 B
C
/**
|
||
* @file tmc2240.h
|
||
* @author xushenghao
|
||
* @brief TMC2240驱动头文件
|
||
* @version 0.1
|
||
* @note
|
||
* 1. 芯片VM需要供电,否则SPI无法正常通信
|
||
*/
|
||
|
||
#ifndef __TMC2240_H
|
||
#define __TMC2240_H
|
||
#include "main.h"
|
||
#include "spis.h"
|
||
|
||
#define TMC2240_HIGHT_BIT 0x80
|
||
#define TMC2240_REG_GCONF 0x00
|
||
#define TMC2240_REG_XACTUAL 0x21
|
||
|
||
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_TypeDef *SPIx, 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
|