General cleanups for HAL

This commit is contained in:
Scott Lahteine 2018-01-15 02:29:23 -06:00
parent 42933c804a
commit 2c18faf3e4
7 changed files with 70 additions and 70 deletions

View file

@ -1,18 +1,18 @@
#ifndef HAL_Servo_Teensy_h
#define HAL_Servo_Teensy_h
#ifndef _HAL_SERVO_TEENSY_H_
#define _HAL_SERVO_TEENSY_H_
#include <Servo.h>
// Inherit and expand on the official library
class libServo : public Servo {
public:
int8_t attach(const int pin);
int8_t attach(const int pin, const int min, const int max);
void move(const int value);
private:
uint16_t min_ticks;
uint16_t max_ticks;
uint8_t servoIndex; // index into the channel data for this servo
public:
int8_t attach(const int pin);
int8_t attach(const int pin, const int min, const int max);
void move(const int value);
private:
uint16_t min_ticks;
uint16_t max_ticks;
uint8_t servoIndex; // index into the channel data for this servo
};
#endif // HAL_Servo_Teensy_h
#endif // _HAL_SERVO_TEENSY_H_

View file

@ -45,7 +45,7 @@ void endstop_ISR(void) { endstop_ISR_worker(); }
#elif IS_32BIT_TEENSY
#include "HAL_TEENSY35_36/endstop_interrupts.h"
#elif defined(STM32F7)
#include "HAL_STM32F7/endstop_interrupts.h"

View file

@ -97,13 +97,13 @@ extern const char errormagic[] PROGMEM;
#endif
#define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n')
#define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_CHAR_P(p,x)
#define SERIAL_PROTOCOLPGM_P(p,x) (serialprintPGM_P(p,PSTR(x)))
#define SERIAL_PROTOCOLLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n")))
#define SERIAL_PROTOCOLPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value)))
#define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) do { SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); } while(0)
#define SERIAL_ECHO_START_P(p) (serialprintPGM_P(p,echomagic))
#define SERIAL_ECHO_P(p,x) SERIAL_PROTOCOL_P(p,x)
#define SERIAL_ECHOPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x)
@ -112,13 +112,13 @@ extern const char errormagic[] PROGMEM;
#define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_PROTOCOLPAIR_P(p, pre, value)
#define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, value)
#define SERIAL_ECHO_F_P(p,x,y) SERIAL_PROTOCOL_F_P(p,x,y)
#define SERIAL_ERROR_START_P(p) (serialprintPGM_P(p,errormagic))
#define SERIAL_ERROR_P(p,x) SERIAL_PROTOCOL_P(p,x)
#define SERIAL_ERRORPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x)
#define SERIAL_ERRORLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x)
#define SERIAL_ERRORLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x)
// These macros compensate for float imprecision
#define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_P(p, pre, FIXFLOAT(value))
#define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, FIXFLOAT(value))
@ -149,7 +149,7 @@ extern const char errormagic[] PROGMEM;
#define SERIAL_PROTOCOL_F_P(p,x,y) SERIAL_PROTOCOL_F(x,y)
#define SERIAL_PROTOCOLLN_P(p,x) SERIAL_PROTOCOLLN(x)
#define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b)
#define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b)
#define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b)
#define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args)
#define SERIAL_CHAR(x) MYSERIAL0.write(x)
@ -168,13 +168,13 @@ extern const char errormagic[] PROGMEM;
#endif
#define SERIAL_EOL_P(p) SERIAL_EOL()
#define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_PROTOCOLCHAR(x)
#define SERIAL_PROTOCOLPGM_P(p,x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_PROTOCOLLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_PROTOCOLPAIR_P(p, pre, value) SERIAL_PROTOCOLPAIR(pre, value)
#define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) SERIAL_PROTOCOLLNPAIR(pre, value)
#define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START()
#define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x)
#define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x)
@ -183,13 +183,13 @@ extern const char errormagic[] PROGMEM;
#define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_ECHOPAIR(pre, value)
#define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_ECHOLNPAIR(pre, value)
#define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y)
#define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START()
#define SERIAL_ERROR_P(p,x) SERIAL_ERROR(x)
#define SERIAL_ERRORPGM_P(p,x) SERIAL_ERRORPGM(x)
#define SERIAL_ERRORLN_P(p,x) SERIAL_ERRORLN(x)
#define SERIAL_ERRORLNPGM_P(p,x) SERIAL_ERRORLNPGM(x)
// These macros compensate for float imprecision
#define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_F(pre, value)
#define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_F(pre, value)

View file

@ -31,7 +31,7 @@
* M122: Debug TMC drivers
*/
void GcodeSuite::M122() {
if (parser.seen('S'))
if (parser.seen('S'))
tmc_set_report_status(parser.value_bool());
else
tmc_report_all();

View file

@ -254,7 +254,7 @@ static bool serial_data_available() {
static int read_serial(const int index) {
switch (index) {
case 0: return MYSERIAL0.read();
#if NUM_SERIAL > 1
#if NUM_SERIAL > 1
case 1: return MYSERIAL1.read();
#endif
default: return -1;

View file

@ -109,7 +109,7 @@ void GcodeSuite::M26() {
/**
* M27: Get SD Card status
*/
void GcodeSuite::M27() {
void GcodeSuite::M27() {
card.getStatus(
#if NUM_SERIAL > 1
command_queue_port[cmd_queue_index_r]

View file

@ -73,7 +73,7 @@
#define STEPPER_ENABLE_PIN _STM32_PIN(PORTE, 0)
#define X_STEP_PIN _STM32_PIN(PORTC, 6) //96, 39 in arduino
#define X_STEP_PIN _STM32_PIN(PORTC, 6) //96, 39 in arduino
#define X_DIR_PIN _STM32_PIN(PORTC, 7)
#define X_ENABLE_PIN _STM32_PIN(PORTC, 8)
@ -111,17 +111,17 @@
#define SCK_PIN _STM32_PIN(PORTA, 5)
#define MISO_PIN _STM32_PIN(PORTA, 6)
#define MOSI_PIN _STM32_PIN(PORTA, 7)
#define SCK_PIN _STM32_PIN(PORTA, 5)
#define MISO_PIN _STM32_PIN(PORTA, 6)
#define MOSI_PIN _STM32_PIN(PORTA, 7)
#define SPI1_SCK_PIN _STM32_PIN(PORTA, 5)
#define SPI1_MISO_PIN _STM32_PIN(PORTA, 6)
#define SPI1_MOSI_PIN _STM32_PIN(PORTA, 7)
#define SPI1_SCK_PIN _STM32_PIN(PORTA, 5)
#define SPI1_MISO_PIN _STM32_PIN(PORTA, 6)
#define SPI1_MOSI_PIN _STM32_PIN(PORTA, 7)
#define SPI6_SCK_PIN _STM32_PIN(PORTG, 13)
#define SPI6_MISO_PIN _STM32_PIN(PORTG, 12)
#define SPI6_MOSI_PIN _STM32_PIN(PORTG, 14)
#define SPI6_SCK_PIN _STM32_PIN(PORTG, 13)
#define SPI6_MISO_PIN _STM32_PIN(PORTG, 12)
#define SPI6_MOSI_PIN _STM32_PIN(PORTG, 14)
@ -130,36 +130,36 @@
// Temperature Sensors
//
#define TEMP_0_PIN _STM32_PIN(PORTC, 3) // Analog Input
#define TEMP_1_PIN _STM32_PIN(PORTC, 2) // Analog Input
#define TEMP_2_PIN _STM32_PIN(PORTC, 1) // Analog Input
#define TEMP_3_PIN _STM32_PIN(PORTC, 0) // Analog Input
#define TEMP_0_PIN _STM32_PIN(PORTC, 3) // Analog Input
#define TEMP_1_PIN _STM32_PIN(PORTC, 2) // Analog Input
#define TEMP_2_PIN _STM32_PIN(PORTC, 1) // Analog Input
#define TEMP_3_PIN _STM32_PIN(PORTC, 0) // Analog Input
#define TEMP_BED_PIN _STM32_PIN(PORTF, 10) // Analog Input
#define TEMP_BED_PIN _STM32_PIN(PORTF, 10) // Analog Input
#define TEMP_5_PIN _STM32_PIN(PORTE, 12) // Analog Input, Probe temp
#define TEMP_5_PIN _STM32_PIN(PORTE, 12) // Analog Input, Probe temp
//
// Heaters / Fans
//
#define HEATER_0_PIN _STM32_PIN(PORTD, 15)
#define HEATER_1_PIN _STM32_PIN(PORTD, 14)
#define HEATER_BED_PIN _STM32_PIN(PORTF, 6)
#define HEATER_0_PIN _STM32_PIN(PORTD, 15)
#define HEATER_1_PIN _STM32_PIN(PORTD, 14)
#define HEATER_BED_PIN _STM32_PIN(PORTF, 6)
#define FAN_PIN _STM32_PIN(PORTD, 13)
#define FAN1_PIN _STM32_PIN(PORTA, 0)
#define FAN2_PIN _STM32_PIN(PORTA, 1)
#define FAN_PIN _STM32_PIN(PORTD, 13)
#define FAN1_PIN _STM32_PIN(PORTA, 0)
#define FAN2_PIN _STM32_PIN(PORTA, 1)
//#define E0_AUTO_FAN_PIN _STM32_PIN(PORTA, 1)
//#define E0_AUTO_FAN_PIN _STM32_PIN(PORTA, 1)
//
// Misc. Functions
//
//#define CASE_LIGHT_PIN_CI _STM32_PIN(PORTF, 13) //
//#define CASE_LIGHT_PIN_DO _STM32_PIN(PORTF, 14) //
//#define NEOPIXEL_PIN _STM32_PIN(PORTF, 13)
//#define CASE_LIGHT_PIN_CI _STM32_PIN(PORTF, 13) //
//#define CASE_LIGHT_PIN_DO _STM32_PIN(PORTF, 14) //
//#define NEOPIXEL_PIN _STM32_PIN(PORTF, 13)
//
// Prusa i3 MK2 Multi Material Multiplexer Support
@ -172,37 +172,37 @@
// Servos
//
#define SERVO0_PIN _STM32_PIN(PORTE, 13)
#define SERVO1_PIN _STM32_PIN(PORTE, 14)
#define SERVO0_PIN _STM32_PIN(PORTE, 13)
#define SERVO1_PIN _STM32_PIN(PORTE, 14)
#define SDSS _STM32_PIN(PORTA, 8)
#define SS_PIN _STM32_PIN(PORTA, 8)
#define LED_PIN _STM32_PIN(PORTA, 2) //Alive
#define SS_PIN _STM32_PIN(PORTA, 8)
#define LED_PIN _STM32_PIN(PORTA, 2) //Alive
#define PS_ON_PIN _STM32_PIN(PORTA, 3)
#define KILL_PIN -1//_STM32_PIN(PORTD, 5) //EXP2-10
#define PWR_LOSS _STM32_PIN(PORTG, 5) //Power loss / nAC_FAULT
#define KILL_PIN -1//_STM32_PIN(PORTD, 5) //EXP2-10
#define PWR_LOSS _STM32_PIN(PORTG, 5) //Power loss / nAC_FAULT
//
//MAX7219_DEBUG
//
#define MAX7219_CLK_PIN _STM32_PIN(PORTG, 10) //EXP1-1
#define MAX7219_DIN_PIN _STM32_PIN(PORTD, 7) //EXP1-3
#define MAX7219_LOAD_PIN _STM32_PIN(PORTD, 1) //EXP1-5
#define MAX7219_CLK_PIN _STM32_PIN(PORTG, 10) //EXP1-1
#define MAX7219_DIN_PIN _STM32_PIN(PORTD, 7) //EXP1-3
#define MAX7219_LOAD_PIN _STM32_PIN(PORTD, 1) //EXP1-5
//#define NEOPIXEL_PIN 4
//
// LCD / Controller
//
//#define SD_DETECT_PIN -1 //_STM32_PIN(PORTB, 6)) //EXP2-4
#define BEEPER_PIN _STM32_PIN(PORTG, 10) //EXP1-1
#define LCD_PINS_RS _STM32_PIN(PORTG, 9) //EXP1-4
#define LCD_PINS_ENABLE _STM32_PIN(PORTD, 7) //EXP1-3
#define LCD_PINS_D4 _STM32_PIN(PORTD, 1) //EXP1-5
#define LCD_PINS_D5 _STM32_PIN(PORTF, 0) //EXP1-6
#define LCD_PINS_D6 _STM32_PIN(PORTD, 3) //EXP1-7
#define LCD_PINS_D7 _STM32_PIN(PORTD, 4) //EXP1-8
#define BTN_EN1 _STM32_PIN(PORTD, 6) //EXP2-5
#define BTN_EN2 _STM32_PIN(PORTD, 0) //EXP2-3
#define BTN_ENC _STM32_PIN(PORTG, 11) //EXP1-2
//#define SD_DETECT_PIN -1 //_STM32_PIN(PORTB, 6)) //EXP2-4
#define BEEPER_PIN _STM32_PIN(PORTG, 10) //EXP1-1
#define LCD_PINS_RS _STM32_PIN(PORTG, 9) //EXP1-4
#define LCD_PINS_ENABLE _STM32_PIN(PORTD, 7) //EXP1-3
#define LCD_PINS_D4 _STM32_PIN(PORTD, 1) //EXP1-5
#define LCD_PINS_D5 _STM32_PIN(PORTF, 0) //EXP1-6
#define LCD_PINS_D6 _STM32_PIN(PORTD, 3) //EXP1-7
#define LCD_PINS_D7 _STM32_PIN(PORTD, 4) //EXP1-8
#define BTN_EN1 _STM32_PIN(PORTD, 6) //EXP2-5
#define BTN_EN2 _STM32_PIN(PORTD, 0) //EXP2-3
#define BTN_ENC _STM32_PIN(PORTG, 11) //EXP1-2