Implement KbootCommand_Ping and set set left BOOTLOADER_TIMEOUT_MS back to 100 ms.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
kboot_driver_state_t KbootDriverState;
|
||||
|
||||
static uint8_t rxBuffer[MAX_KBOOT_COMMAND_LENGTH];
|
||||
static uint8_t pingCommand[] = {0x5a, 0xa6};
|
||||
static uint8_t resetCommand[] = {0x5a, 0xa4, 0x04, 0x00, 0x6f, 0x46, 0x0b, 0x00, 0x00, 0x00};
|
||||
static uint8_t ackMessage[] = {0x5a, 0xa1};
|
||||
|
||||
@@ -30,6 +31,28 @@ status_t KbootSlaveDriver_Update(uint8_t kbootInstanceId)
|
||||
case KbootCommand_Idle:
|
||||
break;
|
||||
case KbootCommand_Ping:
|
||||
switch (KbootDriverState.phase) {
|
||||
case 0:
|
||||
status = tx(pingCommand, sizeof(pingCommand));
|
||||
KbootDriverState.phase++;
|
||||
break;
|
||||
case 1:
|
||||
KbootDriverState.status = Slaves[SlaveId_KbootDriver].previousStatus;
|
||||
KbootDriverState.phase = KbootDriverState.status == kStatus_Success ? 2 : 0;
|
||||
return kStatus_Uhk_NoTransfer;
|
||||
case 2:
|
||||
status = rx(10);
|
||||
KbootDriverState.phase++;
|
||||
break;
|
||||
case 3:
|
||||
KbootDriverState.status = Slaves[SlaveId_KbootDriver].previousStatus;
|
||||
if (KbootDriverState.status == kStatus_Success) {
|
||||
KbootDriverState.commandType = KbootCommand_Idle;
|
||||
} else {
|
||||
KbootDriverState.phase = 0;
|
||||
return kStatus_Uhk_NoTransfer;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KbootCommand_Reset:
|
||||
switch (KbootDriverState.phase) {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
kboot_command_t commandType;
|
||||
uint8_t i2cAddress;
|
||||
uint8_t phase;
|
||||
uint32_t status;
|
||||
} kboot_driver_state_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
Reference in New Issue
Block a user