#ifndef __ELEMACHINERY_H
#define __ELEMACHINERY_H
//#include "spi.h"
#include <stdint.h>
#include "sys.h"

#define MOVE_THE_MOTOR_TO_THE_LEFT   GPIO_SetBits(GPIOD, GPIO_Pin_3); //电机向左移动
#define MOVE_THE_MOTOR_TO_THE_RIGHT   GPIO_ResetBits(GPIOD, GPIO_Pin_3); // 电机向右移动

#define INFRARED_STARTING_POINT  0x08D3
#define INFRARED_ENDING_POINT 0x242E

#define START_THE_BLACK_LIGHT  0x0EB0
#define END_THE_BLACK_LIGHT 0x2273



void change_spi(char *str);
void tmc2240_write(uint8_t address, uint8_t data);
void TMC2240_WriteReg(uint8_t addr, uint32_t data);
void ProcessControl(void);
void motor_motion(void);
uint32_t TMC2240_ReadReg(uint8_t addr);
void motor_rotating(void);
void accelerate();
void clean_limit(void);
#endif