source: firmware/FSC/src/application.h @ 10674

Last change on this file since 10674 was 10674, checked in by neise, 9 years ago
ethernet with user interface test
File size: 3.1 KB
Line 
1#ifndef __APPLICATION_H
2#define __APPLICATION_H
3//-----------------------------------------------------------------------------
4
5#include "typedefs.h"
6//-----------------------------------------------------------------------------
7
8
9//-----------------------------------------------------------------------------
10
11// in order to check the user interface on a hardware near level.
12// user can issue 'heartbeat command'.
13// then this üpin is toggled with the 'main-while-loop-frequency'
14// --> nice check for this frequency as well
15#define HEARTBEATPIN PB3
16
17// SPI DEFINITIONS
18// Port Definitions
19#define SPI_PRT PORTB
20#define SPI_DDR DDRB
21
22// Bit Definitions
23#define SPI_SCLK PB7
24#define SPI_MOSI PB5
25#define SPI_MISO PB6
26
27#define SPI_E_CS PB4           
28#define SPI_AD_CS PD3           
29#define SPI_M_CS PD4           
30#define SPI_A_CS PD5           
31
32//#ifdef ____WENNICHSWIRKLICHWILL
33#ifndef ___MAIN_WORKFLOW_GLOBAL_VARS
34#define ___MAIN_WORKFLOW_GLOBAL_VARS
35        #define RESISTANCE_CHANNELS 64
36        #define AD7719_READINGS_UNTIL_SETTLED 3 // bei3:480ms
37       
38        #define VOLTAGE_CHANNELS 84
39        #define ADC_READINGS_UNTIL_SETTLED 1
40#endif
41
42#define W5100_INPUT_CHECK_TIME 25 // defines how often the W5100 should be asked if something arrived... in ms
43
44// MAIN WORKFLOW GLOBAL VARIABLES
45
46        extern bool heartbeat_enable;
47
48
49       
50// TIMER global variable
51        extern volatile U32 local_ms;
52
53// AD7719 global variables
54        extern U32 ad7719_values[];
55        extern U08 ad7719_enables[];
56        extern U08 ad7719_channels_ready[];
57        extern U08 ad7719_readings_since_last_muxing;
58        extern U08 ad7719_current_channel;
59        extern U32 ad7719_current_reading;
60        extern bool ad7719_measured_all;
61        extern bool ad7719_values_printed;
62        extern bool ad7719_print_endless;
63
64// ATMEGA ADC global variables
65        extern U08 adc_values[]; // stores measured voltage in steps of 16mV
66        extern U08 adc_enables[];
67        extern U08 adc_channels_ready[];
68        extern U08 adc_readings_since_last_muxing;
69        extern U08 adc_current_channel;
70        extern U08 adc_current_reading;
71        extern bool adc_measured_all;
72        extern bool adc_values_printed;
73        extern bool adc_print_endless;
74
75        extern bool once_told_you;
76        extern bool debug_mode;
77
78
79
80//-----------------------------------------------------------------------------
81extern volatile U08 app_reset_source;
82//-----------------------------------------------------------------------------
83
84void app_init(void); // Initialize application
85void app_set_watchdog_prescaler(tWDT_PRESCALE wdt_prescale); // Set watchdog prescale
86
87//methods in main ... declared here ... don't ask why ...
88// definition of some functions:
89// these function are implemented in this file, this is not doog coding style.
90// sooner or later, they will be moved into more apropriate files.
91void set_adc_enable_register();
92void set_ad7719_enable_register();
93U08     increase_adc (U08 channel);
94U08     increase_ad7719 (U08 channel);
95void check_what_measurement_was_finished() ;
96void check_if_measured_all() ;
97// end of function definition:
98//-----------------------------------------------------------------------------
99
100
101
102//-----------------------------------------------------------------------------
103
104#endif
Note: See TracBrowser for help on using the repository browser.