GCE on header definitions for a class library.

I have invested the better part of the entire Christmas weekend trying to debug this. So far the books I have read have been next to useless as the authors chose not to start with an entire class library code that did anything meaningful and walk through each aspect of the development. I worked around one compile problem, an enumeration defined in a header by redefining it as constants. Now I have a whole new gaggle of compiler complaints that were not visible before, presumably because the compiler quit after hitting the enumeration.

The project UIControl.ino is a test container intended to test the interfaces on class ExternPWM.cpp. ExternalPWM.cpp is the class library and ExternalPWM.h is its header file, and cmos.h is the enumeration. Below is the schematic of the circuit to be controlled. The increment and decrement pins induce additional clock cycles for a given counter chain thus altering the relative phasing at the output XNOR gate. The result is a continuous wave PWM that retains dutycycle and does not require process time when duty cycle is not being changed. The circuitry works as I have used the blink code to run a continuous advance on one counter resulting in a linear symmetrical PWM ramp.

scematic: ExternPWM.jpg

UI_Control.ino (250 Bytes)

cmos.h (181 Bytes)

ExternPWM.h (584 Bytes)

Most of my errors were lack of type declaration in the cpp on functions although already declared or so I thought withing the class definition in the header. The revised cpp is on this post.

ExternPWM.cpp (2.68 KB)

In ExternPWM.cpp, ShiftPhase() is not a class member, so class members are not available in that function.

This version compiles with only 1 warning.
"C:\arduino-1.0\hardware\arduino\cores\arduino\Tone.cpp:108: warning: only initialized variables can be placed into program memory area"

ExternPWM.cpp (2.7 KB)

PaulS:
In ExternPWM.cpp, ShiftPhase() is not a class member, so class members are not available in that function.

Ok I thought the entire pair was class code.

So do I add ShiftPhase() to the private section and add the class binding?

Line 108:

const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1, 0 */ };

Looks like an initialized variable to me. Have you modified your copy of Tone.cpp

Nope, I intalled fresh copy of the IDE. The only code changed is the code I have written. I added ShiftPhase to the priv section now mIOP1 and mIOP2 are using the class defined variables.

So do I add ShiftPhase() to the private section

I don't know. Is it supposed to be a class member?

and add the class binding?

Not sure what you mean by this. If you are referring to the scope resolution operator (the class name followed by ::), then, yes, if ShiftPhase() is supposed to be a class member.

ExternPWM::-----the binding, please forgive the Perlscript terminology.

tone.cpp file date is "Monday, ?November ?28, ?2011, ??7:32:14 PM"

........scope resolution operator (the class name followed by ::).....

A term never mentioned in C++ for dummies, or its predicessor C for dummies. Thus making me the DUMMY!