General cleanup
This commit is contained in:
parent
160f70be63
commit
9b78138600
@ -370,19 +370,19 @@ void SPIClass::updateSettings() {
|
|||||||
switch (_currentSetting->dataMode) {
|
switch (_currentSetting->dataMode) {
|
||||||
case SPI_MODE0:
|
case SPI_MODE0:
|
||||||
HW_SPI_init.CPHA = SSP_CPHA_FIRST;
|
HW_SPI_init.CPHA = SSP_CPHA_FIRST;
|
||||||
HW_SPI_init.CPOL = SSP_CPOL_HI;
|
HW_SPI_init.CPOL = SSP_CPOL_HI;
|
||||||
break;
|
break;
|
||||||
case SPI_MODE1:
|
case SPI_MODE1:
|
||||||
HW_SPI_init.CPHA = SSP_CPHA_SECOND;
|
HW_SPI_init.CPHA = SSP_CPHA_SECOND;
|
||||||
HW_SPI_init.CPOL = SSP_CPOL_HI;
|
HW_SPI_init.CPOL = SSP_CPOL_HI;
|
||||||
break;
|
break;
|
||||||
case SPI_MODE2:
|
case SPI_MODE2:
|
||||||
HW_SPI_init.CPHA = SSP_CPHA_FIRST;
|
HW_SPI_init.CPHA = SSP_CPHA_FIRST;
|
||||||
HW_SPI_init.CPOL = SSP_CPOL_LO;
|
HW_SPI_init.CPOL = SSP_CPOL_LO;
|
||||||
break;
|
break;
|
||||||
case SPI_MODE3:
|
case SPI_MODE3:
|
||||||
HW_SPI_init.CPHA = SSP_CPHA_SECOND;
|
HW_SPI_init.CPHA = SSP_CPHA_SECOND;
|
||||||
HW_SPI_init.CPOL = SSP_CPOL_LO;
|
HW_SPI_init.CPOL = SSP_CPOL_LO;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -108,7 +108,7 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
|
|||||||
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
|
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
|
||||||
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
|
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Wait for DMA transaction to complete
|
//Wait for DMA transaction to complete
|
||||||
while ((DMA2_BASE->ISR & (DMA_ISR_TEIF4|DMA_ISR_TCIF4)) == 0 ) { /* wait */ }
|
while ((DMA2_BASE->ISR & (DMA_ISR_TEIF4|DMA_ISR_TCIF4)) == 0 ) { /* wait */ }
|
||||||
|
@ -115,9 +115,7 @@ void plan_arc(
|
|||||||
);
|
);
|
||||||
// Divide total travel by nominal segment length
|
// Divide total travel by nominal segment length
|
||||||
uint16_t segments = FLOOR(mm_of_travel / seg_length);
|
uint16_t segments = FLOOR(mm_of_travel / seg_length);
|
||||||
if (segments < min_segments) { // Too few segments?
|
NOLESS(segments, min_segments); // At least some segments
|
||||||
segments = min_segments; // More segments
|
|
||||||
}
|
|
||||||
seg_length = mm_of_travel / segments;
|
seg_length = mm_of_travel / segments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,15 +127,15 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
|
|||||||
|
|
||||||
// if must encoder rati multiplier
|
// if must encoder rati multiplier
|
||||||
if (EncoderRate.encoderRateEnabled) {
|
if (EncoderRate.encoderRateEnabled) {
|
||||||
const float abs_diff = ABS(temp_diff);
|
const float abs_diff = ABS(temp_diff),
|
||||||
const float encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
|
encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
|
||||||
if (EncoderRate.lastEncoderTime) {
|
if (EncoderRate.lastEncoderTime) {
|
||||||
// Note that the rate is always calculated between two passes through the
|
// Note that the rate is always calculated between two passes through the
|
||||||
// loop and that the abs of the temp_diff value is tracked.
|
// loop and that the abs of the temp_diff value is tracked.
|
||||||
const float encoderStepRate = encoderMovementSteps / float(ms - EncoderRate.lastEncoderTime) * 1000;
|
const float encoderStepRate = encoderMovementSteps / float(ms - EncoderRate.lastEncoderTime) * 1000;
|
||||||
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
||||||
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
||||||
else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5;
|
else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5;
|
||||||
}
|
}
|
||||||
EncoderRate.lastEncoderTime = ms;
|
EncoderRate.lastEncoderTime = ms;
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,9 @@ extern ENCODER_Rate EncoderRate;
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ENCODER_DIFF_NO = 0,
|
ENCODER_DIFF_NO = 0,
|
||||||
ENCODER_DIFF_CW = 1,
|
ENCODER_DIFF_CW = 1,
|
||||||
ENCODER_DIFF_CCW = 2,
|
ENCODER_DIFF_CCW = 2,
|
||||||
ENCODER_DIFF_ENTER = 3
|
ENCODER_DIFF_ENTER = 3
|
||||||
} ENCODER_DiffState;
|
} ENCODER_DiffState;
|
||||||
|
|
||||||
/*编码器初始化 PB12:Encoder_A PB13:Encoder_B PB14:Encoder_C*/
|
/*编码器初始化 PB12:Encoder_A PB13:Encoder_B PB14:Encoder_C*/
|
||||||
@ -87,7 +87,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void);
|
|||||||
/*状态LED初始化*/
|
/*状态LED初始化*/
|
||||||
void STATE_LED_Configuration(void);
|
void STATE_LED_Configuration(void);
|
||||||
|
|
||||||
/*LED灯操作*/
|
/*LED灯操作*/
|
||||||
void LED_Action(void);
|
void LED_Action(void);
|
||||||
|
|
||||||
/*LED初始化*/
|
/*LED初始化*/
|
||||||
|
@ -161,7 +161,7 @@
|
|||||||
|
|
||||||
#if ENABLED(RET6_12864_LCD)
|
#if ENABLED(RET6_12864_LCD)
|
||||||
|
|
||||||
/* RET6 12864 LCD */
|
// RET6 12864 LCD
|
||||||
#define LCD_PINS_RS PB12
|
#define LCD_PINS_RS PB12
|
||||||
#define LCD_PINS_ENABLE PB15
|
#define LCD_PINS_ENABLE PB15
|
||||||
#define LCD_PINS_D4 PB13
|
#define LCD_PINS_D4 PB13
|
||||||
@ -174,7 +174,7 @@
|
|||||||
|
|
||||||
#elif ENABLED(VET6_12864_LCD)
|
#elif ENABLED(VET6_12864_LCD)
|
||||||
|
|
||||||
/* VET6 12864 LCD */
|
// VET6 12864 LCD
|
||||||
#define LCD_PINS_RS PA4
|
#define LCD_PINS_RS PA4
|
||||||
#define LCD_PINS_ENABLE PA7
|
#define LCD_PINS_ENABLE PA7
|
||||||
#define LCD_PINS_D4 PA5
|
#define LCD_PINS_D4 PA5
|
||||||
@ -185,7 +185,7 @@
|
|||||||
|
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD)
|
#elif ENABLED(DWIN_CREALITY_LCD)
|
||||||
|
|
||||||
/* RET6 DWIN ENCODER LCD */
|
// RET6 DWIN ENCODER LCD
|
||||||
#define BTN_ENC PB14
|
#define BTN_ENC PB14
|
||||||
#define BTN_EN1 PB15
|
#define BTN_EN1 PB15
|
||||||
#define BTN_EN2 PB12
|
#define BTN_EN2 PB12
|
||||||
@ -198,7 +198,7 @@
|
|||||||
|
|
||||||
#elif ENABLED(DWIN_VET6_CREALITY_LCD)
|
#elif ENABLED(DWIN_VET6_CREALITY_LCD)
|
||||||
|
|
||||||
/* VET6 DWIN ENCODER LCD */
|
// VET6 DWIN ENCODER LCD
|
||||||
#define BTN_ENC PA6
|
#define BTN_ENC PA6
|
||||||
#define BTN_EN1 PA7
|
#define BTN_EN1 PA7
|
||||||
#define BTN_EN2 PA4
|
#define BTN_EN2 PA4
|
||||||
|
Loading…
Reference in New Issue
Block a user