Add special support to the AVRISP-MKII for the new model USBTINY-MKII's additional...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 29 Jul 2010 13:04:53 +0000 (13:04 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 29 Jul 2010 13:04:53 +0000 (13:04 +0000)
Add support to the USBTINY-MKII's additional LED in the board's LED driver header.

Changed LED indicator masks for the AVRISP-MKII project, so that there are defined roles for each LED.

LUFA/Drivers/Board/USBTINYMKII/LEDs.h
LUFA/ManPages/ChangeLog.txt
Projects/AVRISP-MKII/AVRISP-MKII.c
Projects/AVRISP-MKII/AVRISP-MKII.h

index 6be7706..b0383a6 100644 (file)
                        /** LED mask for the second LED on the board. */
                        #define LEDS_LED2        (1 << 7)
 
                        /** LED mask for the second LED on the board. */
                        #define LEDS_LED2        (1 << 7)
 
+                       /** LED mask for the third LED on the board. */
+                       #define LEDS_LED3        (1 << 5)
+
                        /** LED mask for all the LEDs on the board. */
                        /** LED mask for all the LEDs on the board. */
-                       #define LEDS_ALL_LEDS    (LEDS_LED1 | LEDS_LED2)
+                       #define LEDS_ALL_LEDS    (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
 
                        /** LED mask for the none of the board LEDs. */
                        #define LEDS_NO_LEDS     0
 
                        /** LED mask for the none of the board LEDs. */
                        #define LEDS_NO_LEDS     0
index 2e8496e..69a712c 100644 (file)
@@ -20,6 +20,7 @@
   *  - Added start of a new Test and Measurement class demo (thanks to Peter Lawrence)
   *  - Added new SPI_ORDER_* data order masks to the SPI peripheral driver
   *  - Added support to the AVRISP-MKII project for ISP speeds slower than 125KHz via a new software SPI driver
   *  - Added start of a new Test and Measurement class demo (thanks to Peter Lawrence)
   *  - Added new SPI_ORDER_* data order masks to the SPI peripheral driver
   *  - Added support to the AVRISP-MKII project for ISP speeds slower than 125KHz via a new software SPI driver
+  *  - Added support for the new button/LED on the latest model USBTINY-MKII
   *
   *  <b>Changed:</b>
   *  - The RingBuff library code has been replaced in the XPLAINBridge, Benito and USBtoSerial projects with an ultra lightweight
   *
   *  <b>Changed:</b>
   *  - The RingBuff library code has been replaced in the XPLAINBridge, Benito and USBtoSerial projects with an ultra lightweight
@@ -39,6 +40,7 @@
   *    behaviour of the command line tools used to perform the check on each platform
   *  - Internal USB driver source files renamed and moved to ease future possible architecture ports
   *  - All internal pseudo-function macros have been converted to true inline functions for type-safety and readability
   *    behaviour of the command line tools used to perform the check on each platform
   *  - Internal USB driver source files renamed and moved to ease future possible architecture ports
   *  - All internal pseudo-function macros have been converted to true inline functions for type-safety and readability
+  *  - Changed LED indicator masks for the AVRISP-MKII project, so that there are defined roles for each LED
   *
   *  <b>Fixed:</b>
   *  - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from
   *
   *  <b>Fixed:</b>
   *  - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from
index 7293906..0afb087 100644 (file)
@@ -49,6 +49,12 @@ int main(void)
 
        for (;;)
        {
 
        for (;;)
        {
+               #if (BOARD == BOARD_USBTINYMKII)
+               /* On the USBTINY-MKII target, there is a secondary LED which indicates the current selected power
+                  mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
+               LEDs_ChangeLEDs(LEDMASK_VBUSPOWER, (PIND & (1 << 0)) ? LEDMASK_VBUSPOWER : 0);
+               #endif
+               
                AVRISP_Task();
                USB_USBTask();
        }
                AVRISP_Task();
                USB_USBTask();
        }
@@ -66,7 +72,7 @@ void SetupHardware(void)
 
        /* Hardware Initialization */
        LEDs_Init();
 
        /* Hardware Initialization */
        LEDs_Init();
-       USB_Init();
+       USB_Init();     
 }
 
 /** Event handler for the library USB Connection event. */
 }
 
 /** Event handler for the library USB Connection event. */
index 1018ebc..3491abf 100644 (file)
@@ -42,8 +42,6 @@
                #include <avr/interrupt.h>
                #include <avr/power.h>
 
                #include <avr/interrupt.h>
                #include <avr/power.h>
 
-               #include "Descriptors.h"
-
                #include <LUFA/Version.h>
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/USB/USB.h>
                #include <LUFA/Version.h>
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/USB/USB.h>
@@ -52,6 +50,7 @@
                        #include <LUFA/Drivers/Peripheral/ADC.h>
                #endif
                
                        #include <LUFA/Drivers/Peripheral/ADC.h>
                #endif
                
+               #include "Descriptors.h"
                #include "Lib/V2Protocol.h"
 
        /* Macros: */
                #include "Lib/V2Protocol.h"
 
        /* Macros: */
                #define LEDMASK_USB_NOTREADY      LEDS_LED1
 
                /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
                #define LEDMASK_USB_NOTREADY      LEDS_LED1
 
                /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
-               #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)
+               #define LEDMASK_USB_ENUMERATING  (LEDS_LED1 | LEDS_LED2)
 
                /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
 
                /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
-               #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)
+               #define LEDMASK_USB_READY         LEDS_LED2
 
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
 
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
-               #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)
+               #define LEDMASK_USB_ERROR         LEDS_LED1
 
                /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
                #define LEDMASK_BUSY             (LEDS_LED1 | LEDS_LED2)
 
                /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
                #define LEDMASK_BUSY             (LEDS_LED1 | LEDS_LED2)
+               
+               /** LED mask for the library LED driver, to indicate that the target is being powered by VBUS. */
+               #define LEDMASK_VBUSPOWER         LEDS_LED3
 
        /* Function Prototypes: */
                void SetupHardware(void);
 
        /* Function Prototypes: */
                void SetupHardware(void);