This change adds a function in the ISPProtocol.c file that handles the CMD_OSCCAL command as specified in AVR053. The programming tool toggles MOSI at a rate of 32.768 kHz and listens on MISO for a "calibration successful" signal, which takes the form of eight toggles by the device. Criticism very much welcome.
I'm not certain if this function is best placed in ISPProtocol or ISPTarget—it can be moved as needed.
There are some #defines at the beginning of the function. It didn't seem like the header files had that sort of definition in them, but they could move there if desired. On a related note, ports/pins are set to match the AT90USB162 used in Olimex's AVRISP-MK2. I didn't see generic SPI definitions elsewhere in the project so I just used the ports/pins themselves.
Also my tabs don't always line up nicely on Github's viewer... they look okay in my editor.
This change adds a function in the ISPProtocol.c file that handles the CMD_OSCCAL command as specified in AVR053. The programming tool toggles MOSI at a rate of 32.768 kHz and listens on MISO for a "calibration successful" signal, which takes the form of eight toggles by the device. Criticism very much welcome.
I'm not certain if this function is best placed in ISPProtocol or ISPTarget—it can be moved as needed.
There are some
#define
s at the beginning of the function. It didn't seem like the header files had that sort of definition in them, but they could move there if desired. On a related note, ports/pins are set to match the AT90USB162 used in Olimex's AVRISP-MK2. I didn't see generic SPI definitions elsewhere in the project so I just used the ports/pins themselves.Also my tabs don't always line up nicely on Github's viewer... they look okay in my editor.