Skip to content

Commit

Permalink
Move hello_ucossii.c to hello_ucossii.cpp
Browse files Browse the repository at this point in the history
Conflicts:

	Quartus/BioLock.qsf
	Software/BioLock/Makefile
	Software/BioLock/hello_ucosii.cpp
  • Loading branch information
berickson1 committed Mar 30, 2014
1 parent 24b0bde commit a9cb100
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ZFMComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ char ZFMComm::storeFinger(int id){
char address[4] = {0xFF, 0xFF, 0xFF, 0xFF};
writePacket(address, &ZFM_PKG_CMD, &ZFM_CMD_CAPTURE_FINGER, 1);
char reply[12];
if(readPacket(reply, 12) == -1){
return -1;
}
return reply[10];
//if(readPacket(reply, 12) == -1){
// return -1;
//}
return 1;//reply[10];
}

int ZFMComm::writePacket(const char* address, const char* ptype, const char* data, uint len){
uint pktSize = 11 + len;
uint pktSize = ZFMFIXEDPACKETSIZE + len;
char *buffer = (char*)malloc(pktSize),
*bufferPtr = buffer;
int retval;
Expand All @@ -51,15 +51,15 @@ int ZFMComm::writePacket(const char* address, const char* ptype, const char* dat

//Data Length - 2B
//Add 2 because len does not include checksum
*bufferPtr++ = (char) len+2 >> 8;
checksum += (char) len+2 >> 8;
*bufferPtr++ = (char) len+2;
checksum += (char) len+2;
*bufferPtr++ = (char) ((len + ZFMCHECKSUMSIZE) >> 8);
checksum += (char) ((len + ZFMCHECKSUMSIZE) >> 8);
*bufferPtr++ = (char) (len + ZFMCHECKSUMSIZE);
checksum += (char) (len + ZFMCHECKSUMSIZE);

//Data - lenB
for(uint i = 0; i > len; i++){
*bufferPtr++ = data[len - i];
checksum += data[len - i];
for(uint i = 0; i < len; i++){
*bufferPtr++ = data[len - 1 - i];
checksum += data[len - 1 - i];
}

//Checksum -2B
Expand Down
3 changes: 3 additions & 0 deletions ZFMComm.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#ifndef ZFMCOMM_H_
#define ZFMCOMM_H_

#define ZFMFIXEDPACKETSIZE 11
#define ZFMCHECKSUMSIZE 2

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down

0 comments on commit a9cb100

Please sign in to comment.