Browse Source

Move macros, add ENABLED/DISABLED, add includes

pull/1/head
Scott Lahteine 10 years ago
committed by Richard Wackerbarth
parent
commit
d85861d296
  1. 1
      Marlin/Configuration.h
  2. 8
      Marlin/Marlin.h
  3. 1
      Marlin/configurator/config/Configuration.h
  4. 1
      Marlin/example_configurations/Felix/Configuration.h
  5. 1
      Marlin/example_configurations/Felix/Configuration_DUAL.h
  6. 1
      Marlin/example_configurations/Hephestos/Configuration.h
  7. 1
      Marlin/example_configurations/K8200/Configuration.h
  8. 1
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  9. 1
      Marlin/example_configurations/RigidBot/Configuration.h
  10. 1
      Marlin/example_configurations/SCARA/Configuration.h
  11. 1
      Marlin/example_configurations/WITBOX/Configuration.h
  12. 1
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  13. 1
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  14. 1
      Marlin/example_configurations/delta/generic/Configuration.h
  15. 1
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  16. 1
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  17. 1
      Marlin/example_configurations/makibox/Configuration.h
  18. 1
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  19. 25
      Marlin/macros.h
  20. 2
      Marlin/stepper_indirection.h

1
Marlin/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

8
Marlin/Marlin.h

@ -28,14 +28,6 @@
#include "Arduino.h"
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI)
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
#define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
typedef unsigned long millis_t;
// Arduino < 1.0.0 does not define this, so we need to do it ourselves

1
Marlin/configurator/config/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/Felix/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/Felix/Configuration_DUAL.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/Hephestos/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/K8200/Configuration.h

@ -7,6 +7,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/RigidBot/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/SCARA/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/WITBOX/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/adafruit/ST7565/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/delta/biv2.5/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/delta/generic/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/delta/kossel_mini/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/delta/kossel_pro/Configuration.h

@ -6,6 +6,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/makibox/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

1
Marlin/example_configurations/tvrrug/Round2/Configuration.h

@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================

25
Marlin/macros.h

@ -0,0 +1,25 @@
#ifndef MACROS_H
#define MACROS_H
// Macros for bit masks
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
// Macros for maths shortcuts
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI)
// Macros to contrain values
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
#define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
// Macros to support option testing
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_0 0
#define SWITCH_ENABLED_1 1
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
#endif //__MACROS_H

2
Marlin/stepper_indirection.h

@ -22,6 +22,8 @@
#ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H
#include "macros.h"
// X motor
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)

Loading…
Cancel
Save