Added V2Protocol handlers to the AVRISP project to enter/exit programming mode, and read/write fuses, lockbits, OSCCAL and Signature bytes.

Added ShutDown functions for all hardware peripheral drivers, so that peripherals can be turned off after use.
This commit is contained in:
Dean Camera 2009-08-23 04:01:49 +00:00
parent d540276b44
commit 1e8df8951a
10 changed files with 303 additions and 45 deletions

View file

@ -108,6 +108,16 @@
SPSR &= ~(1 << SPI2X);
}
/** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */
static inline void SPI_ShutDown(void)
{
DDRB &= ~((1 << 1) | (1 << 2));
PORTB &= ~((1 << 0) | (1 << 3));
SPCR = 0;
SPSR = 0;
}
/** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.
*
* \param[in] Byte Byte to send through the SPI interface