twi.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. twi.h - Software I2C library for ESP31B
  3. Copyright (c) 2015 Hristo Gochkov. All rights reserved.
  4. This file is part of the ESP31B core for Arduino environment.
  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 Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. */
  17. #ifndef SI2C_h
  18. #define SI2C_h
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. void twi_init(unsigned char sda, unsigned char scl);
  23. void twi_stop(void);
  24. void twi_setClock(unsigned int freq);
  25. uint8_t twi_writeTo(unsigned char address, unsigned char * buf, unsigned int len, unsigned char sendStop);
  26. uint8_t twi_readFrom(unsigned char address, unsigned char * buf, unsigned int len, unsigned char sendStop);
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif