-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.h
115 lines (99 loc) · 3 KB
/
conf.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* @file conf.h
*
* @defgroup CONF Configurations
*
* @brief General configuration of the system.
*
* @{
*/
#ifndef CONF_H
#define CONF_H
#ifndef F_CPU
#define F_CPU 16000000UL //define a frequencia do microcontrolador - 16MHz
#endif /* ifndef F_CPU */
// CONFIGURACOES DE COMPILACAO
#define DEBUG_ON
#define VERBOSE_ON
#define VERBOSE_ON_CAN_APP
//#define VERBOSE_ON_MACHINE
//#define VERBOSE_ON_ADC
#define VERBOSE_ON_INIT
#define VERBOSE_ON_ERROR
//#define PRINT_INFOS
#define CAN_SIGNATURE_SELF CAN_SIGNATURE_MCB19_2
// MODULES ACTIVATION
#define USART_ON
#define CAN_ON
//#define CAN_DEPENDENT
#define ADC_ON
#define MACHINE_ON
//#define LED_ON
#define WATCHDOG_ON
//#define SLEEP_ON
#define CONTROL_ON
#ifdef CONTROL_ON
#define D_MIN 0
#define D_MAX 0.9
#define VO_SETPOINT 14.6
#define IO_MAX 10
#define VO_MAX 16
#define VI_MIN 21
#define PERIOD 0.0009960853844391542f;// 0.0001995171684523453f; // 0.0002 // 5kHz
#define F_PWM 30000UL
#define PWM_DDR DDRB
#define PWM_PIN PINB
#define PWM_PORT PORTB
#define PWM PB2
#define ENABLE_RELAY PD2
#define ENABLE_RELAY_DDR DDRD
#define ENABLE_RELAY_PIN PIND
#define ENABLE_RELAY_PORT PORTD
#endif
#ifdef MACHINE_ON
#define MACHINE_TIMER_FREQUENCY 200U //<! machine timer frequency in Hz
#define MACHINE_TIMER_PRESCALER 1024U //<! machine timer prescaler
#endif // MACHINE_ON
#ifdef LED_ON
#define LED_PORT PORTD
#define LED_PIN PIND
#define LED_DDR DDRD
#define LED1 PD7
#define LED2 PD7
#define cpl_led(y) cpl_bit(LED_PORT, y)
#define set_led(y) set_bit(LED_PORT, y)
#define clr_led(y) clr_bit(LED_PORT, y)
#else
#define cpl_led()
#define set_led()
#define clr_led()
#endif // LED_ON
#ifdef CAN_ON
#define SPI_ON
// CANBUS DEFINITONS
// ----------------------------------------------------------------------------
/* Global settings for building the can-lib and application program.
*
* The following two #defines must be set identically for the can-lib and
* your application program. They control the underlying CAN struct. If the
* settings disagree, the underlying CAN struct will be broken, with
* unpredictable results.
* If can.h detects that any of the #defines is not defined, it will set them
* to the default values shown here, so it is in your own interest to have a
* consistent setting. Ommiting the #defines in both can-lib and application
* program will apply the defaults in a consistent way too.
*
* Select if you want to use 29 bit identifiers.
*/
#define SUPPORT_EXTENDED_CANID 0
/* Select if you want to use timestamps.
* Timestamps are sourced from a register internal to the AT90CAN.
* Selecting them on any other controller will have no effect, they will
* be 0 all the time.
*/
#define SUPPORT_TIMESTAMPS 0
#endif // CAN_ON
/**
* @}
*/
#endif /* ifndef CONF_H */