Background:
I am programming an ATmega328. I can’t stand the Arduino IDE, so I prefer using Xcode for writing code. However, I have found all of the options available online for using Xcode to actually upload sketches to Arduino to be convoluted at best and have not been successful in trying to implement them.
Current Method:
What currently works well for me is to use Xcode strictly as a debugger, and ‘creating’ stripped down versions of Arduino classes when I need them so the debugger doesn’t freak out when I put in lines of code specific to Arduino. For example, I have a Serial class in my Xcode project which has the following functions, which work just fine:
void Serial::print(int myInt)
{
cout << myInt;
}
void Serial::println(int myInt)
{
cout << myInt << endl;
}
I do the same for strings, and whatever other standard C++ datatype I may need to print.
This way, any time I want to put Serial.print within a function in another class I’m working on, I can debug strictly from within Xcode without opening the Arduino IDE. I can also create a “fake” class for pinMode, etc.
Issue:
I would like to do this with the byte datatype used in the Arduino environment. I am taking an object-oriented approach to this program, and it threatens to eat up the precious RAM on my little Arduino. So, in order to save space, I’m converting all my ints to bytes and so forth.
But, I assume (and my compiler tells me) that I can’t subclass char, or int, or any other basic types. I don’t see how I can start using statements like “byte a = 2” or something similar with my current (somewhat convoluted) work-around method.
Essentially, I want to trick Xcode into thinking byte is the same thing as int for all intents and purposes.
Any ideas?
Typedefs. (By the way, it’s not Xcode who you will be fooling, but the compiler.)
or