/******************************************************************************
 * @file     main.c
 * @brief    Main program body
 * @version  V4.0.1
 * @date     30-July-2026
 *
 * @note
 * Copyright (C) 2022 Spintrol Electronic Technology (Shanghai) Co., Ltd.. All rights reserved.
 *
 * @attention
 * THIS SOFTWARE JUST PROVIDES CUSTOMERS WITH CODING INFORMATION REGARDING
 * THEIR PRODUCTS, WHICH AIMS AT SAVING TIME FOR THEM. SPINTROL SHALL NOT BE
 * LIABLE FOR THE USE OF THE SOFTWARE. SPINTROL DOES NOT GUARANTEE THE
 * CORRECTNESS OF THIS SOFTWARE AND RESERVES THE RIGHT TO MODIFY THE SOFTWARE
 * WITHOUT NOTIFICATION.
 *
 ******************************************************************************/

#include <stdio.h>

#if defined(SPC1158)
    #include "spc1158.h"
#elif defined(SPD1148)
    #include "spd1148.h"
#elif defined(SPD1178)
    #include "spd1178.h"
#elif defined(SPD1188)
    #include "spd1188.h"
#elif defined(SPD1163)
    #include "spd1163.h"
#else
    #include "spc1168.h"
#endif

#include "arm_math.h"


float fa = 0.0;

int main(void)
{   
    /* Set Flash timing */
    FLASH_WALLOW();

#if defined(SPC1158)

    FLASH_SetTiming(100000000);
    /* Disable flash write access after flash operation had done */
    FLASH_WDIS();

    CLOCK_InitWithRCO(100000000UL);
#else
    FLASH_SetTiming(200000000);
    /* Disable flash write access after flash operation had done */
    FLASH_WDIS();

    CLOCK_InitWithRCO(200000000UL);
#endif

    /* Delay init */
    Delay_Init();

    /* UART init */
    GPIO_SetPinChannel(GPIO_34, GPIO34_UART_TXD);
    GPIO_SetPinChannel(GPIO_35, GPIO35_UART_RXD);
    UART_Init(UART, 38400);

    printf("ARM Math Test...\n\n");

    /* Function in arm_math.h */
    fa = arm_cos_f32(1.047);
    printf("Just a Sample....%f\n", fa);
    arm_sqrt_f32(2.56, &fa);
    printf("Just a Sample....%f\n", fa);

    /* Function in math.h */
    fa = sqrt(2.25);
    printf("Just a Sample....%f\n", fa);

    printf("\nARM Math Test  End...\n");

    while (1)
    {

    }
}

