-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
63 lines (53 loc) · 1.18 KB
/
common.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
*@file common.h
*@brief Contains the various constant/macro/struct definitions, clock frequency and general functions.
*/
#ifndef COMMON_H
#define COMMON_H
///CPU frequency
#define F_CPU 8000000
#define NULL 0
#include <math.h>
#include <avr/io.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
#define sbi(x,y) (x |= (1<<y))
#define cbi(x,y) (x &= ~(1<<y))
#define tbi(x,y) (x ^= (1<<y))
#define TRUE 1
#define FALSE 0
/**
* @defgroup Modes
* @brief Modes of operation of satellite
* @todo Safe and emergency mode details to be obtained and coded
*/
//@{
/// During preflight checks
#define PREFLIGHT 0
/// Normal Mode
#define NOMINAL 1
/// Low power Mode
#define SAFE 2
/// Failure Mode
#define EMERGENCY 3
/// Detumbling Mode
#define DETUMBLING 4
//@}
/**
*@defgroup Preflight_check
*@todo Check port and pin for preflight checks
*/
//@{
///Port for preflight checks
#define DDR_PF DDRA
#define PORT_PF PINA
/// Pin to check for preflight checks mode
#define PIN_PF PA0
//@}
///Frame Time for the main loop
#define FRAME_TIME 2
#endif