#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#include "./SYSTEM/sys/sys.h"

#include "./hmi/hmi_cmd.h"
#include "./hmi/hmi_rx_parse.h"
#include "./hmi/hmi_hex_parse.h"

#include "./hmi_spinner_example.h"

void hmi_spinner_example_hex_cmd(struct hex_cmd_fmt *fram)
{
    uint8_t wid_id = fram->func;
    cmd_res_t *back = hmi_cmd_back_res();
    bool res = false;

    res = API_GET(l0.val);
    if (!res)
    {
        printf("get err!");
    }
    back = hmi_cmd_back_res();
    if (wid_id == 0)
    {
        if (back->val.value == 0)
        {
            TIM3->CCR2 = 100;
            API_CMD_SEND(img1.pic = 19);
        }
        else if (back->val.value == 1)
        {
            TIM3->CCR2 = 10;
            API_CMD_SEND(img1.pic = 18);
        }
        else if (back->val.value == 2)
        {
            TIM3->CCR2 = 0;
            API_CMD_SEND(img1.pic = 20);
        }
    }
}
void hmi_spinner_example_timer_update_50ms(uint16_t page_id)
{
    if (page_id != 3)
        return;
}
