Skip to content

AE22 milestone #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions cores/arduino/wiring_shift.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
wiring_shift.c - shiftOut() function
Part of Arduino - http://www.arduino.cc/
Copyright (c) 2005-2006 David A. Mellis"

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "Arduino.h"
#ifdef __cplusplus
extern "C" {
#endif


uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) {

uint32_t value = 0;
uint32_t i;
for (i = 0; i < 8 ; i++) {
digitalWrite(ulClockPin, HIGH);
if (ulBitOrder == LSBFIRST)
value |= digitalRead(ulDataPin) << i;
else
value |= digitalRead(ulDataPin) << (8-i);

digitalWrite(ulClockPin,LOW);
}

return value;

}


void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) {

int i;
for(i = 0; i < 8; i++) {
if(ulBitOrder == LSBFIRST)
digitalWrite(ulDataPin, !!(ulVal & (1 << i)));
else
digitalWrite(ulDataPin, !!(ulVal & (1 << (8-i))));

digitalWrite(ulClockPin, HIGH);
digitalWrite(ulClockPin, LOW);
}
}


#ifdef __cplusplus
}
#endif


Binary file modified variants/intel_edu_x/libarc32drv_edu.a
Binary file not shown.