mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-12-29 17:36:26 -05:00
fw: Hide *led in led.c
This commit is contained in:
parent
8665031bb4
commit
9488f0633d
@ -7,9 +7,15 @@
|
||||
#include "../tk1_mem.h"
|
||||
#include "types.h"
|
||||
|
||||
static volatile uint32_t *led = (volatile uint32_t *)TK1_MMIO_TK1_LED;
|
||||
|
||||
void set_led(uint32_t led_value)
|
||||
{
|
||||
*led = led_value;
|
||||
}
|
||||
|
||||
void forever_redflash()
|
||||
{
|
||||
static volatile uint32_t *led = (volatile uint32_t *)TK1_MMIO_TK1_LED;
|
||||
int led_on = 0;
|
||||
|
||||
for (;;) {
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "types.h"
|
||||
|
||||
// clang-format off
|
||||
static volatile uint32_t *led = (volatile uint32_t *)TK1_MMIO_TK1_LED;
|
||||
|
||||
#define LED_BLACK 0
|
||||
#define LED_RED (1 << TK1_MMIO_TK1_LED_R_BIT)
|
||||
#define LED_GREEN (1 << TK1_MMIO_TK1_LED_G_BIT)
|
||||
@ -19,5 +17,6 @@ static volatile uint32_t *led = (volatile uint32_t *)TK1_MMIO_TK1_LED;
|
||||
#define LED_WHITE (LED_RED | LED_GREEN | LED_BLUE)
|
||||
// clang-format on
|
||||
|
||||
void set_led(uint32_t led_value);
|
||||
void forever_redflash();
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@ int readcommand(struct frame_header *hdr, uint8_t *cmd, int state)
|
||||
{
|
||||
uint8_t in = 0;
|
||||
|
||||
*led = (state == FW_STATE_LOADING) ? LED_BLACK : LED_WHITE;
|
||||
set_led((state == FW_STATE_LOADING) ? LED_BLACK : LED_WHITE);
|
||||
in = readbyte();
|
||||
|
||||
if (parseframe(in, hdr) == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user