Edit: CAUTION - SEE BELOW!
Also it makes little sense to have negative frequency, so once you have a separate flag, make it uint32_t Frequency.
It would actually make much more sense to use a float type, with low _XTAL frequencies you can achieve values in HZ or lower.
But I like to avoid including float math for something so simple. Not a great deal of people are going to use sub MHz on the main clock along with PWM.
What you are suggesting would make more sense with uint24_t for the frequency which is rather tempting but non standard.
On the other hand this library is indeed for use with PIC18F so it only needs to be microcontroller portable (which I can live without, as it complicates things and too much drama and no...)...
If you think about it a uint24_t can get the maximum value of 16777215 while the maximum theoretical frequency that can be achieved is 16MHz.
So you could say that if frequency is 0xFFFFFF then frequency is not set. It would also make for a slightly faster code if not also smaller but it doesn´t follow convention.
By convention a function would return -1 if it failed, same here to an extend. A negative number means you failed to initialize the frequency, but the idea is also that you are
always able to read the frequency. Or else I would just return the value of the frequency from the init function.
The problem comes though when you want to change the settings of the PWM. You got to run the Init function again! That doesn´t mean that the Init function will succeed though!
If it fails, you are stuck with the old frequency, which you would have no way of knowing in your runtime unless you had stored it.
So that´s the mentality behind building this library, it´s very gui friendly, doesn´t need to be in my specific occasion, never the less as we say here in Greece,
sensible parents' kids cook before they get hungry
Cheers,
Lefteris