]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Bootloader/dfu.h
Code cleanup
[kiibohd-controller.git] / Bootloader / dfu.h
index 83d5d2b549bab1dc4a4213ca3b6119b47dd49007..d4da289eb93b4caf60ba3ccde706dcb7636e8a97 100644 (file)
@@ -15,8 +15,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _USB_DFU_H
-#define _USB_DFU_H
+#pragma once
 
 // ----- Compiler Includes -----
 
 
 
 #ifndef USB_DFU_TRANSFER_SIZE
-#define USB_DFU_TRANSFER_SIZE   FLASH_SECTOR_SIZE
+// Sector size is the same as the program flash size
+#if defined(_mk20dx128vlf5_)
+#define USB_DFU_TRANSFER_SIZE FLASH_SECTOR_SIZE
+
+// Sector size is double the program flash size
+#elif defined(_mk20dx256vlh7_ )
+#define USB_DFU_TRANSFER_SIZE FLASH_SECTOR_SIZE / 2
+
+#endif
 #endif
 
 #define USB_FUNCTION_DESC_DFU_DECL                         \
@@ -163,4 +170,3 @@ void dfu_write_done( enum dfu_status, struct dfu_ctx *ctx );
 void dfu_init( dfu_setup_read_t setup_read, dfu_setup_write_t setup_write, dfu_finish_write_t finish_write, struct dfu_ctx *ctx );
 void dfu_app_init( dfu_detach_t detachcb );
 
-#endif