Update Atmel Studio blob - use sane method to extract the extension's bundled Getting...
[pub/USBasp.git] / LUFA / Drivers / Board / AVR8 / USBKEY / Dataflash.h
index f3cb45d..14b94c5 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
                                if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
                                  return;
 
-                               if (PageAddress & 0x01)
-                                 Dataflash_SelectChip(DATAFLASH_CHIP2);
-                               else
-                                 Dataflash_SelectChip(DATAFLASH_CHIP1);
+                               #if (DATAFLASH_TOTALCHIPS == 2)
+                                       if (PageAddress & 0x01)
+                                         Dataflash_SelectChip(DATAFLASH_CHIP2);
+                                       else
+                                         Dataflash_SelectChip(DATAFLASH_CHIP1);
+                               #else
+                                       Dataflash_SelectChip(DATAFLASH_CHIP1);
+                               #endif
                        }
 
                        /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
                        static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
                                                                      const uint16_t BufferByte)
                        {
-                               PageAddress >>= 1;
-
+                               #if (DATAFLASH_TOTALCHIPS == 2)
+                                       PageAddress >>= 1;
+                               #endif
+                               
                                Dataflash_SendByte(PageAddress >> 5);
                                Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
                                Dataflash_SendByte(BufferByte);