Various fixes and improvements (#96)
* Global variables shared between an interrupt and the main code should be volatile See: https://www.embedded.com/electronics-blogs/beginner-s-corner/4023801/Introduction-to-the-Volatile-Keyword * There is no reason to change the active report if it has not changed * Declare local functions and variables static This both helps the compiler and the programmer
This commit is contained in:
committed by
László Monda
parent
1742437f8b
commit
e12e219b4e
@@ -3,9 +3,9 @@
|
||||
uint32_t UsbMouseActionCounter;
|
||||
static usb_mouse_report_t usbMouseReports[2];
|
||||
usb_mouse_report_t* ActiveUsbMouseReport = usbMouseReports;
|
||||
bool IsUsbMouseReportSent = false;
|
||||
volatile bool IsUsbMouseReportSent = false;
|
||||
|
||||
usb_mouse_report_t* getInactiveUsbMouseReport(void)
|
||||
static usb_mouse_report_t* getInactiveUsbMouseReport(void)
|
||||
{
|
||||
return ActiveUsbMouseReport == usbMouseReports ? usbMouseReports+1 : usbMouseReports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user