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_private.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. wiring_private.h - Internal header file.
  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 239 2007-01-12 17:58:39Z mellis $
  18. */
  19. #ifndef WiringPrivate_h
  20. #define WiringPrivate_h
  21. #include <avr/io.h>
  22. #include <avr/interrupt.h>
  23. #include <stdio.h>
  24. #include <stdarg.h>
  25. #include "wiring.h"
  26. #if F_CPU == 16000000L
  27. #define ADC_PRESCALER 0x07
  28. #define CPU_PRESCALER 0x00
  29. #elif F_CPU == 8000000L
  30. #define ADC_PRESCALER 0x06
  31. #define CPU_PRESCALER 0x01
  32. #elif F_CPU == 4000000L
  33. #define ADC_PRESCALER 0x05
  34. #define CPU_PRESCALER 0x02
  35. #elif F_CPU == 2000000L
  36. #define ADC_PRESCALER 0x04
  37. #define CPU_PRESCALER 0x03
  38. #elif F_CPU == 1000000L
  39. #define ADC_PRESCALER 0x03
  40. #define CPU_PRESCALER 0x04
  41. #else
  42. #error "Teensyduino only supports 16, 8, 4, 2, 1 MHz. Please edit boards.txt"
  43. #endif
  44. #ifdef __cplusplus
  45. extern "C"{
  46. #endif
  47. #ifndef cbi
  48. #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
  49. #endif
  50. #ifndef sbi
  51. #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
  52. #endif
  53. typedef void (*voidFuncPtr)(void);
  54. #ifdef __cplusplus
  55. } // extern "C"
  56. #endif
  57. #endif