HAL whitespace and style cleanup
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
/* **************************************************************************
|
||||
|
||||
|
||||
Marlin 3D Printer Firmware
|
||||
Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
|
||||
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* **************************************************************************
|
||||
|
||||
|
||||
Marlin 3D Printer Firmware
|
||||
Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
|
@ -50,8 +50,8 @@
|
||||
#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20))
|
||||
|
||||
void HAL_print_analog_pin(char buffer[], int8_t pin) {
|
||||
if (pin <= 23) sprintf(buffer, "(A%2d) ", int(pin - 14));
|
||||
else if (pin <= 39) sprintf(buffer, "(A%2d) ", int(pin - 19));
|
||||
if (pin <= 23) sprintf(buffer, "(A%2d) ", int(pin - 14));
|
||||
else if (pin <= 39) sprintf(buffer, "(A%2d) ", int(pin - 19));
|
||||
}
|
||||
|
||||
void HAL_analog_pin_state(char buffer[], int8_t pin) {
|
||||
|
@ -33,20 +33,20 @@ void spiBegin(void) {
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 10000000; break;
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 312500; break;
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 10000000; break;
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 312500; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI libarary
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
SPI.begin();
|
||||
clock = 4000000; // Default from the SPI libarary
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* **************************************************************************
|
||||
|
||||
|
||||
Marlin 3D Printer Firmware
|
||||
Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
|
||||
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* **************************************************************************
|
||||
|
||||
|
||||
Marlin 3D Printer Firmware
|
||||
Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
|
@ -21,20 +21,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
This code contributed by Triffid_Hunter and modified by Kliment
|
||||
why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description: Fast IO functions for Teensy 3.5 and Teensy 3.6
|
||||
* Fast I/O Routines for Teensy 3.5 and Teensy 3.6
|
||||
* Use direct port manipulation to save scads of processor time.
|
||||
* Contributed by Triffid_Hunter. Modified by Kliment and the Marlin team.
|
||||
*/
|
||||
|
||||
#ifndef _FASTIO_TEENSY_H
|
||||
#define _FASTIO_TEENSY_H
|
||||
|
||||
/**
|
||||
utility functions
|
||||
*/
|
||||
#ifndef _FASTIO_TEENSY_H
|
||||
#define _FASTIO_TEENSY_H
|
||||
|
||||
#ifndef MASK
|
||||
#define MASK(PIN) (1 << PIN)
|
||||
@ -44,77 +37,50 @@
|
||||
#define GPIO_BITBAND(reg, bit) (*(uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)))
|
||||
|
||||
/**
|
||||
magic I/O routines
|
||||
now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0);
|
||||
*/
|
||||
* Magic I/O routines
|
||||
*
|
||||
* Now you can simply SET_OUTPUT(PIN); WRITE(PIN, HIGH); WRITE(PIN, LOW);
|
||||
*
|
||||
* Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
*/
|
||||
|
||||
/// Read a pin
|
||||
#define _READ(p) ((bool)(CORE_PIN ## p ## _PINREG & CORE_PIN ## p ## _BITMASK))
|
||||
|
||||
/// Write to a pin
|
||||
#define _WRITE(p, v) do { if (v) CORE_PIN ## p ## _PORTSET = CORE_PIN ## p ## _BITMASK; \
|
||||
else CORE_PIN ## p ## _PORTCLEAR = CORE_PIN ## p ## _BITMASK; } while (0)
|
||||
|
||||
/// toggle a pin
|
||||
#define _TOGGLE(p) (*(&(CORE_PIN ## p ## _PORTCLEAR)+1) = CORE_PIN ## p ## _BITMASK)
|
||||
#define _SET_INPUT(p) do { CORE_PIN ## p ## _CONFIG = PORT_PCR_MUX(1); \
|
||||
GPIO_BITBAND(CORE_PIN ## p ## _DDRREG , CORE_PIN ## p ## _BIT) = 0; \
|
||||
} while (0)
|
||||
#define _SET_OUTPUT(p) do { CORE_PIN ## p ## _CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE|PORT_PCR_DSE; \
|
||||
GPIO_BITBAND(CORE_PIN ## p ## _DDRREG , CORE_PIN ## p ## _BIT) = 1; \
|
||||
} while (0)
|
||||
|
||||
/// set pin as input
|
||||
#define _SET_INPUT(p) do { CORE_PIN ## p ## _CONFIG = PORT_PCR_MUX(1); \
|
||||
GPIO_BITBAND(CORE_PIN ## p ## _DDRREG , CORE_PIN ## p ## _BIT) = 0; \
|
||||
} while (0)
|
||||
/// set pin as output
|
||||
#define _SET_OUTPUT(p) do { CORE_PIN ## p ## _CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE|PORT_PCR_DSE; \
|
||||
GPIO_BITBAND(CORE_PIN ## p ## _DDRREG , CORE_PIN ## p ## _BIT) = 1; \
|
||||
} while (0)
|
||||
|
||||
/// set pin as input with pullup mode
|
||||
//#define _PULLUP(IO, v) { pinMode(IO, (v!=LOW ? INPUT_PULLUP : INPUT)); }
|
||||
|
||||
/// check if pin is an input
|
||||
#define _GET_INPUT(p) ((CORE_PIN ## p ## _DDRREG & CORE_PIN ## p ## _BITMASK) == 0)
|
||||
/// check if pin is an output
|
||||
#define _GET_OUTPUT(p) ((CORE_PIN ## p ## _DDRREG & CORE_PIN ## p ## _BITMASK) == 0)
|
||||
|
||||
/// check if pin is an timer
|
||||
//#define _GET_TIMER(IO)
|
||||
|
||||
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
|
||||
/// Read a pin wrapper
|
||||
#define READ(IO) _READ(IO)
|
||||
|
||||
/// Write to a pin wrapper
|
||||
#define WRITE_VAR(IO, v) _WRITE_VAR(IO, v)
|
||||
#define WRITE(IO, v) _WRITE(IO, v)
|
||||
|
||||
/// toggle a pin wrapper
|
||||
#define TOGGLE(IO) _TOGGLE(IO)
|
||||
|
||||
/// set pin as input wrapper
|
||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||
/// set pin as input with pullup wrapper
|
||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
|
||||
/// set pin as output wrapper
|
||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
||||
|
||||
/// check if pin is an input wrapper
|
||||
#define GET_INPUT(IO) _GET_INPUT(IO)
|
||||
/// check if pin is an output wrapper
|
||||
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
|
||||
|
||||
// Shorthand
|
||||
#define OUT_WRITE(IO, v) { SET_OUTPUT(IO); WRITE(IO, v); }
|
||||
|
||||
/**
|
||||
ports and functions
|
||||
|
||||
added as necessary or if I feel like it- not a comprehensive list!
|
||||
*/
|
||||
|
||||
/**
|
||||
pins
|
||||
*/
|
||||
* Ports, functions, and pins
|
||||
*/
|
||||
|
||||
#define DIO0_PIN 8
|
||||
|
||||
#endif /* _FASTIO_TEENSY_H */
|
||||
#endif /* _FASTIO_TEENSY_H */
|
||||
|
@ -23,9 +23,9 @@
|
||||
#ifndef SPI_PINS_H_
|
||||
#define SPI_PINS_H_
|
||||
|
||||
#define SCK_PIN 13
|
||||
#define MISO_PIN 12
|
||||
#define MOSI_PIN 11
|
||||
#define SS_PIN 20 //SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
#define SCK_PIN 13
|
||||
#define MISO_PIN 12
|
||||
#define MOSI_PIN 11
|
||||
#define SS_PIN 20 //SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
|
||||
#endif /* SPI_PINS_H_ */
|
||||
|
@ -21,19 +21,19 @@
|
||||
*/
|
||||
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
||||
#include "../../Marlin.h"
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include "watchdog_Teensy.h"
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
void watchdog_init() {
|
||||
WDOG_TOVALH = 0;
|
||||
WDOG_TOVALL = 4000;
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||
}
|
||||
#include "watchdog_Teensy.h"
|
||||
|
||||
#endif //USE_WATCHDOG
|
||||
void watchdog_init() {
|
||||
WDOG_TOVALH = 0;
|
||||
WDOG_TOVALL = 4000;
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // USE_WATCHDOG
|
||||
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||
|
Reference in New Issue
Block a user