My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

dac_mcp4728.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Arduino library for MicroChip MCP4728 I2C D/A converter.
  25. */
  26. #include "../../core/types.h"
  27. #include <Wire.h>
  28. #define defaultVDD DAC_STEPPER_MAX //was 5000 but differs with internal Vref
  29. #define BASE_ADDR 0x60
  30. #define RESET 0b00000110
  31. #define WAKE 0b00001001
  32. #define UPDATE 0b00001000
  33. #define MULTIWRITE 0b01000000
  34. #define SINGLEWRITE 0b01011000
  35. #define SEQWRITE 0b01010000
  36. #define VREFWRITE 0b10000000
  37. #define GAINWRITE 0b11000000
  38. #define POWERDOWNWRITE 0b10100000
  39. #define GENERALCALL 0b00000000
  40. #define GAINWRITE 0b11000000
  41. // This is taken from the original lib, makes it easy to edit if needed
  42. // DAC_OR_ADDRESS defined in pins_BOARD.h file
  43. #define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS)
  44. void mcp4728_init();
  45. uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value);
  46. uint8_t mcp4728_eepromWrite();
  47. uint8_t mcp4728_setVref_all(const uint8_t value);
  48. uint8_t mcp4728_setGain_all(const uint8_t value);
  49. uint16_t mcp4728_getValue(const uint8_t channel);
  50. uint8_t mcp4728_fastWrite();
  51. uint8_t mcp4728_simpleCommand(const byte simpleCommand);
  52. uint8_t mcp4728_getDrvPct(const uint8_t channel);
  53. void mcp4728_setDrvPct(xyze_uint8_t &pct);