ads1115.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * ads1115.c:
  3. * Extend wiringPi with the ADS1115 I2C 16-bit ADC
  4. * Copyright (c) 2016 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 Lesser General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (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 Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with wiringPi.
  21. * If not, see <http://www.gnu.org/licenses/>.
  22. ***********************************************************************
  23. */
  24. // Constants for some of the internal functions
  25. // Gain
  26. #define ADS1115_GAIN_6 0
  27. #define ADS1115_GAIN_4 1
  28. #define ADS1115_GAIN_2 2
  29. #define ADS1115_GAIN_1 3
  30. #define ADS1115_GAIN_HALF 4
  31. #define ADS1115_GAIN_QUARTER 5
  32. // Data rate
  33. #define ADS1115_DR_8 0
  34. #define ADS1115_DR_16 1
  35. #define ADS1115_DR_32 2
  36. #define ADS1115_DR_64 3
  37. #define ADS1115_DR_128 4
  38. #define ADS1115_DR_250 5
  39. #define ADS1115_DR_475 6
  40. #define ADS1115_DR_860 7
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. extern int ads1115Setup (int pinBase, int i2cAddress) ;
  45. #ifdef __cplusplus
  46. }
  47. #endif