This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
SummerSchool2-Controller/306-controller_interface.X/board/led/led.c

83 lines
1.4 KiB
C

/**
* @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;
}
}
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;
}
}