-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.h
76 lines (54 loc) · 2.93 KB
/
main.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
/*
* main.h
*
*/
#ifndef MAIN_H_
#define MAIN_H_
#include <stdint.h>
//ds2482 temp-int
#define U21_ADDR (0x18<<1)
//ds2482 temp-ext
#define U17_ADDR (0x19)
#define I2C_ADDR_MAC (0xA0) /* E0 = E1 = E2 = 0, 24AA02EE48 */
#define I2C_ADDR_FLASH (0xA2) /* E0 = E1 = E2 = 0, FM24C64 8kb FRAM */
#define I_CHANNEL_QUANTITY (8) // êîëè÷åñòâî êàíàëîâ Input
#define O_CHANNEL_QUANTITY (8) // êîëè÷åñòâî êàíàëîâ Output
#define ADC_CHANNEL_QUANTITY (8) // êîëè÷åñòâî êàíàëîâ ÀÖÏ
#define ADC1_DR_Address ((uint32_t)0x4001244C)
extern const char txt_device_ver_soft[];
extern const char txt_device_ver_hard[];
extern const char txt_device_name[];
#define DEFAULT_UDP_PORT_DEF 10000 // UDP ïîðò ïî óìîë÷àíèþ
#define QUEUE_CONSOL_RX_SIZE (64)// äëèííà âõîäíîãî áóôåðà êîíñîëè
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainCONSOL_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainUIP_PERIODIC_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainUIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#ifndef DEBUG
#define config_TASK_Consol_STACK_SIZE (256+30)//configMINIMAL_STACK_SIZE * 2)
#define config_TASK_LedBlink_STACK_SIZE (128+30)//configMINIMAL_STACK_SIZE * 2)
#else
#define config_TASK_Consol_STACK_SIZE (256+30)//configMINIMAL_STACK_SIZE * 2)
#define config_TASK_LedBlink_STACK_SIZE (128)//configMINIMAL_STACK_SIZE * 2)
#endif
#define ADC_BUF_SIZE (8) // êîëè÷åñòâî ÀÖÏ êàíàëîâ çàäåéñòâîâàíûõ
#define UDP_PAKET_VERSION_H (1) // âåðñèÿ UDP ïàêåòà. Äëÿ ïîñëåäóþùèõ èçìåíåíèé â óñòðîéñòâå ïàêåòà.
#define UDP_PAKET_VERSION_L (0)
typedef struct {
volatile uint8_t gpio_input;
volatile uint8_t gpio_output;
volatile uint16_t adc_converted_value[ ADC_CHANNEL_QUANTITY ]; // áóôôåð ãäå õðàíÿòñÿ çíà÷åíèÿ ïîëó÷åííûå îò ÀÖÏ
} device_status_t;
typedef enum { STOP, START } rehim_status; // îáîçíà÷åíèå äâóõ âîçìîæíûõ ñîñòîÿíèé
#define CLOCK_SECOND_S (1000) // ñèñòåìíûé òàéìåð âûçûâàåòñÿ 1000 ðàç â ñåêóíäó FreeRTOS
#define PERIODIC_TIMER_INTERVAL (CLOCK_SECOND_S / 2)
#define ARP_TIMER_INTERVAL (CLOCK_SECOND_S * 10)
#define HTML_BUF_SIZE (500) // ðàçìåð áóôåðà â êîòîðîì ñîáèðàþòñÿ ÷àñòè html ñðàíèö
#define TXT_BUF_SIZE (60) // äëèííà ñòðîêè êîíôèãóðàöèè äëÿ I2C ïàìÿòè
#define UDP_PAKET_SIZE (128) // ðàçìåð UDP ïàêåòà
#define TRACE_BUF_SIZE (512) // ðàçìåð áóôåðà äëÿ âûâîäà òðàñèðîâî÷íîé èíôîðìàöèè (ïàìÿòü âûäåëÿåòñÿ èç êó÷è)
#define BUF_P_SIZE (128) // ðàçìåð áóôåðà äëÿ ñòðîêè âûäåëÿåìîé èç ÎÇÓ, äëÿ ïå÷àòè â êîíñîëè
void device_status_update_adc(void);
void device_status_update_gpio(void);
void hex_out(const char *buf_in, unsigned long len);
#endif /* MAIN_H_ */