OpenModem/hardware/LED.h

37 lines
1.4 KiB
C
Raw Normal View History

2019-01-12 07:12:51 -07:00
#ifndef LED_H
#define LED_H
#include <avr/io.h>
2019-02-07 10:36:40 -07:00
#include <stdbool.h>
2019-01-12 07:12:51 -07:00
#include "device.h"
2019-02-07 10:36:40 -07:00
extern bool LED_softblock_enabled;
2019-01-12 07:12:51 -07:00
void LED_init(void);
void LED_setIntensity(uint8_t value);
2019-02-07 10:36:40 -07:00
#define LED_STATUS_ON() do { if (!LED_softblock_enabled) LED_PORT |= _BV(2); } while (0)
#define LED_STATUS_OFF() do { if (!LED_softblock_enabled) LED_PORT &= ~_BV(2); } while (0)
#define LED_STATUS_TOGGLE() do { if (!LED_softblock_enabled) LED_PORT ^= _BV(2); } while (0)
#define LED_TX_ON() do { if (!LED_softblock_enabled) LED_PORT |= _BV(1); } while (0)
#define LED_TX_OFF() do { if (!LED_softblock_enabled) LED_PORT &= ~_BV(1); } while (0)
#define LED_RX_ON() do { if (!LED_softblock_enabled) LED_PORT |= _BV(0); } while (0)
#define LED_RX_OFF() do { if (!LED_softblock_enabled) LED_PORT &= ~_BV(0); } while (0)
#define LED_F_STATUS_ON() do { LED_PORT |= _BV(2); } while (0)
#define LED_F_STATUS_OFF() do { LED_PORT &= ~_BV(2); } while (0)
#define LED_F_STATUS_TOGGLE() do { LED_PORT ^= _BV(2); } while (0)
#define LED_F_TX_ON() do { LED_PORT |= _BV(1); } while (0)
#define LED_F_TX_OFF() do { LED_PORT &= ~_BV(1); } while (0)
#define LED_F_RX_ON() do { LED_PORT |= _BV(0); } while (0)
#define LED_F_RX_OFF() do { LED_PORT &= ~_BV(0); } while (0)
2019-01-12 07:12:51 -07:00
void LED_COM_ON(void);
void LED_COM_OFF(void);
2019-01-12 08:30:26 -07:00
void update_led_status(void);
2019-01-12 07:12:51 -07:00
2019-02-07 05:16:42 -07:00
void LED_indicate_error_crypto(void);
2019-02-07 10:36:40 -07:00
void LED_indicate_enabled_crypto(void);
2019-01-12 07:12:51 -07:00
#endif