瀏覽代碼

SAMD51 SoftwareSerial (#17041)

Scott Lahteine 4 年之前
父節點
當前提交
631addbbb4
No account linked to committer's email address

+ 1
- 1
Marlin/src/HAL/HAL_SAMD51/fastio.h 查看文件

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

+ 4
- 8
Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h 查看文件

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

+ 4
- 4
Marlin/src/HAL/HAL_SAMD51/timers.cpp 查看文件

@@ -42,7 +42,7 @@ const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS+1] = {
42 42
   { {.pTc=TC1},  TC1_IRQn, TC_PRIORITY(1) },  // 1 - stepper (needed by 32 bit timers)
43 43
   { {.pTc=TC2},  TC2_IRQn, TC_PRIORITY(2) },  // 2 - tone (framework)
44 44
   { {.pTc=TC3},  TC3_IRQn, TC_PRIORITY(3) },  // 3 - servo
45
-  { {.pTc=TC4},  TC4_IRQn, TC_PRIORITY(4) },
45
+  { {.pTc=TC4},  TC4_IRQn, TC_PRIORITY(4) },  // 4 - software serial
46 46
   { {.pTc=TC5},  TC5_IRQn, TC_PRIORITY(5) },
47 47
   { {.pTc=TC6},  TC6_IRQn, TC_PRIORITY(6) },
48 48
   { {.pTc=TC7},  TC7_IRQn, TC_PRIORITY(7) },
@@ -145,12 +145,12 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
145 145
 }
146 146
 
147 147
 void HAL_timer_enable_interrupt(const uint8_t timer_num) {
148
-  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
148
+  const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
149 149
   NVIC_EnableIRQ(irq);
150 150
 }
151 151
 
152 152
 void HAL_timer_disable_interrupt(const uint8_t timer_num) {
153
-  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
153
+  const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
154 154
   Disable_Irq(irq);
155 155
 }
156 156
 
@@ -160,7 +160,7 @@ static bool NVIC_GetEnabledIRQ(IRQn_Type IRQn) {
160 160
 }
161 161
 
162 162
 bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
163
-  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
163
+  const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
164 164
   return NVIC_GetEnabledIRQ(irq);
165 165
 }
166 166
 

+ 6
- 6
Marlin/src/HAL/HAL_SAMD51/timers.h 查看文件

@@ -57,16 +57,16 @@ typedef uint32_t hal_timer_t;
57 57
                                : (t == TEMP_TIMER_NUM) ? 6                        \
58 58
                                : 7
59 59
 
60
-#define _TC_HANDLER(t)        void TC##t##_Handler()
61
-#define TC_HANDLER(t)         _TC_HANDLER(t)
62
-#define HAL_STEP_TIMER_ISR()  TC_HANDLER(STEP_TIMER_NUM)
60
+#define _TC_HANDLER(t)            void TC##t##_Handler()
61
+#define TC_HANDLER(t)             _TC_HANDLER(t)
62
+#define HAL_STEP_TIMER_ISR()      TC_HANDLER(STEP_TIMER_NUM)
63 63
 #if STEP_TIMER_NUM != PULSE_TIMER_NUM
64
-  #define HAL_PULSE_TIMER_ISR()  TC_HANDLER(PULSE_TIMER_NUM)
64
+  #define HAL_PULSE_TIMER_ISR()   TC_HANDLER(PULSE_TIMER_NUM)
65 65
 #endif
66 66
 #if TEMP_TIMER_NUM == RTC_TIMER_NUM
67
-  #define HAL_TEMP_TIMER_ISR()  void RTC_Handler()
67
+  #define HAL_TEMP_TIMER_ISR()    void RTC_Handler()
68 68
 #else
69
-  #define HAL_TEMP_TIMER_ISR()  TC_HANDLER(TEMP_TIMER_NUM)
69
+  #define HAL_TEMP_TIMER_ISR()    TC_HANDLER(TEMP_TIMER_NUM)
70 70
 #endif
71 71
 
72 72
 // --------------------------------------------------------------------------

+ 8
- 8
platformio.ini 查看文件

@@ -771,20 +771,20 @@ src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include
771 771
 build_unflags   = -Wall
772 772
 lib_ldf_mode    = off
773 773
 lib_deps        =
774
-extra_scripts   =
775 774
 src_filter      = ${common.default_src_filter} +<src/HAL/HAL_LINUX>
776 775
 
777 776
 #
778 777
 # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4)
779 778
 #
780 779
 [env:SAMD51_grandcentral_m4]
781
-platform      = atmelsam
782
-board         = adafruit_grandcentral_m4
783
-build_flags   = ${common.build_flags} -std=gnu++17
784
-extra_scripts = ${common.extra_scripts}
785
-build_unflags = -std=gnu++11
786
-src_filter    = ${common.default_src_filter} +<src/HAL/HAL_SAMD51>
787
-debug_tool    = jlink
780
+platform       = atmelsam
781
+board          = adafruit_grandcentral_m4
782
+build_flags    = ${common.build_flags} -std=gnu++17 -Wno-register
783
+build_unflags  = -std=gnu++11
784
+src_filter     = ${common.default_src_filter} +<src/HAL/HAL_SAMD51>
785
+lib_deps       = ${common.lib_deps}
786
+  SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
787
+debug_tool     = jlink
788 788
 
789 789
 #
790 790
 # RUMBA32

Loading…
取消
儲存