Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
/*
* em_led.c
*
* Created: 2023/07/08 16:36:24
* Author: 46nori
*/
#include "asf.h"
#include "em_led.h"
///////////////////////////////////////////////////////////////////
// Initialize emulated device
///////////////////////////////////////////////////////////////////
void init_em_led(void)
{
}
///////////////////////////////////////////////////////////////////
// Set LED
///////////////////////////////////////////////////////////////////
void OUT_1F_LED_Set(uint8_t data)
{
PORTE = (PORTE & 0x1f) | ((data & 0x07) << 5);
}
///////////////////////////////////////////////////////////////////
// Get LED status
///////////////////////////////////////////////////////////////////
uint8_t IN_1F_LED_Get(void)
{
return PORTE >> 5;
}
///////////////////////////////////////////////////////////////////
// Heartbeat : Blinking at f Hz if calling every 10 ms
///////////////////////////////////////////////////////////////////
void em_led_heartbeat(int f)
{
static uint16_t i = 0;
if (i < 50 * f) {
PORTE &= ~_BV(PORTE7); // RED LED ON PE7
} else if (i < 100 * f) {
PORTE |= _BV(PORTE7); // RED LED OFF PE7
} else {
i = 0;
}
++i;
}
552e9055cThis file is pinned to the selected release. Download the original to open it in your design tool.