38 lines
906 B
C
38 lines
906 B
C
#pragma once
|
|
|
|
#pragma region "Motor and sensor setup"
|
|
#define LED1 PC10
|
|
#define LED2 PC11
|
|
#define HARDWARE_SERIAL_RX_PIN PB7
|
|
#define HARDWARE_SERIAL_TX_PIN PB6
|
|
#define AS5045_CS PB15
|
|
#define AS5045_MISO PB14
|
|
#define AS5045_MOSI PC1
|
|
#define AS5045_SCLK PB10
|
|
#define CURRENT_SENSOR_1 PB1
|
|
#define CURRENT_SENSOR_2 PB0
|
|
#define CURRENT_SENSOR_3 PC5
|
|
#define TIM1_CH1 PA8
|
|
#define TIM1_CH2 PA9
|
|
#define TIM1_CH3 PA10
|
|
#define EN_W_GATE_DRIVER PC6
|
|
#define EN_U_GATE_DRIVER PA11
|
|
#define EN_V_GATE_DRIVER PA12
|
|
#define SLEEP_DRIVER PC9
|
|
#define RESET_DRIVER PC8
|
|
#define FAULT_DRIVER PC7
|
|
#define POLE_PAIRS 14
|
|
#define CAN2_TX PB13
|
|
#define CAN2_RX PB12
|
|
#define CAN1_TX PB9
|
|
#define CAN1_RX PB8
|
|
#define GM6208_RESISTANCE 31
|
|
#define OWN_RESISTANCE 26
|
|
#pragma endregion
|
|
|
|
#if !defined(HAL_CAN_MODULE_ENABLED)
|
|
#define HAL_CAN_MODULE_ENABLED
|
|
#endif
|
|
#include "stm32f4xx_hal.h"
|
|
#include "stm32f4xx_hal_can.h"
|
|
#include <STM32_CAN.h>
|