Browse Source

SAMD51 SoftwareSerial (#17041)

vanilla_fb_2.0.x
Scott Lahteine 5 years ago
committed by GitHub
parent
commit
631addbbb4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Marlin/src/HAL/HAL_SAMD51/fastio.h
  2. 12
      Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h
  3. 8
      Marlin/src/HAL/HAL_SAMD51/timers.cpp
  4. 6
      platformio.ini

2
Marlin/src/HAL/HAL_SAMD51/fastio.h

@ -37,7 +37,7 @@
/** /**
* Magic I/O routines * Magic I/O routines
* *
* Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW); * Now you can simply SET_OUTPUT(IO); WRITE(IO, HIGH); WRITE(IO, LOW);
*/ */
// Read a pin // Read a pin

12
Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h

@ -23,6 +23,10 @@
* Test SAMD51 specific configuration values for errors at compile-time. * Test SAMD51 specific configuration values for errors at compile-time.
*/ */
#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
#endif
#if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE) #if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board." #error "No custom SD drive cable defined for this board."
#endif #endif
@ -42,11 +46,3 @@
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform." #error "FAST_PWM_FAN is not yet implemented for this platform."
#endif #endif
#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
#endif
#if HAS_TMC_SW_SERIAL
#error "TMC220x Software Serial is not supported on this platform."
#endif

8
Marlin/src/HAL/HAL_SAMD51/timers.cpp

@ -42,7 +42,7 @@ const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS+1] = {
{ {.pTc=TC1}, TC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers) { {.pTc=TC1}, TC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers)
{ {.pTc=TC2}, TC2_IRQn, TC_PRIORITY(2) }, // 2 - tone (framework) { {.pTc=TC2}, TC2_IRQn, TC_PRIORITY(2) }, // 2 - tone (framework)
{ {.pTc=TC3}, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo { {.pTc=TC3}, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo
{ {.pTc=TC4}, TC4_IRQn, TC_PRIORITY(4) }, { {.pTc=TC4}, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial
{ {.pTc=TC5}, TC5_IRQn, TC_PRIORITY(5) }, { {.pTc=TC5}, TC5_IRQn, TC_PRIORITY(5) },
{ {.pTc=TC6}, TC6_IRQn, TC_PRIORITY(6) }, { {.pTc=TC6}, TC6_IRQn, TC_PRIORITY(6) },
{ {.pTc=TC7}, TC7_IRQn, TC_PRIORITY(7) }, { {.pTc=TC7}, TC7_IRQn, TC_PRIORITY(7) },
@ -145,12 +145,12 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
} }
void HAL_timer_enable_interrupt(const uint8_t timer_num) { void HAL_timer_enable_interrupt(const uint8_t timer_num) {
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id; const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
NVIC_EnableIRQ(irq); NVIC_EnableIRQ(irq);
} }
void HAL_timer_disable_interrupt(const uint8_t timer_num) { void HAL_timer_disable_interrupt(const uint8_t timer_num) {
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id; const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
Disable_Irq(irq); Disable_Irq(irq);
} }
@ -160,7 +160,7 @@ static bool NVIC_GetEnabledIRQ(IRQn_Type IRQn) {
} }
bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id; const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
return NVIC_GetEnabledIRQ(irq); return NVIC_GetEnabledIRQ(irq);
} }

6
platformio.ini

@ -771,7 +771,6 @@ src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include
build_unflags = -Wall build_unflags = -Wall
lib_ldf_mode = off lib_ldf_mode = off
lib_deps = lib_deps =
extra_scripts =
src_filter = ${common.default_src_filter} +<src/HAL/HAL_LINUX> src_filter = ${common.default_src_filter} +<src/HAL/HAL_LINUX>
# #
@ -780,10 +779,11 @@ src_filter = ${common.default_src_filter} +<src/HAL/HAL_LINUX>
[env:SAMD51_grandcentral_m4] [env:SAMD51_grandcentral_m4]
platform = atmelsam platform = atmelsam
board = adafruit_grandcentral_m4 board = adafruit_grandcentral_m4
build_flags = ${common.build_flags} -std=gnu++17 build_flags = ${common.build_flags} -std=gnu++17 -Wno-register
extra_scripts = ${common.extra_scripts}
build_unflags = -std=gnu++11 build_unflags = -std=gnu++11
src_filter = ${common.default_src_filter} +<src/HAL/HAL_SAMD51> src_filter = ${common.default_src_filter} +<src/HAL/HAL_SAMD51>
lib_deps = ${common.lib_deps}
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
debug_tool = jlink debug_tool = jlink
# #

Loading…
Cancel
Save