Skip to content

Commit

Permalink
fix errors introduced in merge
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow578 committed May 13, 2023
1 parent 737f9f5 commit cdde079
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
5 changes: 3 additions & 2 deletions Marlin/src/HAL/HC32F46x/MarlinHAL.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include <stdint.h>
Expand Down Expand Up @@ -74,5 +73,7 @@ class MarlinHAL

// M997: trigger firmware update from sd card (after upload)
// on HC32F46x, a reboot is enough to do this
#define PLATFORM_M997_SUPPORT
#ifndef PLATFORM_M997_SUPPORT
#define PLATFORM_M997_SUPPORT
#endif
void flashFirmware(const int16_t);
17 changes: 8 additions & 9 deletions Marlin/src/HAL/HC32F46x/endstop_interrupts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include "../../module/endstops.h"
#include "interrupts.h"

// Z_MIN_PROBE does not follow the same naming as all other pins...
#if HAS_Z_MIN_PROBE_PIN && !defined(HAS_Z_MIN_PROBE)
#define HAS_Z_MIN_PROBE
#endif

//
// IRQ handler
//
Expand All @@ -15,7 +10,7 @@ void endstopIRQHandler()
bool flag = false;

// check all irq flags
#define CHECK(name) TERN_(HAS_##name, flag |= checkAndClearExtIRQFlag(name##_PIN))
#define CHECK(name) TERN_(USE_##name, flag |= checkAndClearExtIRQFlag(name##_PIN))

CHECK(X_MAX);
CHECK(X_MIN);
Expand Down Expand Up @@ -46,7 +41,7 @@ void endstopIRQHandler()
//
void setup_endstop_interrupts()
{
#define SETUP(name) TERN_(HAS_##name, attachInterrupt(name##_PIN, endstopIRQHandler, CHANGE))
#define SETUP(name) TERN_(USE_##name, attachInterrupt(name##_PIN, endstopIRQHandler, CHANGE))

SETUP(X_MAX);
SETUP(X_MIN);
Expand All @@ -68,6 +63,10 @@ void setup_endstop_interrupts()

// ensure max. 10 irqs are registered
// if you encounter this error, you'll have to disable some endstops
#if HAS_X_MAX && HAS_X_MIN && HAS_Y_MAX && HAS_Y_MIN && HAS_Z_MAX && HAS_Z_MIN && HAS_Z2_MAX && HAS_Z2_MIN && HAS_Z3_MAX && HAS_Z3_MIN && HAS_MIN_Z_PROBE
#error "too many endstop interrupts! HC32F46x only supports 10 endstop interrupts."
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_Y_MAX, USE_Y_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z_MIN_PROBE)
#if ENDSTOPS_INTERRUPTS_COUNT > 10
#error "too many endstop interrupts! HC32F46x only supports 10 endstop interrupts."
#endif
#if ENDSTOPS_INTERRUPTS_COUNT == 0
#error "no endstop interrupts are enabled! If you wish to ignore this error, please comment out this line."
#endif
5 changes: 4 additions & 1 deletion Marlin/src/HAL/HC32F46x/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ typedef uint16_t hal_timer_t;
#define TEMP_TIMER_PRESCALE 16ul

#define STEPPER_TIMER_PRESCALE 16ul
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)

//TODO: derive this from the timer rate and prescale
// since F_CPU is not constant, it cannot be used here...
#define STEPPER_TIMER_RATE 2000000 // (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000)

#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#elif defined(TARGET_LPC1768)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/LPC1768/NAME)
#elif defined(TARGET_HC32F46x)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HC32F46x/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/HC32F46x/NAME)
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/STM32F1/NAME)
#elif defined(ARDUINO_ARCH_STM32)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/hc32f46x/pins_Aquila_V101.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
//
#define SD_DETECT_PIN PA10
#define SDCARD_CONNECTION ONBOARD
#define SDIO_SUPPORT
#define ONBOARD_SDIO
#define NO_SD_HOST_DRIVE // This board's SD card is only seen by the printer

//
Expand Down
1 change: 1 addition & 0 deletions ini/hc32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ build_flags =
-D TARGET_HC32F46x
-D REDIRECT_PRINTF_TO_SERIAL
-D __DEBUG
-D PLATFORM_M997_SUPPORT
build_src_filter = ${common.default_src_filter} +<src/HAL/HC32F46x> +<src/HAL/shared/backtrace>

# Drivers and Middleware required by the HC32F46x HAL
Expand Down

0 comments on commit cdde079

Please sign in to comment.