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

wiring.h 3.5KB

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$
  18. */
  19. #ifndef Wiring_h
  20. #define Wiring_h
  21. #include <avr/io.h>
  22. #include <stdlib.h>
  23. #include "binary.h"
  24. #ifdef __cplusplus
  25. extern "C"{
  26. #endif
  27. #define HIGH 0x1
  28. #define LOW 0x0
  29. #define INPUT 0x0
  30. #define OUTPUT 0x1
  31. #define true 0x1
  32. #define false 0x0
  33. #define PI 3.1415926535897932384626433832795
  34. #define HALF_PI 1.5707963267948966192313216916398
  35. #define TWO_PI 6.283185307179586476925286766559
  36. #define DEG_TO_RAD 0.017453292519943295769236907684886
  37. #define RAD_TO_DEG 57.295779513082320876798154814105
  38. #define SERIAL 0x0
  39. #define DISPLAY 0x1
  40. #define LSBFIRST 0
  41. #define MSBFIRST 1
  42. #define CHANGE 1
  43. #define FALLING 2
  44. #define RISING 3
  45. #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  46. #define INTERNAL1V1 2
  47. #define INTERNAL2V56 3
  48. #else
  49. #define INTERNAL 3
  50. #endif
  51. #define DEFAULT 1
  52. #define EXTERNAL 0
  53. // undefine stdlib's abs if encountered
  54. #ifdef abs
  55. #undef abs
  56. #endif
  57. #define min(a,b) ((a)<(b)?(a):(b))
  58. #define max(a,b) ((a)>(b)?(a):(b))
  59. #define abs(x) ((x)>0?(x):-(x))
  60. #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
  61. #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
  62. #define radians(deg) ((deg)*DEG_TO_RAD)
  63. #define degrees(rad) ((rad)*RAD_TO_DEG)
  64. #define sq(x) ((x)*(x))
  65. #define interrupts() sei()
  66. #define noInterrupts() cli()
  67. #define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
  68. #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
  69. #define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
  70. #define lowByte(w) ((uint8_t) ((w) & 0xff))
  71. #define highByte(w) ((uint8_t) ((w) >> 8))
  72. #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
  73. #define bitSet(value, bit) ((value) |= (1UL << (bit)))
  74. #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
  75. #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
  76. typedef unsigned int word;
  77. #define bit(b) (1UL << (b))
  78. typedef uint8_t boolean;
  79. typedef uint8_t byte;
  80. void init(void);
  81. void pinMode(uint8_t, uint8_t);
  82. void digitalWrite(uint8_t, uint8_t);
  83. int digitalRead(uint8_t);
  84. int analogRead(uint8_t);
  85. void analogReference(uint8_t mode);
  86. void analogWrite(uint8_t, int);
  87. unsigned long millis(void);
  88. unsigned long micros(void);
  89. void delay(unsigned long);
  90. void delayMicroseconds(unsigned int us);
  91. unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
  92. void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
  93. uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
  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