My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

wiring.h 3.6KB

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