Added software timers

Accessory state machine framework functional
This commit is contained in:
2025-06-18 17:53:00 -05:00
parent aaa7f0dc29
commit 658cedfa3b
18 changed files with 614 additions and 580 deletions

View File

@@ -41,6 +41,7 @@ extern uint8_t USB_EnterLowpowerMode(void);
//Application Includes
#include "flashUpdate.h"
#include "usbComms.h"
#include "System/system.h"
/*******************************************************************************
* Definitions
@@ -633,7 +634,17 @@ void USB_SendString(uint8_t * str)
#if 1 //Send data
//Wait for USB ready
while(!((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))); //TODO: make this not block forever
// TODO: Need to timeout here
SYSTEM_DATA_t *sys = system_getSys();
uint32_t timeout = sys->systemTime + 100;
while(!((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions)))
{
if (sys->systemTime > timeout)
{
txDataSize = 0;
return;
}
}
uint32_t size = txDataSize;
txDataSize = 0;
@@ -642,7 +653,6 @@ void USB_SendString(uint8_t * str)
if (error != kStatus_USB_Success)
{
/* Failure to send Data Handling code here */
usb.sendErrorCount++;
}