My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wiring.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. wiring.h - Partial implementation of the Wiring API for the ATmega8.
  3. Part of Arduino - http://www.arduino.cc/
  4. Copyright (c) 2005-2006 David A. Mellis
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General
  14. Public License along with this library; if not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  16. Boston, MA 02111-1307 USA
  17. $Id$
  18. */
  19. #ifndef Wiring_h
  20. #define Wiring_h
  21. #include <math.h>
  22. #include <avr/io.h>
  23. #include <stdlib.h>
  24. #include "binary.h"
  25. #ifdef __cplusplus
  26. extern "C"{
  27. #endif
  28. #define HIGH 0x1
  29. #define LOW 0x0
  30. #define INPUT 0x0
  31. #define OUTPUT 0x1
  32. #define true 0x1
  33. #define false 0x0
  34. #define PI 3.1415926535897932384626433832795
  35. #define HALF_PI 1.5707963267948966192313216916398
  36. #define TWO_PI 6.283185307179586476925286766559
  37. #define DEG_TO_RAD 0.017453292519943295769236907684886
  38. #define RAD_TO_DEG 57.295779513082320876798154814105
  39. #define SERIAL 0x0
  40. #define DISPLAY 0x1
  41. #define LSBFIRST 0
  42. #define MSBFIRST 1
  43. #define CHANGE 1
  44. #define FALLING 2
  45. #define RISING 3
  46. #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  47. #define INTERNAL1V1 2
  48. #define INTERNAL2V56 3
  49. #else
  50. #define INTERNAL 3
  51. #endif
  52. #define DEFAULT 1
  53. #define EXTERNAL 0
  54. // undefine stdlib's abs if encountered
  55. #ifdef abs
  56. #undef abs
  57. #endif
  58. #define min(a,b) ((a)<(b)?(a):(b))
  59. #define max(a,b) ((a)>(b)?(a):(b))
  60. #define abs(x) ((x)>0?(x):-(x))
  61. #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
  62. #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
  63. #define radians(deg) ((deg)*DEG_TO_RAD)
  64. #define degrees(rad) ((rad)*RAD_TO_DEG)
  65. #define sq(x) ((x)*(x))
  66. #define interrupts() sei()
  67. #define noInterrupts() cli()
  68. #define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
  69. #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
  70. #define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
  71. #define lowByte(w) ((uint8_t) ((w) & 0xff))
  72. #define highByte(w) ((uint8_t) ((w) >> 8))
  73. #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
  74. #define bitSet(value, bit) ((value) |= (1UL << (bit)))
  75. #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
  76. #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
  77. typedef unsigned int word;
  78. #define bit(b) (1UL << (b))
  79. typedef uint8_t boolean;
  80. typedef uint8_t byte;
  81. void init(void);
  82. void pinMode(uint8_t, uint8_t);
  83. void digitalWrite(uint8_t, uint8_t);
  84. int digitalRead(uint8_t);
  85. int analogRead(uint8_t);
  86. void analogReference(uint8_t mode);
  87. void analogWrite(uint8_t, int);
  88. unsigned long millis(void);
  89. unsigned long micros(void);
  90. void delay(unsigned long);
  91. void delayMicroseconds(unsigned int us);
  92. unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
  93. void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
  94. uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
  95. void attachInterrupt(uint8_t, void (*)(void), int mode);
  96. void detachInterrupt(uint8_t);
  97. void setup(void);
  98. void loop(void);
  99. #ifdef __cplusplus
  100. } // extern "C"
  101. #endif
  102. #endif