We now refrain from sending any USB data up to the PC until one or more of the following happens: * The PC has sent some data to us or tries to read some data from us (i.e. an application has opened the part and sent some data out or is trying to read data in) * The PC has activated a hardware handshaking line (i.e. an application has opened the port - most apps do this) Once we are sending data to the PC, we will continue to do so until one of the following things happens: * The PC has deactivated the hardware handshaking line (i.e. the app has closed the port) * The PC has not asked for any data from us for 50ms (this indicates that there is no application consuming the data on the PC side, and the PC's buffer is full, and it doesn't want any more data) I also bumped up the number of USB buffers to 16 (from 4), which seemed to help smooth things out somewhat This fix has been tested with the Firmata Test application (which failed before this code was changed) on Mac and Windows, and Jacob tested this patch on some of his difficult USB cases (where things were failing previosly) and all of these tests were suecesful.
* setSpeed() and setMode() now store the previous speed and mode which can be restored with unsetSpeed() and unsetMode() respectively. This allows you to use SPI devices on the same bus where different devices want to operate with different settings.
* There were some major typos in pgmspace that broke Ardino library compatability. * Some extra definitions have been added to support more data types * It is a good idea to force the undefinition of a macro before defining it as some libraries also define these macros. While ours generally override the others it does cause lots of nasty warnings.
* With the MZ the naming scheme for the SPI ports has changed to what it should have been from the start - that is SPI1 through SPI4, rather that SPI1A, SPI1B etc. The macros used to decide if enhanced buffering in DSPI of course have consequently changed. This update changes how the enhanced buffering decision is made and makes it compatible with both the old MX numbering scheme and the new correct MZ numbering scheme.
* A new macro __PIC32_PINS__ has been added to the cpudefs tables. This allows you to select such things as the correct starting address for remappable pins on devices which lack a port A. The 64-pin MZ variants have been fixed using this method. * Numerous compilation warnings have been removed. This includes changing all the "char *" function parameters in Stream to be "const char *", some brackets around some macro arithmetic, and some extra casts and hints to variables and assignments. Also some unused variables have been commented out.