Browse Source

SAMD51 SoftwareSerial (#17041)

Scott Lahteine 4 years ago
parent
commit
631addbbb4
No account linked to committer's email address

+ 1
- 1
Marlin/src/HAL/HAL_SAMD51/fastio.h View File

37
 /**
37
 /**
38
  * Magic I/O routines
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
 // Read a pin
43
 // Read a pin

+ 4
- 8
Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h View File

23
  * Test SAMD51 specific configuration values for errors at compile-time.
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
 #if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
30
 #if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
27
   #error "No custom SD drive cable defined for this board."
31
   #error "No custom SD drive cable defined for this board."
28
 #endif
32
 #endif
42
 #if ENABLED(FAST_PWM_FAN)
46
 #if ENABLED(FAST_PWM_FAN)
43
   #error "FAST_PWM_FAN is not yet implemented for this platform."
47
   #error "FAST_PWM_FAN is not yet implemented for this platform."
44
 #endif
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 View File

42
   { {.pTc=TC1},  TC1_IRQn, TC_PRIORITY(1) },  // 1 - stepper (needed by 32 bit timers)
42
   { {.pTc=TC1},  TC1_IRQn, TC_PRIORITY(1) },  // 1 - stepper (needed by 32 bit timers)
43
   { {.pTc=TC2},  TC2_IRQn, TC_PRIORITY(2) },  // 2 - tone (framework)
43
   { {.pTc=TC2},  TC2_IRQn, TC_PRIORITY(2) },  // 2 - tone (framework)
44
   { {.pTc=TC3},  TC3_IRQn, TC_PRIORITY(3) },  // 3 - servo
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
   { {.pTc=TC5},  TC5_IRQn, TC_PRIORITY(5) },
46
   { {.pTc=TC5},  TC5_IRQn, TC_PRIORITY(5) },
47
   { {.pTc=TC6},  TC6_IRQn, TC_PRIORITY(6) },
47
   { {.pTc=TC6},  TC6_IRQn, TC_PRIORITY(6) },
48
   { {.pTc=TC7},  TC7_IRQn, TC_PRIORITY(7) },
48
   { {.pTc=TC7},  TC7_IRQn, TC_PRIORITY(7) },
145
 }
145
 }
146
 
146
 
147
 void HAL_timer_enable_interrupt(const uint8_t timer_num) {
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
   NVIC_EnableIRQ(irq);
149
   NVIC_EnableIRQ(irq);
150
 }
150
 }
151
 
151
 
152
 void HAL_timer_disable_interrupt(const uint8_t timer_num) {
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
   Disable_Irq(irq);
154
   Disable_Irq(irq);
155
 }
155
 }
156
 
156
 
160
 }
160
 }
161
 
161
 
162
 bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
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
   return NVIC_GetEnabledIRQ(irq);
164
   return NVIC_GetEnabledIRQ(irq);
165
 }
165
 }
166
 
166
 

+ 6
- 6
Marlin/src/HAL/HAL_SAMD51/timers.h View File

57
                                : (t == TEMP_TIMER_NUM) ? 6                        \
57
                                : (t == TEMP_TIMER_NUM) ? 6                        \
58
                                : 7
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
 #if STEP_TIMER_NUM != PULSE_TIMER_NUM
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
 #endif
65
 #endif
66
 #if TEMP_TIMER_NUM == RTC_TIMER_NUM
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
 #else
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
 #endif
70
 #endif
71
 
71
 
72
 // --------------------------------------------------------------------------
72
 // --------------------------------------------------------------------------

+ 8
- 8
platformio.ini View File

771
 build_unflags   = -Wall
771
 build_unflags   = -Wall
772
 lib_ldf_mode    = off
772
 lib_ldf_mode    = off
773
 lib_deps        =
773
 lib_deps        =
774
-extra_scripts   =
775
 src_filter      = ${common.default_src_filter} +<src/HAL/HAL_LINUX>
774
 src_filter      = ${common.default_src_filter} +<src/HAL/HAL_LINUX>
776
 
775
 
777
 #
776
 #
778
 # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4)
777
 # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4)
779
 #
778
 #
780
 [env:SAMD51_grandcentral_m4]
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
 # RUMBA32
790
 # RUMBA32

Loading…
Cancel
Save