#pragma once

#include "stdint.h"

#define BOOTLOADER_CALL_RETRY_TIME 1000
#define BOOTLOADER_CALL_MAX_TRIES 10

#define TASK_FLAG_WAIT 1
#define TASK_FLAG_RUNNING 2

#define UPDATE_ACK_WINDOW 4
#define UPDATE_DONE_MSG 0xFFFFD04EFFFFD04E


typedef struct {
    char name[32];
    uint8_t device;
} FirmwareUpdateArgs;


typedef struct {
    uint32_t counter;
    uint8_t data[4];
} FwFrame;


void FirmwareUpdateTask_start(FirmwareUpdateArgs args);