Reorganize HAL (#14832)

This commit is contained in:
Scott Lahteine 2019-09-02 19:49:58 -05:00 committed by GitHub
parent cdd5056aba
commit 75efa3cdac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
142 changed files with 547 additions and 422 deletions

View File

@ -240,10 +240,10 @@ jobs:
build_marlin_pio ./ ${TEST_PLATFORM} build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs restore_configs
echo testing STM32F1 targets... echo testing STM32F1 targets...
export TEST_PLATFORM="-e STM32F1" export TEST_PLATFORM="-e STM32F103R"
restore_configs restore_configs
echo use_example_configs STM32/STM32F10 echo use_example_configs STM32/STM32F103R
use_example_configs STM32/STM32F10 use_example_configs STM32/STM32F103R
build_marlin_pio ./ ${TEST_PLATFORM} build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs restore_configs
echo use_example_configs STM32/stm32f103ret6 echo use_example_configs STM32/stm32f103ret6

View File

@ -9,37 +9,46 @@ notifications:
email: false email: false
env: env:
- TEST_PLATFORM="ARMED" # Base Environments
#- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu"
- TEST_PLATFORM="DUE" - TEST_PLATFORM="DUE"
- TEST_PLATFORM="esp32" - TEST_PLATFORM="esp32"
- TEST_PLATFORM="fysetc_f6_13"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="linux_native" - TEST_PLATFORM="linux_native"
- TEST_PLATFORM="LPC1768" - TEST_PLATFORM="LPC1768"
- TEST_PLATFORM="LPC1769" - TEST_PLATFORM="LPC1769"
#- TEST_PLATFORM="malyanm200"
- TEST_PLATFORM="megaatmega1280"
- TEST_PLATFORM="megaatmega2560" - TEST_PLATFORM="megaatmega2560"
- TEST_PLATFORM="SAMD51_grandcentral_m4"
- TEST_PLATFORM="STM32F103R"
- TEST_PLATFORM="teensy31"
- TEST_PLATFORM="teensy35"
# Extended AVR Environments
- TEST_PLATFORM="fysetc_f6_13"
- TEST_PLATFORM="megaatmega1280"
- TEST_PLATFORM="rambo"
- TEST_PLATFORM="sanguino_atmega1284p"
- TEST_PLATFORM="sanguino_atmega644p"
# Extended STM32 Environments
- TEST_PLATFORM="ARMED"
- TEST_PLATFORM="BIGTREE_BTT002"
- TEST_PLATFORM="BIGTREE_SKR_PRO"
- TEST_PLATFORM="STM32F103R_bigtree"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="STM32F103V_longer"
- TEST_PLATFORM="STM32F407VE_black"
# Non-working environment tests
#- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu"
#- TEST_PLATFORM="malyanm200"
#- TEST_PLATFORM="mks_robin" #- TEST_PLATFORM="mks_robin"
#- TEST_PLATFORM="mks_robin_lite" #- TEST_PLATFORM="mks_robin_lite"
#- TEST_PLATFORM="mks_robin_mini" #- TEST_PLATFORM="mks_robin_mini"
#- TEST_PLATFORM="mks_robin_nano" #- TEST_PLATFORM="mks_robin_nano"
- TEST_PLATFORM="rambo" #- TEST_PLATFORM="STM32F103R_bigtree"
- TEST_PLATFORM="adafruit_grandcentral_m4" #- TEST_PLATFORM="STM32F103R_fysetc"
- TEST_PLATFORM="sanguino_atmega1284p"
- TEST_PLATFORM="sanguino_atmega644p"
- TEST_PLATFORM="STM32F1"
- TEST_PLATFORM="BIGTREE_SKR_MINI"
#- TEST_PLATFORM="fysetc_STM32F1"
- TEST_PLATFORM="alfawise_U20"
#- TEST_PLATFORM="STM32F4" #- TEST_PLATFORM="STM32F4"
- TEST_PLATFORM="black_stm32f407ve"
- TEST_PLATFORM="BIGTREE_SKR_PRO"
#- TEST_PLATFORM="STM32F7" #- TEST_PLATFORM="STM32F7"
- TEST_PLATFORM="teensy31"
- TEST_PLATFORM="teensy35"
before_install: before_install:
# #

View File

@ -20,9 +20,9 @@
#include "../shared/Marduino.h" #include "../shared/Marduino.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_AVR.h" #include "fastio.h"
#include "watchdog_AVR.h" #include "watchdog.h"
#include "math_AVR.h" #include "math.h"
#ifdef USBCON #ifdef USBCON
#include "HardwareSerial.h" #include "HardwareSerial.h"

View File

@ -26,7 +26,7 @@
#ifdef __AVR__ #ifdef __AVR__
#include "fastio_AVR.h" #include "fastio.h"
#ifdef FASTIO_EXT_START #ifdef FASTIO_EXT_START

View File

@ -29,7 +29,7 @@
* Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 72 75 76 77 74 xx xx xx xx xx * Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 72 75 76 77 74 xx xx xx xx xx
*/ */
#include "../fastio_AVR.h" #include "../fastio.h"
// change for your board // change for your board
#define DEBUG_LED DIO21 #define DEBUG_LED DIO21

View File

@ -28,7 +28,7 @@
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5 * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5
*/ */
#include "../fastio_AVR.h" #include "../fastio.h"
// change for your board // change for your board
#define DEBUG_LED DIO46 #define DEBUG_LED DIO46

View File

@ -28,7 +28,7 @@
* Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 * Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
*/ */
#include "../fastio_AVR.h" #include "../fastio.h"
#define DEBUG_LED AIO5 #define DEBUG_LED AIO5

View File

@ -54,7 +54,7 @@
* +--------+ * +--------+
*/ */
#include "../fastio_AVR.h" #include "../fastio.h"
#define DEBUG_LED DIO0 #define DEBUG_LED DIO0

View File

@ -29,7 +29,7 @@
* The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3 * The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3
*/ */
#include "../fastio_AVR.h" #include "../fastio.h"
// change for your board // change for your board
#define DEBUG_LED DIO31 /* led D5 red */ #define DEBUG_LED DIO31 /* led D5 red */

View File

@ -26,7 +26,7 @@
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog_AVR.h" #include "watchdog.h"
#include "../../Marlin.h" #include "../../Marlin.h"

View File

@ -32,9 +32,9 @@
#include "../shared/Marduino.h" #include "../shared/Marduino.h"
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_Due.h" #include "fastio.h"
#include "watchdog_Due.h" #include "watchdog.h"
#include "HAL_timers_Due.h" #include "timers.h"
#include <stdint.h> #include <stdint.h>
@ -58,8 +58,8 @@
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif
#include "MarlinSerial_Due.h" #include "MarlinSerial.h"
#include "MarlinSerialUSB_Due.h" #include "MarlinSerialUSB.h"
// On AVR this is in math.h? // On AVR this is in math.h?
#define square(x) ((x)*(x)) #define square(x) ((x)*(x))

View File

@ -34,7 +34,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include "InterruptVectors_Due.h" #include "InterruptVectors.h"
/* The relocated Exception/Interrupt Table - According to the ARM /* The relocated Exception/Interrupt Table - According to the ARM
reference manual, alignment to 128 bytes should suffice, but in reference manual, alignment to 128 bytes should suffice, but in

View File

@ -29,8 +29,8 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "MarlinSerial_Due.h" #include "MarlinSerial.h"
#include "InterruptVectors_Due.h" #include "InterruptVectors.h"
#include "../../Marlin.h" #include "../../Marlin.h"
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } }; template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };

View File

@ -31,7 +31,7 @@
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#include "MarlinSerialUSB_Due.h" #include "MarlinSerialUSB.h"
#if ENABLED(EMERGENCY_PARSER) #if ENABLED(EMERGENCY_PARSER)
#include "../../feature/emergency_parser.h" #include "../../feature/emergency_parser.h"

View File

@ -31,7 +31,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_Due.h" #include "timers.h"
static pin_t tone_pin; static pin_t tone_pin;
volatile static int32_t toggles; volatile static int32_t toggles;

View File

@ -71,7 +71,7 @@ void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n); void spiSend(const uint8_t* buf, size_t n);
#include "../../shared/Marduino.h" #include "../../shared/Marduino.h"
#include "../fastio_Due.h" #include "../fastio.h"
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) { void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1, PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,

View File

@ -34,7 +34,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_Due.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -24,7 +24,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../../Marlin.h" #include "../../Marlin.h"
#include "watchdog_Due.h" #include "watchdog.h"
// Override Arduino runtime to either config or disable the watchdog // Override Arduino runtime to either config or disable the watchdog
// //

View File

@ -23,7 +23,7 @@
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_ESP32.h" #include "timers.h"
#include <rom/rtc.h> #include <rom/rtc.h>
#include <driver/adc.h> #include <driver/adc.h>
#include <esp_adc_cal.h> #include <esp_adc_cal.h>

View File

@ -30,11 +30,11 @@
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_ESP32.h" #include "fastio.h"
#include "watchdog_ESP32.h" #include "watchdog.h"
#include "i2s.h" #include "i2s.h"
#include "HAL_timers_ESP32.h" #include "timers.h"
#include "WebSocketSerial.h" #include "WebSocketSerial.h"
#include "FlushableHardwareSerial.h" #include "FlushableHardwareSerial.h"

View File

@ -25,7 +25,7 @@
#if HAS_SERVOS #if HAS_SERVOS
#include "HAL_Servo_ESP32.h" #include "Servo.h"
// Adjacent channels (0/1, 2/3 etc.) share the same timer and therefore the same frequency and resolution settings on ESP32, // Adjacent channels (0/1, 2/3 etc.) share the same timer and therefore the same frequency and resolution settings on ESP32,
// so we only allocate servo channels up high to avoid side effects with regards to analogWrite (fans, leds, laser pwm etc.) // so we only allocate servo channels up high to avoid side effects with regards to analogWrite (fans, leds, laser pwm etc.)

View File

@ -30,7 +30,7 @@
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_ESP32.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -26,7 +26,7 @@
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog_ESP32.h" #include "watchdog.h"
void watchdogSetup(void) { void watchdogSetup(void) {
// do whatever. don't remove this function. // do whatever. don't remove this function.

View File

@ -56,7 +56,7 @@ uint8_t _getc();
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include "HAL_timers.h" #include "timers.h"
#include "serial.h" #include "serial.h"
#define SHARED_SERVOS HAS_SERVOS #define SHARED_SERVOS HAS_SERVOS

View File

@ -90,7 +90,7 @@ void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }
void eeprom_update_block(const void *__src, void *__dst, size_t __n) { } void eeprom_update_block(const void *__src, void *__dst, size_t __n) { }
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) {
char format_string[20]; char format_string[20];
snprintf(format_string, 20, "%%%d.%df", __width, __prec); snprintf(format_string, 20, "%%%d.%df", __width, __prec);
sprintf(__s, format_string, __val); sprintf(__s, format_string, __val);

View File

@ -109,13 +109,13 @@ uint16_t analogRead(pin_t);
// EEPROM // EEPROM
void eeprom_write_byte(unsigned char *pos, unsigned char value); void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos); unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n); void eeprom_update_block(const void *__src, void *__dst, size_t __n);
int32_t random(int32_t); int32_t random(int32_t);
int32_t random(int32_t, int32_t); int32_t random(int32_t, int32_t);
void randomSeed(uint32_t); void randomSeed(uint32_t);
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max); int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);

View File

@ -25,7 +25,7 @@
#include "hardware/Timer.h" #include "hardware/Timer.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL_timers.h" #include "timers.h"
/** /**
* Use POSIX signals to attempt to emulate Interrupts * Use POSIX signals to attempt to emulate Interrupts

View File

@ -41,7 +41,7 @@ extern "C" volatile uint32_t _millis;
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include "HAL_timers.h" #include "timers.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include <adc.h> #include <adc.h>

View File

@ -38,7 +38,7 @@ extern "C" {
#include "../../sd/cardreader.h" #include "../../sd/cardreader.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include "HAL_timers.h" #include "timers.h"
extern uint32_t MSC_SD_Init(uint8_t pdrv); extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern "C" int isLPC1769(); extern "C" int isLPC1769();

View File

@ -29,7 +29,7 @@
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL_timers.h" #include "timers.h"
void HAL_timer_init(void) { void HAL_timer_init(void) {
SBI(LPC_SC->PCONP, SBIT_TIMER0); // Power ON Timer 0 SBI(LPC_SC->PCONP, SBIT_TIMER0); // Power ON Timer 0

View File

@ -25,9 +25,9 @@
#include "../shared/Marduino.h" #include "../shared/Marduino.h"
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_SAMD51.h" #include "fastio.h"
#include "watchdog_SAMD51.h" #include "watchdog.h"
#include "HAL_timers_SAMD51.h" #include "timers.h"
#ifdef ADAFRUIT_GRAND_CENTRAL_M4 #ifdef ADAFRUIT_GRAND_CENTRAL_M4
#include "MarlinSerial_AGCM4.h" #include "MarlinSerial_AGCM4.h"

View File

@ -33,7 +33,7 @@
#include "../shared/servo.h" #include "../shared/servo.h"
#include "../shared/servo_private.h" #include "../shared/servo_private.h"
#include "SAMD51.h" #include "SAMD51.h"
#include "HAL_timers_SAMD51.h" #include "timers.h"
#define __TC_GCLK_ID(t) TC##t##_GCLK_ID #define __TC_GCLK_ID(t) TC##t##_GCLK_ID
#define _TC_GCLK_ID(t) __TC_GCLK_ID(t) #define _TC_GCLK_ID(t) __TC_GCLK_ID(t)

View File

@ -25,7 +25,7 @@
// Includes // Includes
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "HAL_timers_SAMD51.h" #include "timers.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Local defines // Local defines

View File

@ -25,7 +25,7 @@
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog_SAMD51.h" #include "watchdog.h"
void watchdog_init(void) { void watchdog_init(void) {
// The low-power oscillator used by the WDT runs at 32,768 Hz with // The low-power oscillator used by the WDT runs at 32,768 Hz with

View File

@ -28,8 +28,8 @@
#include "../shared/Marduino.h" #include "../shared/Marduino.h"
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_STM32.h" #include "fastio.h"
#include "watchdog_STM32.h" #include "watchdog.h"
#include "../../inc/MarlinConfigPre.h" #include "../../inc/MarlinConfigPre.h"
@ -96,7 +96,7 @@
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif
#include "HAL_timers_STM32.h" #include "timers.h"
/** /**
* TODO: review this to return 1 for pins that are not analog input * TODO: review this to return 1 for pins that are not analog input

View File

@ -26,7 +26,7 @@
#if HAS_SERVOS #if HAS_SERVOS
#include "HAL_Servo_STM32.h" #include "Servo.h"
uint8_t servoPin[MAX_SERVOS] = { 0 }; uint8_t servoPin[MAX_SERVOS] = { 0 };

View File

@ -29,9 +29,11 @@
#ifdef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple) #ifdef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple)
#ifdef __STM32F1__ #ifdef __STM32F1__
#include "../HAL_STM32F1/fastio_STM32F1.h" #include "../HAL_STM32F1/fastio.h"
#elif defined(STM32F4) || defined(STM32F7) #elif defined(STM32F4) || defined(STM32F7)
#include "../HAL_STM32_F4_F7/fastio_STM32_F4_F7.h" #include "../HAL_STM32_F4_F7/fastio.h"
#else
#include "fastio.h"
#endif #endif
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS]; extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];

View File

@ -24,7 +24,7 @@
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_STM32.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -28,7 +28,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "watchdog_STM32.h" #include "watchdog.h"
#include <IWatchdog.h> #include <IWatchdog.h>
void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout

View File

@ -33,10 +33,10 @@
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_STM32F1.h" #include "fastio.h"
#include "watchdog_STM32F1.h" #include "watchdog.h"
#include "HAL_timers_STM32F1.h" #include "timers.h"
#include <stdint.h> #include <stdint.h>
#include <util/atomic.h> #include <util/atomic.h>

View File

@ -33,7 +33,7 @@
#ifdef __STM32F1__ #ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "SPI.h" #include <SPI.h>
// ------------------------ // ------------------------
// Public functions // Public functions

View File

@ -31,7 +31,7 @@
#ifdef __STM32F1__ #ifdef __STM32F1__
#include "SPI.h" #include <SPI.h>
#include <libmaple/timer.h> #include <libmaple/timer.h>
#include <libmaple/util.h> #include <libmaple/util.h>

View File

@ -29,8 +29,8 @@
uint8_t ServoCount = 0; uint8_t ServoCount = 0;
#include "HAL_Servo_STM32F1.h" #include "Servo.h"
#include "HAL_timers_STM32F1.h" #include "timers.h"
//#include "Servo.h" //#include "Servo.h"

View File

@ -29,7 +29,7 @@
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY) #if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
#include "HAL_sdio_STM32F1.h" #include "sdio.h"
SDIO_CardInfoTypeDef SdCard; SDIO_CardInfoTypeDef SdCard;

View File

@ -28,7 +28,7 @@
#include "HAL.h" #include "HAL.h"
#include "HAL_timers_STM32F1.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -31,7 +31,7 @@
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include <libmaple/iwdg.h> #include <libmaple/iwdg.h>
#include "watchdog_STM32F1.h" #include "watchdog.h"
void watchdog_reset() { void watchdog_reset() {
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)

View File

@ -28,10 +28,10 @@
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio_STM32_F4_F7.h" #include "fastio.h"
#include "watchdog_STM32_F4_F7.h" #include "watchdog.h"
#include "HAL_timers_STM32_F4_F7.h" #include "timers.h"
#include "../../inc/MarlinConfigPre.h" #include "../../inc/MarlinConfigPre.h"

View File

@ -32,12 +32,12 @@
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7)) #if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
#include "HAL.h" #include "../../inc/MarlinConfig.h"
#include "../shared/HAL_SPI.h"
#include <pins_arduino.h>
#include "spi_pins.h"
#include "../../core/macros.h"
#include <SPI.h> #include <SPI.h>
#include <pins_arduino.h>
#include "../shared/HAL_SPI.h"
#include "spi_pins.h"
// ------------------------ // ------------------------
// Public Variables // Public Variables
@ -72,7 +72,7 @@ static SPISettings spiConfig;
* @details Only configures SS pin since libmaple creates and initialize the SPI object * @details Only configures SS pin since libmaple creates and initialize the SPI object
*/ */
void spiBegin(void) { void spiBegin(void) {
#if !PIN_EXISTS(SS) #if !defined(SS_PIN) || SS_PIN < 0
#error SS_PIN not defined! #error SS_PIN not defined!
#endif #endif

View File

@ -23,7 +23,7 @@
#if defined(STM32GENERIC) && defined(STM32F4) #if defined(STM32GENERIC) && defined(STM32F4)
#include "../HAL.h" #include "../HAL.h"
#include "HAL_timers_STM32F4.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -23,7 +23,7 @@
#if defined(STM32GENERIC) && defined(STM32F7) #if defined(STM32GENERIC) && defined(STM32F7)
#include "../HAL.h" #include "../HAL.h"
#include "HAL_timers_STM32F7.h" #include "timers.h"
// ------------------------ // ------------------------
// Local defines // Local defines

View File

@ -27,7 +27,7 @@
#if HAS_SERVOS #if HAS_SERVOS
#include "HAL_Servo_STM32_F4_F7.h" #include "Servo.h"
int8_t libServo::attach(const int pin) { int8_t libServo::attach(const int pin) {
if (this->servoIndex >= MAX_SERVOS) return -1; if (this->servoIndex >= MAX_SERVOS) return -1;

View File

@ -0,0 +1,310 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (c) 2017 Victor Perez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Fast I/O interfaces for STM32F4/7
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/
#ifndef PWM
#define PWM OUTPUT
#endif
#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)
#define _GET_MODE(IO)
#define _SET_MODE(IO,M) pinMode(IO, M)
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) _SET_MODE(IO, PWM)
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define PWM_PIN(P) true
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
//
// Pins Definitions
//
#define PORTA 0
#define PORTB 1
#define PORTC 2
#define PORTD 3
#define PORTE 4
#define PORTF 5
#define PORTG 6
#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
#undef PA0
#define PA0 _STM32_PIN(A, 0)
#undef PA1
#define PA1 _STM32_PIN(A, 1)
#undef PA2
#define PA2 _STM32_PIN(A, 2)
#undef PA3
#define PA3 _STM32_PIN(A, 3)
#undef PA4
#define PA4 _STM32_PIN(A, 4)
#undef PA5
#define PA5 _STM32_PIN(A, 5)
#undef PA6
#define PA6 _STM32_PIN(A, 6)
#undef PA7
#define PA7 _STM32_PIN(A, 7)
#undef PA8
#define PA8 _STM32_PIN(A, 8)
#undef PA9
#define PA9 _STM32_PIN(A, 9)
#undef PA10
#define PA10 _STM32_PIN(A, 10)
#undef PA11
#define PA11 _STM32_PIN(A, 11)
#undef PA12
#define PA12 _STM32_PIN(A, 12)
#undef PA13
#define PA13 _STM32_PIN(A, 13)
#undef PA14
#define PA14 _STM32_PIN(A, 14)
#undef PA15
#define PA15 _STM32_PIN(A, 15)
#undef PB0
#define PB0 _STM32_PIN(B, 0)
#undef PB1
#define PB1 _STM32_PIN(B, 1)
#undef PB2
#define PB2 _STM32_PIN(B, 2)
#undef PB3
#define PB3 _STM32_PIN(B, 3)
#undef PB4
#define PB4 _STM32_PIN(B, 4)
#undef PB5
#define PB5 _STM32_PIN(B, 5)
#undef PB6
#define PB6 _STM32_PIN(B, 6)
#undef PB7
#define PB7 _STM32_PIN(B, 7)
#undef PB8
#define PB8 _STM32_PIN(B, 8)
#undef PB9
#define PB9 _STM32_PIN(B, 9)
#undef PB10
#define PB10 _STM32_PIN(B, 10)
#undef PB11
#define PB11 _STM32_PIN(B, 11)
#undef PB12
#define PB12 _STM32_PIN(B, 12)
#undef PB13
#define PB13 _STM32_PIN(B, 13)
#undef PB14
#define PB14 _STM32_PIN(B, 14)
#undef PB15
#define PB15 _STM32_PIN(B, 15)
#undef PC0
#define PC0 _STM32_PIN(C, 0)
#undef PC1
#define PC1 _STM32_PIN(C, 1)
#undef PC2
#define PC2 _STM32_PIN(C, 2)
#undef PC3
#define PC3 _STM32_PIN(C, 3)
#undef PC4
#define PC4 _STM32_PIN(C, 4)
#undef PC5
#define PC5 _STM32_PIN(C, 5)
#undef PC6
#define PC6 _STM32_PIN(C, 6)
#undef PC7
#define PC7 _STM32_PIN(C, 7)
#undef PC8
#define PC8 _STM32_PIN(C, 8)
#undef PC9
#define PC9 _STM32_PIN(C, 9)
#undef PC10
#define PC10 _STM32_PIN(C, 10)
#undef PC11
#define PC11 _STM32_PIN(C, 11)
#undef PC12
#define PC12 _STM32_PIN(C, 12)
#undef PC13
#define PC13 _STM32_PIN(C, 13)
#undef PC14
#define PC14 _STM32_PIN(C, 14)
#undef PC15
#define PC15 _STM32_PIN(C, 15)
#undef PD0
#define PD0 _STM32_PIN(D, 0)
#undef PD1
#define PD1 _STM32_PIN(D, 1)
#undef PD2
#define PD2 _STM32_PIN(D, 2)
#undef PD3
#define PD3 _STM32_PIN(D, 3)
#undef PD4
#define PD4 _STM32_PIN(D, 4)
#undef PD5
#define PD5 _STM32_PIN(D, 5)
#undef PD6
#define PD6 _STM32_PIN(D, 6)
#undef PD7
#define PD7 _STM32_PIN(D, 7)
#undef PD8
#define PD8 _STM32_PIN(D, 8)
#undef PD9
#define PD9 _STM32_PIN(D, 9)
#undef PD10
#define PD10 _STM32_PIN(D, 10)
#undef PD11
#define PD11 _STM32_PIN(D, 11)
#undef PD12
#define PD12 _STM32_PIN(D, 12)
#undef PD13
#define PD13 _STM32_PIN(D, 13)
#undef PD14
#define PD14 _STM32_PIN(D, 14)
#undef PD15
#define PD15 _STM32_PIN(D, 15)
#undef PE0
#define PE0 _STM32_PIN(E, 0)
#undef PE1
#define PE1 _STM32_PIN(E, 1)
#undef PE2
#define PE2 _STM32_PIN(E, 2)
#undef PE3
#define PE3 _STM32_PIN(E, 3)
#undef PE4
#define PE4 _STM32_PIN(E, 4)
#undef PE5
#define PE5 _STM32_PIN(E, 5)
#undef PE6
#define PE6 _STM32_PIN(E, 6)
#undef PE7
#define PE7 _STM32_PIN(E, 7)
#undef PE8
#define PE8 _STM32_PIN(E, 8)
#undef PE9
#define PE9 _STM32_PIN(E, 9)
#undef PE10
#define PE10 _STM32_PIN(E, 10)
#undef PE11
#define PE11 _STM32_PIN(E, 11)
#undef PE12
#define PE12 _STM32_PIN(E, 12)
#undef PE13
#define PE13 _STM32_PIN(E, 13)
#undef PE14
#define PE14 _STM32_PIN(E, 14)
#undef PE15
#define PE15 _STM32_PIN(E, 15)
#ifdef STM32F7
#undef PORTF
#define PORTF 5
#undef PF0
#define PF0 _STM32_PIN(F, 0)
#undef PF1
#define PF1 _STM32_PIN(F, 1)
#undef PF2
#define PF2 _STM32_PIN(F, 2)
#undef PF3
#define PF3 _STM32_PIN(F, 3)
#undef PF4
#define PF4 _STM32_PIN(F, 4)
#undef PF5
#define PF5 _STM32_PIN(F, 5)
#undef PF6
#define PF6 _STM32_PIN(F, 6)
#undef PF7
#define PF7 _STM32_PIN(F, 7)
#undef PF8
#define PF8 _STM32_PIN(F, 8)
#undef PF9
#define PF9 _STM32_PIN(F, 9)
#undef PF10
#define PF10 _STM32_PIN(F, 10)
#undef PF11
#define PF11 _STM32_PIN(F, 11)
#undef PF12
#define PF12 _STM32_PIN(F, 12)
#undef PF13
#define PF13 _STM32_PIN(F, 13)
#undef PF14
#define PF14 _STM32_PIN(F, 14)
#undef PF15
#define PF15 _STM32_PIN(F, 15)
#undef PORTG
#define PORTG 6
#undef PG0
#define PG0 _STM32_PIN(G, 0)
#undef PG1
#define PG1 _STM32_PIN(G, 1)
#undef PG2
#define PG2 _STM32_PIN(G, 2)
#undef PG3
#define PG3 _STM32_PIN(G, 3)
#undef PG4
#define PG4 _STM32_PIN(G, 4)
#undef PG5
#define PG5 _STM32_PIN(G, 5)
#undef PG6
#define PG6 _STM32_PIN(G, 6)
#undef PG7
#define PG7 _STM32_PIN(G, 7)
#undef PG8
#define PG8 _STM32_PIN(G, 8)
#undef PG9
#define PG9 _STM32_PIN(G, 9)
#undef PG10
#define PG10 _STM32_PIN(G, 10)
#undef PG11
#define PG11 _STM32_PIN(G, 11)
#undef PG12
#define PG12 _STM32_PIN(G, 12)
#undef PG13
#define PG13 _STM32_PIN(G, 13)
#undef PG14
#define PG14 _STM32_PIN(G, 14)
#undef PG15
#define PG15 _STM32_PIN(G, 15)
#endif // STM32GENERIC && STM32F7

View File

@ -1,210 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (c) 2017 Victor Perez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Fast I/O interfaces for STM32F4/7
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/
#ifndef PWM
#define PWM OUTPUT
#endif
#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)
#define _GET_MODE(IO)
#define _SET_MODE(IO,M) pinMode(IO, M)
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) _SET_MODE(IO, PWM)
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define PWM_PIN(P) true
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
//
// Pins Definitions
//
#define PORTA 0
#define PORTB 1
#define PORTC 2
#define PORTD 3
#define PORTE 4
#define PORTF 5
#define PORTG 6
#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
#ifndef PA0
#define PA0 _STM32_PIN(A, 0)
#define PA1 _STM32_PIN(A, 1)
#define PA2 _STM32_PIN(A, 2)
#define PA3 _STM32_PIN(A, 3)
#define PA4 _STM32_PIN(A, 4)
#define PA5 _STM32_PIN(A, 5)
#define PA6 _STM32_PIN(A, 6)
#define PA7 _STM32_PIN(A, 7)
#define PA8 _STM32_PIN(A, 8)
#define PA9 _STM32_PIN(A, 9)
#define PA10 _STM32_PIN(A, 10)
#define PA11 _STM32_PIN(A, 11)
#define PA12 _STM32_PIN(A, 12)
#define PA13 _STM32_PIN(A, 13)
#define PA14 _STM32_PIN(A, 14)
#define PA15 _STM32_PIN(A, 15)
#endif
#ifndef PB0
#define PB0 _STM32_PIN(B, 0)
#define PB1 _STM32_PIN(B, 1)
#define PB2 _STM32_PIN(B, 2)
#define PB3 _STM32_PIN(B, 3)
#define PB4 _STM32_PIN(B, 4)
#define PB5 _STM32_PIN(B, 5)
#define PB6 _STM32_PIN(B, 6)
#define PB7 _STM32_PIN(B, 7)
#define PB8 _STM32_PIN(B, 8)
#define PB9 _STM32_PIN(B, 9)
#define PB10 _STM32_PIN(B, 10)
#define PB11 _STM32_PIN(B, 11)
#define PB12 _STM32_PIN(B, 12)
#define PB13 _STM32_PIN(B, 13)
#define PB14 _STM32_PIN(B, 14)
#define PB15 _STM32_PIN(B, 15)
#endif
#ifndef PC0
#define PC0 _STM32_PIN(C, 0)
#define PC1 _STM32_PIN(C, 1)
#define PC2 _STM32_PIN(C, 2)
#define PC3 _STM32_PIN(C, 3)
#define PC4 _STM32_PIN(C, 4)
#define PC5 _STM32_PIN(C, 5)
#define PC6 _STM32_PIN(C, 6)
#define PC7 _STM32_PIN(C, 7)
#define PC8 _STM32_PIN(C, 8)
#define PC9 _STM32_PIN(C, 9)
#define PC10 _STM32_PIN(C, 10)
#define PC11 _STM32_PIN(C, 11)
#define PC12 _STM32_PIN(C, 12)
#define PC13 _STM32_PIN(C, 13)
#define PC14 _STM32_PIN(C, 14)
#define PC15 _STM32_PIN(C, 15)
#endif
#ifndef PD0
#define PD0 _STM32_PIN(D, 0)
#define PD1 _STM32_PIN(D, 1)
#define PD2 _STM32_PIN(D, 2)
#define PD3 _STM32_PIN(D, 3)
#define PD4 _STM32_PIN(D, 4)
#define PD5 _STM32_PIN(D, 5)
#define PD6 _STM32_PIN(D, 6)
#define PD7 _STM32_PIN(D, 7)
#define PD8 _STM32_PIN(D, 8)
#define PD9 _STM32_PIN(D, 9)
#define PD10 _STM32_PIN(D, 10)
#define PD11 _STM32_PIN(D, 11)
#define PD12 _STM32_PIN(D, 12)
#define PD13 _STM32_PIN(D, 13)
#define PD14 _STM32_PIN(D, 14)
#define PD15 _STM32_PIN(D, 15)
#endif
#ifndef PE0
#define PE0 _STM32_PIN(E, 0)
#define PE1 _STM32_PIN(E, 1)
#define PE2 _STM32_PIN(E, 2)
#define PE3 _STM32_PIN(E, 3)
#define PE4 _STM32_PIN(E, 4)
#define PE5 _STM32_PIN(E, 5)
#define PE6 _STM32_PIN(E, 6)
#define PE7 _STM32_PIN(E, 7)
#define PE8 _STM32_PIN(E, 8)
#define PE9 _STM32_PIN(E, 9)
#define PE10 _STM32_PIN(E, 10)
#define PE11 _STM32_PIN(E, 11)
#define PE12 _STM32_PIN(E, 12)
#define PE13 _STM32_PIN(E, 13)
#define PE14 _STM32_PIN(E, 14)
#define PE15 _STM32_PIN(E, 15)
#endif
#ifdef STM32F7
#ifndef PF0
#define PORTF 5
#define PF0 _STM32_PIN(F, 0)
#define PF1 _STM32_PIN(F, 1)
#define PF2 _STM32_PIN(F, 2)
#define PF3 _STM32_PIN(F, 3)
#define PF4 _STM32_PIN(F, 4)
#define PF5 _STM32_PIN(F, 5)
#define PF6 _STM32_PIN(F, 6)
#define PF7 _STM32_PIN(F, 7)
#define PF8 _STM32_PIN(F, 8)
#define PF9 _STM32_PIN(F, 9)
#define PF10 _STM32_PIN(F, 10)
#define PF11 _STM32_PIN(F, 11)
#define PF12 _STM32_PIN(F, 12)
#define PF13 _STM32_PIN(F, 13)
#define PF14 _STM32_PIN(F, 14)
#define PF15 _STM32_PIN(F, 15)
#endif
#ifndef PG0
#define PORTG 6
#define PG0 _STM32_PIN(G, 0)
#define PG1 _STM32_PIN(G, 1)
#define PG2 _STM32_PIN(G, 2)
#define PG3 _STM32_PIN(G, 3)
#define PG4 _STM32_PIN(G, 4)
#define PG5 _STM32_PIN(G, 5)
#define PG6 _STM32_PIN(G, 6)
#define PG7 _STM32_PIN(G, 7)
#define PG8 _STM32_PIN(G, 8)
#define PG9 _STM32_PIN(G, 9)
#define PG10 _STM32_PIN(G, 10)
#define PG11 _STM32_PIN(G, 11)
#define PG12 _STM32_PIN(G, 12)
#define PG13 _STM32_PIN(G, 13)
#define PG14 _STM32_PIN(G, 14)
#define PG15 _STM32_PIN(G, 15)
#endif
#endif // STM32GENERIC && STM32F7

View File

@ -22,7 +22,7 @@
#pragma once #pragma once
#ifdef STM32F4 #ifdef STM32F4
#include "STM32F4/HAL_timers_STM32F4.h" #include "STM32F4/timers.h"
#else #else
#include "STM32F7/HAL_timers_STM32F7.h" #include "STM32F7/timers.h"
#endif #endif

View File

@ -26,7 +26,7 @@
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog_STM32_F4_F7.h" #include "watchdog.h"
IWDG_HandleTypeDef hiwdg; IWDG_HandleTypeDef hiwdg;

Some files were not shown because too many files have changed in this diff Show More