- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# Leds Management
[USBKEY]

Macros to manage Leds on USB KEY The led 0 correspond at led D2 RED The led 1 correspond at led D2 GREEN The led 2 correspond at led D5 GREEN The led 3 correspond at led D5 RED. More...

## Defines
#define | LED_PORT PORTD
#define | LED_DDR DDRD
#define | LED_PIN PIND
#define | LED0_BIT PIND4
#define | LED1_BIT PIND5
#define | LED2_BIT PIND6
#define | LED3_BIT PIND7
#define | Leds_init() (LED_DDR |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT))
#define | Leds_on() (LED_PORT |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT))
#define | Leds_off() (LED_PORT &= ~((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT)))
#define | Leds_set_val(c) (Leds_off(),LED_PORT |= (c<<4)&((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT)))
#define | Leds_get_val() (LED_PORT>>4)
#define | Led0_on() (LED_PORT |= (1<<LED0_BIT))
#define | Led1_on() (LED_PORT |= (1<<LED1_BIT))
#define | Led2_on() (LED_PORT |= (1<<LED2_BIT))
#define | Led3_on() (LED_PORT |= (1<<LED3_BIT))
#define | Led0_off() (LED_PORT &= ~(1<<LED0_BIT))
#define | Led1_off() (LED_PORT &= ~(1<<LED1_BIT))
#define | Led2_off() (LED_PORT &= ~(1<<LED2_BIT))
#define | Led3_off() (LED_PORT &= ~(1<<LED3_BIT))
#define | Led0_toggle() (LED_PIN |= (1<<LED0_BIT))
#define | Led1_toggle() (LED_PIN |= (1<<LED1_BIT))
#define | Led2_toggle() (LED_PIN |= (1<<LED2_BIT))
#define | Led3_toggle() (LED_PIN |= (1<<LED3_BIT))
#define | Is_led0_on() (LED_PIN & (1<<LED0_BIT) ? TRUE : FALSE)
#define | Is_led1_on() (LED_PIN & (1<<LED1_BIT) ? TRUE : FALSE)
#define | Is_led2_on() (LED_PIN & (1<<LED2_BIT) ? TRUE : FALSE)
#define | Is_led3_on() (LED_PIN & (1<<LED3_BIT) ? TRUE : FALSE)

## Detailed Description

Macros to manage Leds on USB KEY The led 0 correspond at led D2 RED The led 1 correspond at led D2 GREEN The led 2 correspond at led D5 GREEN The led 3 correspond at led D5 RED.

## Define Documentation

#define LED_PORT PORTD

Definition at line 64 of file usb_key.h.

#define LED_DDR DDRD

Definition at line 65 of file usb_key.h.

#define LED_PIN PIND

Definition at line 66 of file usb_key.h.

#define LED0_BIT PIND4

Definition at line 67 of file usb_key.h.

#define LED1_BIT PIND5

Definition at line 68 of file usb_key.h.

#define LED2_BIT PIND6

Definition at line 69 of file usb_key.h.

#define LED3_BIT PIND7

Definition at line 70 of file usb_key.h.

#define Leds_init | ( |  | ) | (LED_DDR |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT))

Definition at line 72 of file usb_key.h.

#define Leds_on | ( |  | ) | (LED_PORT |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT))

Definition at line 73 of file usb_key.h.

#define Leds_off | ( |  | ) | (LED_PORT &= ~((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT)))

Definition at line 74 of file usb_key.h.

#define Leds_set_val | ( | c |  | ) | (Leds_off(),LED_PORT |= (c<<4)&((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT) | (1<<LED3_BIT)))

Definition at line 75 of file usb_key.h.

#define Leds_get_val | ( |  | ) | (LED_PORT>>4)

Definition at line 76 of file usb_key.h.

#define Led0_on | ( |  | ) | (LED_PORT |= (1<<LED0_BIT))

Definition at line 78 of file usb_key.h.

#define Led1_on | ( |  | ) | (LED_PORT |= (1<<LED1_BIT))

Definition at line 79 of file usb_key.h.

#define Led2_on | ( |  | ) | (LED_PORT |= (1<<LED2_BIT))

Definition at line 80 of file usb_key.h.

#define Led3_on | ( |  | ) | (LED_PORT |= (1<<LED3_BIT))

Definition at line 81 of file usb_key.h.

#define Led0_off | ( |  | ) | (LED_PORT &= ~(1<<LED0_BIT))

Definition at line 82 of file usb_key.h.

#define Led1_off | ( |  | ) | (LED_PORT &= ~(1<<LED1_BIT))

Definition at line 83 of file usb_key.h.

#define Led2_off | ( |  | ) | (LED_PORT &= ~(1<<LED2_BIT))

Definition at line 84 of file usb_key.h.

#define Led3_off | ( |  | ) | (LED_PORT &= ~(1<<LED3_BIT))

Definition at line 85 of file usb_key.h.

#define Led0_toggle | ( |  | ) | (LED_PIN |= (1<<LED0_BIT))

Definition at line 86 of file usb_key.h.

#define Led1_toggle | ( |  | ) | (LED_PIN |= (1<<LED1_BIT))

Definition at line 87 of file usb_key.h.

#define Led2_toggle | ( |  | ) | (LED_PIN |= (1<<LED2_BIT))

Definition at line 88 of file usb_key.h.

#define Led3_toggle | ( |  | ) | (LED_PIN |= (1<<LED3_BIT))

Definition at line 89 of file usb_key.h.

#define Is_led0_on | ( |  | ) | (LED_PIN & (1<<LED0_BIT) ? TRUE : FALSE)

Definition at line 90 of file usb_key.h.

#define Is_led1_on | ( |  | ) | (LED_PIN & (1<<LED1_BIT) ? TRUE : FALSE)

Definition at line 91 of file usb_key.h.

#define Is_led2_on | ( |  | ) | (LED_PIN & (1<<LED2_BIT) ? TRUE : FALSE)

Definition at line 92 of file usb_key.h.

#define Is_led3_on | ( |  | ) | (LED_PIN & (1<<LED3_BIT) ? TRUE : FALSE)

Definition at line 93 of file usb_key.h.