File: C:\M91449\Perso\RTWdsPIC\Developpements\Forum\resodad_john\myFolder\SDtroubleshooting\CustomSD.c1 #include <p32xxxx.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <stdio.h> 5 #include "FSconfig.h" 6 #include "HardwareProfile.h" 7 #include "GenericTypeDefs.h" 8 #include "FSIO.h" 9 10 #define NumRetries 10 11 12 FSFILE * filePtr; 13 14 15 unsigned char FS_init_loop(void){ 16 unsigned char i; 17 for (i=0; i < NumRetries; i++){ 18 if(FSfinit()==0) return 1; 19 return 0; 20 } 21 } 22 23 unsigned char FSopen(char *u1){ 24 filePtr = FSfopen( u1,FS_WRITE); 25 if (filePtr != NULL) { 26 return 1; 27 } 28 else return 0; 29 } 30 31 void FSclose(void){ 32 FSfclose(filePtr); 33 } 34 35 unsigned char FSprint(unsigned int u1){ 36 char y1; 37 y1 = FSfprintf(filePtr, "AN0= %u%c%c", u1, 0x0D, 0x0A); 38 if (y1 > 0){ 39 return 1; 40 } 41 else return 0; 42 } 43 |