My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

Wire.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. TwoWire.h - TWI/I2C library for Arduino & Wiring
  3. Copyright (c) 2006 Nicholas Zambetti. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
  16. */
  17. // Modified for use with the mcp4451 digipot routine
  18. #ifdef TARGET_LPC1768
  19. #ifndef TwoWire_h
  20. #define TwoWire_h
  21. #include <inttypes.h>
  22. class TwoWire
  23. {
  24. public:
  25. // TwoWire();
  26. void begin();
  27. void beginTransmission(uint8_t);
  28. uint8_t endTransmission(void);
  29. size_t write(uint8_t);
  30. };
  31. //extern TwoWire Wire;//
  32. TwoWire Wire;
  33. ////////////////////////////////////////////////////////////////////////////////////////
  34. extern "C" uint8_t digipot_mcp4451_start(uint8_t sla);
  35. extern "C" void digipot_mcp4451_init(void);
  36. extern "C" uint8_t digipot_mcp4451_send_byte(uint8_t data);
  37. void TwoWire::beginTransmission(uint8_t sla) { digipot_mcp4451_start(sla);}
  38. void TwoWire::begin(void) {digipot_mcp4451_init();}
  39. size_t TwoWire::write(uint8_t data) {return digipot_mcp4451_send_byte(data);}
  40. uint8_t TwoWire::endTransmission(void) {return 1;}
  41. #endif
  42. #endif // TARGET_LPC1768