export interface MCU_Type {
    name: string;
    cpu: { [key: string]: Number }; // state: power consumption
    sleep: { [key: string]: Number };
    wifi?: { [key: string]: Number };
    bluetooth?: { [key: string]: Number };
}

const MCUs: MCU_Type[] = [
    {
        name: "esp32-s3",
        cpu: { // mili amps
            single_core_40MHz: 21.8,
            dual_core_40MHz: 24.4,
            single_core_80MHz: 42.6,
            dual_core_80MHz: 47.3,
            single_core_160MHz: 54.6,
            dual_core_160MHz: 54.1,
            single_core_240MHz: 65.9,
            dual_core_240MHz: 81.3,
        },
        sleep: {

        },
        wifi: { // 
            dBm_21: 318.2,
            sleep: 10     
        },
        bluetooth: {
            active: 100,
            sleep: 5      
        }
    },

    {
        name: "esp32-c3",
        cpu: {
            single_core_80MHz: 22,
            single_core_160MHz: 54.6,
        },
        sleep: {
            
        },
        wifi: {
            active: 110,
            sleep: 9      
        },
        bluetooth: {
            active: 90, 
            sleep: 4      
        }
    }
];

export function getMCU(name: string): MCU_Type | undefined{
    for (let i = 0; i < MCUs.length; i++) {
        const element = MCUs[i];
        if (element.name == name)
            return element
    }

    return undefined;
}