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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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: wiring.h 387 2008-03-08 21:30:00Z mellis $
  18. */
  19. #ifndef Wiring_h
  20. #define Wiring_h
  21. #include <avr/io.h>
  22. #include "binary.h"
  23. #ifdef __cplusplus
  24. extern "C"{
  25. #endif
  26. #define HIGH 0x1
  27. #define LOW 0x0
  28. #define INPUT 0x0
  29. #define OUTPUT 0x1
  30. #define true 0x1
  31. #define false 0x0
  32. #define PI 3.14159265
  33. #define HALF_PI 1.57079
  34. #define TWO_PI 6.283185
  35. #define DEG_TO_RAD 0.01745329
  36. #define RAD_TO_DEG 57.2957786
  37. #define SERIAL 0x0
  38. #define DISPLAY 0x1
  39. #define LSBFIRST 0
  40. #define MSBFIRST 1
  41. #define CHANGE 1
  42. #define FALLING 2
  43. #define RISING 3
  44. #define INTERNAL 3
  45. #define DEFAULT 1
  46. #define EXTERNAL 0
  47. // undefine stdlib's abs if encountered
  48. #ifdef abs
  49. #undef abs
  50. #endif
  51. #define min(a,b) ((a)<(b)?(a):(b))
  52. #define max(a,b) ((a)>(b)?(a):(b))
  53. #define abs(x) ((x)>0?(x):-(x))
  54. #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
  55. #if __AVR_LIBC_VERSION__ < 10701UL
  56. #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
  57. #endif
  58. #define radians(deg) ((deg)*DEG_TO_RAD)
  59. #define degrees(rad) ((rad)*RAD_TO_DEG)
  60. #define sq(x) ((x)*(x))
  61. #define interrupts() sei()
  62. #define noInterrupts() cli()
  63. #define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
  64. #define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
  65. #define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
  66. #define lowByte(w) ((w) & 0xff)
  67. #define highByte(w) ((w) >> 8)
  68. #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
  69. #define bitSet(value, bit) ((value) |= (1UL << (bit)))
  70. #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
  71. #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
  72. typedef unsigned int word;
  73. #define bit(b) (1 << (b))
  74. typedef uint8_t boolean;
  75. typedef uint8_t byte;
  76. void init(void);
  77. void pinMode(uint8_t, uint8_t);
  78. void digitalWrite(uint8_t, uint8_t);
  79. int digitalRead(uint8_t);
  80. int analogRead(uint8_t);
  81. void analogReference(uint8_t mode);
  82. void analogWrite(uint8_t, int);
  83. void beginSerial(uint8_t, long);
  84. void serialWrite(uint8_t, unsigned char);
  85. int serialAvailable(uint8_t);
  86. int serialRead(uint8_t);
  87. void serialFlush(uint8_t);
  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, byte val);
  94. void attachInterrupt(uint8_t, void (*)(void), int mode);
  95. void detachInterrupt(uint8_t);
  96. void setup(void);
  97. void loop(void);
  98. #ifdef __cplusplus
  99. } // extern "C"
  100. #endif
  101. #endif