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
Raw Permalink Normal View History

/**
* @author R<EFBFBD>mi Heredero (remi@heredero.ch)
* @version. 1.0.0
* @date 2023-06-15
*/
2023-08-22 07:22:00 +00:00
#include "led.h"
#include "../../mcc_generated_files/pin_manager.h"
void LED_init(LED* me, uint8_t id) {
2023-08-22 07:22:00 +00:00
me->id = id;
}
/**
* @brief Initialize the Driver
*
*/
void LED_initHW(LED* me) {
2023-08-22 07:22:00 +00:00
LED_off(me);
}
void LED_on(void* me) {
LED* l = (LED*) me;
switch (l->id) {
2023-08-22 07:22:00 +00:00
case 1:
OUTPUT1_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 2:
OUTPUT2_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 3:
OUTPUT3_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 4:
OUTPUT4_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 5:
OUTPUT5_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 6:
OUTPUT6_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 7:
OUTPUT7_SetHigh();
2023-08-22 07:22:00 +00:00
break;
case 8:
OUTPUT8_SetHigh();
break;
2023-08-22 07:22:00 +00:00
}
}
void LED_off(void* me) {
LED* l = (LED*) me;
switch (l->id) {
2023-08-22 07:22:00 +00:00
case 1:
OUTPUT1_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 2:
OUTPUT2_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 3:
OUTPUT3_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 4:
OUTPUT4_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 5:
OUTPUT5_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 6:
OUTPUT6_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 7:
OUTPUT7_SetLow();
2023-08-22 07:22:00 +00:00
break;
case 8:
OUTPUT8_SetLow();
2023-08-22 07:22:00 +00:00
break;
}
2023-08-22 07:22:00 +00:00
}