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.

wiring_shift.c 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. wiring_shift.c - shiftOut() function
  3. Part of Arduino - http://www.arduino.cc/
  4. Copyright (c) 2005-2006 David A. Mellis
  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
  14. Public License along with this library; if not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  16. Boston, MA 02111-1307 USA
  17. $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
  18. */
  19. #include "wiring_private.h"
  20. void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val)
  21. {
  22. int i;
  23. for (i = 0; i < 8; i++) {
  24. if (bitOrder == LSBFIRST)
  25. digitalWrite(dataPin, !!(val & (1 << i)));
  26. else
  27. digitalWrite(dataPin, !!(val & (1 << (7 - i))));
  28. digitalWrite(clockPin, HIGH);
  29. digitalWrite(clockPin, LOW);
  30. }
  31. }