Commit f547eb36 authored by Dean Camera's avatar Dean Camera
Browse files

Optimized Endpoint_Read_Word_* and Pipe_Read_Word_* macros to reduce compiled size.

Fixed Programmer's Notepad project file to reflect new location of AVRISP project.
parent 17d06b84
This diff is collapsed.
......@@ -511,12 +511,16 @@
static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_LE(void)
{
uint16_t Data;
union
{
uint16_t Word;
uint8_t Bytes[2];
} Data;
Data = UEDATX;
Data |= (((uint16_t)UEDATX) << 8);
Data.Bytes[0] = UEDATX;
Data.Bytes[1] = UEDATX;
return Data;
return Data.Word;
}
/** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT
......@@ -529,12 +533,16 @@
static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_BE(void)
{
uint16_t Data;
union
{
uint16_t Word;
uint8_t Bytes[2];
} Data;
Data = (((uint16_t)UEDATX) << 8);
Data |= UEDATX;
Data.Bytes[1] = UEDATX;
Data.Bytes[0] = UEDATX;
return Data;
return Data.Word;
}
/** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN
......
......@@ -566,12 +566,16 @@
static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_LE(void)
{
uint16_t Data;
union
{
uint16_t Word;
uint8_t Bytes[2];
} Data;
Data = UPDATX;
Data |= (((uint16_t)UPDATX) << 8);
Data.Bytes[0] = UPDATX;
Data.Bytes[1] = UPDATX;
return Data;
return Data.Word;
}
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT
......@@ -584,12 +588,16 @@
static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_BE(void)
{
uint16_t Data;
union
{
uint16_t Word;
uint8_t Bytes[2];
} Data;
Data = (((uint16_t)UPDATX) << 8);
Data |= UPDATX;
Data.Bytes[1] = UPDATX;
Data.Bytes[0] = UPDATX;
return Data;
return Data.Word;
}
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
......
......@@ -24,6 +24,7 @@
* - Added explicit attribute masks to the device mode demos' descriptors
* - Added return values to the CDC and MIDI class driver transmit functions
* - Added extra masks to the SPI driver, changed SPI_Init() so that the clock polarity and sample modes can be set
* - Optimized Endpoint_Read_Word_* and Pipe_Read_Word_* macros to reduce compiled size
*
* <b>Fixed:</b>
* - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the
......
......@@ -84,7 +84,7 @@ void SetupHardware(void)
ADC_StartReading(VTARGET_ADC_CHANNEL | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
#endif
/* Millisecond timer initialization for timeout checking */
/* Millisecond timer initialization for timeouts and delays */
OCR0A = ((F_CPU / 64) / 1000);
TCCR0A = (1 << WGM01);
TCCR0B = ((1 << CS01) | (1 << CS00));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment