-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhal.h
38 lines (31 loc) · 1.98 KB
/
hal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Automatically generated HAL from HAL.xml */
/* NEVER EDIT MANUALLY */
/* Generated on: 2015-09-23 23:50:46 */
#ifndef __HAL_H__
#define __HAL_H__
#include <avr/io.h>
#define nop() __asm__ __volatile__("nop")
/* LEDOutput -> PB0 (Output, Initially Inactive) */
#define LEDOutput_BIT 0
#define LEDOutput_PIN PINB
#define LEDOutput_PORT PORTB
#define LEDOutput_DDR DDRB
#define LEDOutput_ModeOutput() LEDOutput_DDR |= _BV(LEDOutput_BIT)
#define LEDOutput_IsOutput() ((LEDOutput_DDR & _BV(LEDOutput_BIT)) != 0)
#define LEDOutput_SetHIGH() LEDOutput_PORT |= _BV(LEDOutput_BIT)
#define LEDOutput_SetLOW() LEDOutput_PORT &= ~_BV(LEDOutput_BIT)
#define LEDOutput_Get() (LEDOutput_PIN & _BV(LEDOutput_BIT))
#define LEDOutput_SetInactive() LEDOutput_SetLOW()
#define LEDOutput_SetActive() LEDOutput_SetHIGH()
#define LEDOutput_Toggle() LEDOutput_PORT ^= _BV(LEDOutput_BIT)
#define LEDOutput_SetConditional(condition) if (condition) LEDOutput_SetActive(); else LEDOutput_SetInactive()
#define LEDOutput_SetConditionalToggle(conditionon, conditionoff, conditiontoggle) if (conditionon) { LEDOutput_SetActive(); } else if (conditionoff) { LEDOutput_SetInactive(); } else if (conditiontoggle) { LEDOutput_Toggle(); }
#define LEDOutput_Pulse() { LEDOutput_SetActive(); LEDOutput_SetInactive(); }
#define LEDOutput_PulseNop() { LEDOutput_SetActive(); nop(); LEDOutput_SetInactive(); }
#define LEDOutput_IsInactive() (LEDOutput_Get() == 0)
#define LEDOutput_IsActive() (LEDOutput_Get() != 0)
#define LEDOutput_Init() { LEDOutput_SetInactive(); LEDOutput_ModeOutput(); }
#define initHAL() {\
LEDOutput_Init();\
}
#endif