/**
 * @author Rémi Heredero (remi@heredero.ch)
 * @version. 1.0.0
 * @date 2023-06-15
 */

#include "led.h"
#include "../../mcc_generated_files/pin_manager.h"

void LED_init(LED* me, uint8_t id) {
    me->id = id;
}

/**
 * @brief Initialize the Driver
 * 
 */
void LED_initHW(LED* me) {
    LED_off(me);
}

void LED_on(void* me) {
    LED* l = (LED*) me;
    switch (l->id) {
        case 1:
            OUTPUT1_SetHigh();
        break;
        case 2:
            OUTPUT2_SetHigh();
        break;
        case 3:
            OUTPUT3_SetHigh();
        break;
        case 4:
            OUTPUT4_SetHigh();
        break;
        case 5:
            OUTPUT5_SetHigh();
        break;
        case 6:
            OUTPUT6_SetHigh();
        break;
        case 7:
            OUTPUT7_SetHigh();
        break;
        case 8:
            OUTPUT8_SetHigh();
        break;
        case 9:
            OUTPUT9_SetHigh();
        break;
        case 10:
            OUTPUT10_SetHigh();
        break;    
    }
      
}

void LED_off(void* me) {
    LED* l = (LED*) me;
    switch (l->id) {
        case 1:
            OUTPUT1_SetLow();
        break;
        case 2:
            OUTPUT2_SetLow();
        break;
        case 3:
            OUTPUT3_SetLow();
        break;
        case 4:
            OUTPUT4_SetLow();
        break;
        case 5:
            OUTPUT5_SetLow();
        break;
        case 6:
            OUTPUT6_SetLow();
        break;
        case 7:
            OUTPUT7_SetLow();
        break;
        case 8:
            OUTPUT8_SetLow();
        break;
        case 9:
            OUTPUT9_SetLow();
        break;
        case 10:
            OUTPUT10_SetLow();
        break;    
    }            
}

