service.h


1
/*
2
 * service.h
3
 *
4
 * Created: 17.11.2016 22:58:16
5
 *  Author: Bone
6
 */ 
7
8
9
#ifndef SERVICE_H_
10
#define SERVICE_H_
11
12
//#include <stdbool.h>
13
#include <avr/io.h>
14
#include <stdio.h>
15
#include <avr/interrupt.h>
16
#include "uart.h"
17
#include "crc.h"
18
19
20
21
22
23
24
#define NOP asm volatile ("nop" ::)
25
#define CRC_BIT         0x10
26
#define INCLUDE_CRC(x)        (((x) & (CRC_BIT)) !=0) ? (2):(0)
27
#define MAX_DATA_LENGTH 10
28
29
typedef struct {
30
unsigned char RxAddress;
31
unsigned char InfoByte;
32
unsigned char TxAddress;
33
unsigned char DataLength;
34
unsigned char Data[MAX_DATA_LENGTH];
35
} st_protokoll_Data;
36
37
volatile bool DataOk;
38
39
st_protokoll_Data stRxData;
40
st_protokoll_Data stTxData;
41
42
unsigned char RxHeader;
43
unsigned char RxBody;
44
unsigned int RxCrc16;
45
46
/* neu******************************/
47
unsigned char *NetTxPtr;
48
unsigned char NetTxCount;
49
unsigned char NetTxCount_temp;
50
51
52
53
54
extern void Net_NewFrameStart(void);
55
56
57
extern void Net_SendFrame(void);
58
59
60
extern void Net_SendChar(unsigned char ptr_RXAddress,unsigned char *val, unsigned int len);
61
62
63
64
65
66
67
68
69
70
71
#endif /* SERVICE_H_ */