Avoid unnecessary preparation

This commit is contained in:
mbanth
2021-05-25 16:00:32 +01:00
parent 02596cc5a9
commit d1650afd37

View File

@@ -267,6 +267,7 @@ unsigned char* hidGetReportDescriptor( void )
void hidPrepareReportDescriptor( void ) void hidPrepareReportDescriptor( void )
{ {
if( !hidReportDescriptorPrepared ) {
unsigned char* ptr = hidReportDescriptor; unsigned char* ptr = hidReportDescriptor;
for( unsigned idx = 0; idx < sizeof hidReportDescriptorItems / sizeof( USB_HID_Short_Item_t ); ++idx ) { for( unsigned idx = 0; idx < sizeof hidReportDescriptorItems / sizeof( USB_HID_Short_Item_t ); ++idx ) {
ptr = hidTranslateItem( hidReportDescriptorItems[ idx ], ptr ); ptr = hidTranslateItem( hidReportDescriptorItems[ idx ], ptr );
@@ -274,6 +275,7 @@ void hidPrepareReportDescriptor( void )
hidReportDescriptorPrepared = 1; hidReportDescriptorPrepared = 1;
} }
}
unsigned hidSetReportItem( const unsigned byte, const unsigned bit, const unsigned char header, const unsigned char data[] ) unsigned hidSetReportItem( const unsigned byte, const unsigned bit, const unsigned char header, const unsigned char data[] )
{ {