From 7638128d47f90dafbbf8bc2454971afd726e005e Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 27 Sep 2015 16:08:13 +1000 Subject: [PATCH] Use 16-bit length for TWI driver packet read/write requests for longer transfers. --- LUFA/DoxygenPages/ChangeLog.txt | 3 +++ LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c | 4 ++-- LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h | 4 ++-- LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.c | 4 ++-- LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.h | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index f57ea8f585..e3382d8136 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -13,6 +13,9 @@ * - Added new PROGMEM variant send functions to the CDC class host driver * * Changed: + * - Core: + * - The TWI peripheral driver's TWI_WritePacket() and TWI_ReadPacket() functions now takes a 16-bit Length rather than an 8-bit + * length, for longer transfers * - Library Applications: * - The CDC, DFU, Mass Storage and Printer class bootloaders will no longer run the user application if the application reset * vector is blank (thanks to Alex Kazik) diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c index 5955358a27..61652a7b15 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c @@ -135,7 +135,7 @@ uint8_t TWI_ReadPacket(const uint8_t SlaveAddress, const uint8_t* InternalAddress, uint8_t InternalAddressLen, uint8_t* Buffer, - uint8_t Length) + uint16_t Length) { uint8_t ErrorCode; @@ -175,7 +175,7 @@ uint8_t TWI_WritePacket(const uint8_t SlaveAddress, const uint8_t* InternalAddress, uint8_t InternalAddressLen, const uint8_t* Buffer, - uint8_t Length) + uint16_t Length) { uint8_t ErrorCode; diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h index 9465fe02aa..33bed98dcc 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h @@ -273,7 +273,7 @@ const uint8_t* InternalAddress, uint8_t InternalAddressLen, uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(3); + uint16_t Length) ATTR_NON_NULL_PTR_ARG(3); /** High level function to perform a complete packet transfer over the TWI bus from the specified * device. @@ -292,7 +292,7 @@ const uint8_t* InternalAddress, uint8_t InternalAddressLen, const uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(3); + uint16_t Length) ATTR_NON_NULL_PTR_ARG(3); /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) diff --git a/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.c b/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.c index 56334c8806..3fdf1a14f2 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.c +++ b/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.c @@ -110,7 +110,7 @@ uint8_t TWI_ReadPacket(TWI_t* const TWI, const uint8_t* InternalAddress, uint8_t InternalAddressLen, uint8_t* Buffer, - uint8_t Length) + uint16_t Length) { uint8_t ErrorCode; @@ -151,7 +151,7 @@ uint8_t TWI_WritePacket(TWI_t* const TWI, const uint8_t* InternalAddress, uint8_t InternalAddressLen, const uint8_t* Buffer, - uint8_t Length) + uint16_t Length) { uint8_t ErrorCode; diff --git a/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.h b/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.h index e4d14b80dc..734bba61cb 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.h +++ b/LUFA/Drivers/Peripheral/XMEGA/TWI_XMEGA.h @@ -268,7 +268,7 @@ const uint8_t* InternalAddress, uint8_t InternalAddressLen, uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); /** High level function to perform a complete packet transfer over the TWI bus from the specified * device. @@ -289,7 +289,7 @@ const uint8_t* InternalAddress, uint8_t InternalAddressLen, const uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus)