Move macros, add ENABLED/DISABLED, add includes

master
Scott Lahteine 9 years ago committed by Richard Wackerbarth
parent 17960fd2b0
commit d85861d296

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

@ -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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -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

@ -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