Go Down

Topic: PetitFS library will not compile, byte errors  (Read 1 time) previous topic - next topic

Duhjoker

Dec 04, 2016, 09:41 pm Last Edit: Dec 04, 2016, 09:44 pm by Duhjoker
    Ok I'm trying to use a couple functions in my display file that uses the petitfatfs but when ever I try to compile a sketch that has the petitfatfs library included I get errors about the Byte definitions in the Pff files.

If I try to compile the OG sketch by itself I still get the same errors. Could I get some help figuring this out

Code: [Select]

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/integer.h:18:23: note: in expansion of macro 'BYTE'

 typedef unsigned char BYTE;

                       ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:67:2: note: in expansion of macro 'BYTE'

  BYTE fs_type; /* FAT sub type */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:68:2: note: in expansion of macro 'BYTE'

  BYTE csize;  /* Number of sectors per cluster */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:69:2: note: in expansion of macro 'BYTE'

  BYTE flag;  /* File status flags */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:70:2: note: in expansion of macro 'BYTE'

  BYTE csect;  /* File sector address in the cluster */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:72:2: note: in expansion of macro 'BYTE'

  BYTE* buf;  /* Pointer to the disk access buffer */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:90:2: note: in expansion of macro 'BYTE'

  BYTE* fn;   /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Print.h:45:14: error: expected unqualified-id before numeric constant

 #define BYTE 0

              ^

C:\Users\duhjoker\Documents\Arduino\libraries\petit_fatfs/pff.h:104:2: note: in expansion of macro 'BYTE'

  BYTE fattrib; /* Attribute */

  ^
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

Duhjoker

#1
Dec 04, 2016, 10:57 pm Last Edit: Dec 05, 2016, 09:15 am by Duhjoker
Ok the problem is in my teensy's AVR. The print.h file has an extra definition of #define byte that the arduino version does not.

  How should I handle that? Do I mark it out do I need to change something in the example?

I guess the first part would be to get the function working. I noticed the command uses byte instead of int_8, can these be changed to int8_t.

Why does the draw from SD command have the INT in front of it instead of void?
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

PaulS

You are asking questions about a non-standard library that few people have. If you posted a link to the library, the chances that you are just talking to yourself would go way down.
The art of getting good answers lies in asking good questions.

Duhjoker

#3
Dec 05, 2016, 09:03 pm Last Edit: Dec 06, 2016, 04:08 am by Duhjoker
   Ok I guess some one was just putting me on. I was told the petitfatfs was a common arduino library. Oh well.......

Here a link to the library on github........

https://github.com/greiman/PetitFS

The attachment at the top called drawbutmapfromSd has the example that I'm trying to add to my display library.


edit:::::
 I thonk I may have most of it figured out but I keep getting these errors about two lines the functions need to be able use the petitfatfs library,

// Following two functions are needed by petit_fatfs
byte rx() { SPDR = 0xFF; loop_until_bit_is_set(SPSR, SPIF); return SPDR; }
void tx(byte d) { SPDR = d; loop_until_bit_is_set(SPSR, SPIF); }

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN1\DisplayRGB.cpp: In function 'byte rx()':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN1\DisplayRGB.cpp:52:58: error: 'loop_until_bit_is_set' was not declared in this scope

 byte rx() { SPDR = 0xFF; loop_until_bit_is_set(SPSR, SPIF); return SPDR; }

                                                          ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN1\DisplayRGB.cpp: In function 'void tx(byte)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN1\DisplayRGB.cpp:53:61: error: 'loop_until_bit_is_set' was not declared in this scope

 void tx(byte d) { SPDR = d; loop_until_bit_is_set(SPSR, SPIF); }

  the error was about the loop until stuff, I think its a comment but domt know how to proceed. I nalso looked at the petifatfs library and could not find another mention of those functions.
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

PaulS

Quote
Here a link to the library on github........
No. HERE is a link:
https://github.com/greiman/PetitFS

See the difference? You could have done that, too.

Quote
The attachment at the top called drawbutmapfromSd has the example that I'm trying to add to my display library.
I'm not sure that I want to know what a butmap is...

Quote
I think its a comment
Why would you think that?

// Comments look like this or
/* they can look like this */

The link above does NOT have a file with this name:
Code: [Select]
#include <petit_fatfs.h>
The art of getting good answers lies in asking good questions.

Duhjoker

I'm grasping at straws here man. Excuse my spelling! I know what comments look like but I can't find any reference to the command "loop until set" or its variables spsr and spif. How about a lil help figuring it out instead of telling someone they are wrong all the time?
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

Duhjoker

Wasn't trying to be rude but dude!!! Cut me some slack you know I'm still learning.

   Ok so my dumb@$$ didn't know that I needed to include a couple more files to get the petitfatfs to work. Which also solved my TX RX loop dilemma.

  Now my major snag is the byte declarations in the code and the library. The new SD functions use byte instead of int and uint. So now it's got my teensy's print.h and the petitfatfs librarys are fighting each other.

  So my teensy's print has an extra define in it called #define BYTE 0 and it's messing with the petitfatfs files. I can comment out the byte def in my print.h but I'm not sure if that will allow every thing to work.

What would be the best way to handle that with out changing core code for the hardware.



GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

PaulS

Quote
I can comment out the byte def in my print.h but I'm not sure if that will allow every thing to work.
Why not try it and see?
The art of getting good answers lies in asking good questions.

Duhjoker

Ok so I commented out the #define BYTE 0 line in the print.h so that fixed that. But I need a way to correct it from inside my library I will have to include a version of teensy's 3.2 print.h and .cpp with the Byte define commented out.

    Is there another way I could fix that? I've tried this in my display libraries .cpp where the functions that use it are

#define bin 2
#undef BYTE
#define BYTE 0

I've also tried #undef BYTE before
 
Typedef unsigned char BYTE

In integer.h but still no good.
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

PaulS

Quote
But I need a way to correct it from inside my library I will have to include a version of teensy's 3.2 print.h and .cpp with the Byte define commented out.
Yes, you will. I don't see what the problem is. The initial problem was that there were duplication definitions of BYTE. Now there there is only one, what is the problem?

The art of getting good answers lies in asking good questions.

Duhjoker

 The problem is trying to get this done with out the user having to make modifications to thier libraries in order to get started. I want the library to be drop in and go and with out extra files included to make it work.
GameR the DIY Arduino powered gaming device that does more...

https://github.com/Duhjoker/GameR-Iot_T3
https://github.com/Duhjoker/GameR-Iot_ESP

Go Up