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.
 
 
 
 
 

70 line
2.0 KiB

  1. /*
  2. * wiringPi:
  3. * Arduino compatable (ish) Wiring library for the Raspberry Pi
  4. * Copyright (c) 2012 Gordon Henderson
  5. ***********************************************************************
  6. * This file is part of wiringPi:
  7. * https://projects.drogon.net/raspberry-pi/wiringpi/
  8. *
  9. * wiringPi is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * wiringPi is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  21. ***********************************************************************
  22. */
  23. // Handy defines
  24. #define NUM_PINS 17
  25. #define WPI_MODE_PINS 0
  26. #define WPI_MODE_GPIO 1
  27. #define WPI_MODE_GPIO_SYS 2
  28. #define INPUT 0
  29. #define OUTPUT 1
  30. #define PWM_OUTPUT 2
  31. #define LOW 0
  32. #define HIGH 1
  33. #define PUD_OFF 0
  34. #define PUD_DOWN 1
  35. #define PUD_UP 2
  36. // Function prototypes
  37. // c++ wrappers thanks to a commend by Nick Lott
  38. // (and others on the Raspberry Pi forums)
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. extern int wiringPiSetup (void) ;
  43. extern int wiringPiSetupSys (void) ;
  44. extern int wiringPiSetupGpio (void) ;
  45. extern void wiringPiGpioMode (int mode) ;
  46. extern void pullUpDnControl (int pin, int pud) ;
  47. extern void pinMode (int pin, int mode) ;
  48. extern void digitalWrite (int pin, int value) ;
  49. extern void pwmWrite (int pin, int value) ;
  50. extern int digitalRead (int pin) ;
  51. extern void delay (unsigned int howLong) ;
  52. extern void delayMicroseconds (unsigned int howLong) ;
  53. extern unsigned int millis (void) ;
  54. #ifdef __cplusplus
  55. }
  56. #endif