aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/DataDef.h
blob: f5c4f0a98928a45eabc5155e8a04fcb29d80a804 (plain)
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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//------------------------------------------------------------------------------
// <auto-generated>
// This
#ifndef DATADEF_H
#define DATADEF_H

#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <driverlib/gpio.h>

//#define EVALUATION_BOARD // to use the LCD only when using the evaluation board
//#define USE_USB
//#define DEMO_TEMPERATURE 1
#define Stub_Mode 1
#define USE_HIGH_SPEED_GPIO // to use AHB GPIO (A..J) ports A-J APB or AHB, ports K-Q on AHB only
//#define WithTempSensorFiltrer (to use the function Filter_Temparature_Measurement)
//#define DEBUG_TEST_FUNCTIONS
#define  HIZ_TIMEOUT 1000

#define MAX_STRING_LEN              255 //Embedded  version + filter.c

#define MAX_ERR_SAMPLES 5 //Number of Samples before sending error
#define ERROR_TEMPERATURE_MEASUREMENT 0xFFFF

#define ON  1
#define OFF 0

enum
{
    PASSED = 0,
    FAILED = 1,
    NOT_SUPPORTED = 254,
    VERIFIED = 255
};


#define OK       0
#define ERROR    1
#define WARNING  2

#define ENABLE  1
#define DISABLE 0

//Valves Directions:
#define MidTank_Dispenser     0
#define Dispenser_Mixer       1
#define Cartridge_MidTank_ON  1
#define Cartridge_MidTank_OFF 0
#define Atm_MidTank_ON        1
#define Atm_MidTank_OFF       0


#define NEW  0
#define USED 1

#define START 0
#define STOP  1
#define NOSTOP     2
#define CONTINUE   2

#define NOTBUSY 0
#define BUSY 1
//
// motor direction
#define CW  0 // clockwise
#define CCW 1 // counter clockwise

#define TRUE  1
#define FALSE 0

#define INPUT 0x0
#define OUTPUT 0x1

#define PULLDOWN 0
#define PULLUP   1

#define TX 0
#define RX 1
#define TXRX 2
#define ODD         0
#define EVEN        1

#define READY       0
#define NOTREADY    1
#define WAIT        2

#define LOW  0x0
#define HIGH 0x1

#define WR          0
#define RD          1

#define FLAGSTART   1
#define FLAGSET     1
#define FLAGCLEAR   0

#define IN              2
#define OUT             3

#define INIT 1
#define SKIP_INIT 0

#define byte uint8_t//char
#define boolean bool

#define SERIAL  0x0
#define DISPLAY 0x1

#define LSBFIRST 0
#define MSBFIRST 1

#define CHANGE 1
#define FALLING 2
#define RISING 3

#define CLOSE 0
#define OPEN  1

#define DOUBLE_BUFFER 2

//#define FPGA_Reg_Size_Bits 16

#define MIDTANK_DIRECTION 0
#define MIXER_DIRECTION   1

#define MASK_LOW_BYTE_IN_WORD  0x00FF;
#define MASK_HIGH_BYTE_IN_WORD 0xFF00;


#define STATUS_GREEN_LED_ON     ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, GPIO_PIN_1) //Turn ON STATUS Green LED
#define STATUS_RED_LED_ON       ROM_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_0, GPIO_PIN_0) //Turn ON STATUS Red   LED

#define ACTIVITY_RED_LED_ON     ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0) //Turn ON ACTIVITY Red LED
#define ACTIVITY_GREEN_LED_ON   ROM_GPIOPinWrite(GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_PIN_0) //Turn ON ACTIVITY Green LED

#define COMM_RED_LED_ON         ROM_GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_4, GPIO_PIN_4) //Turn ON COMM Red LED
#define COMM_GREEN_LED_ON         ROM_GPIOPinWrite(GPIO_PORTJ_BASE, GPIO_PIN_1, GPIO_PIN_1) //Turn ON COMM Green LED

#define STATUS_GREEN_LED_OFF    ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0) //Turn OFF STATUS Green LED
#define STATUS_RED_LED_OFF       ROM_GPIOPinWrite(GPIO_PORTS_BASE, GPIO_PIN_0, 0) //Turn OFF STATUS Red   LED

#define ACTIVITY_RED_LED_OFF     ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0) //Turn OFF ACTIVITY Red LED
#define ACTIVITY_GREEN_LED_OFF   ROM_GPIOPinWrite(GPIO_PORTJ_BASE, GPIO_PIN_0, 0) //Turn OFF ACTIVITY Green LED

#define COMM_RED_LED_OFF        ROM_GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_4, 0) //Turn OFF Red LED LED
#define COMM_GREEN_LED_OFF        ROM_GPIOPinWrite(GPIO_PORTJ_BASE, GPIO_PIN_1, 0) //Turn OFF COMM Green LED

#define STATUS_GREEN_LED_CHANGE_MODE    ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, (ROM_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^  GPIO_PIN_1));
#define ACTIVITY_RED_LED_CHANGE_MODE    ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, (ROM_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_0) ^  GPIO_PIN_0));
#define COMM_RED_CHANGE_MODE            ROM_GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_4, (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_4) ^  GPIO_PIN_4));


#define BIT0  0x0001 //0x01 << 0
#define BIT1  0x0002 //0x01 << 1
#define BIT2  0x0004 //0x01 << 2
#define BIT3  0x0008 //0x01 << 3
#define BIT4  0x0010 //0x01 << 4
#define BIT5  0x0020 //0x01 << 5
#define BIT6  0x0040 //0x01 << 6
#define BIT7  0x0080 //0x01 << 7
#define BIT8  0x0100 //0x01 << 8
#define BIT9  0x0200 //0x01 << 9
#define BIT10 0x0400 //0x01 << 10
#define BIT11 0x0800 //0x01 << 11
#define BIT12 0x1000 //0x01 << 12
#define BIT13 0x2000 //0x01 << 13
#define BIT14 0x4000 //0x01 << 14
#define BIT15 0x8000 //0x01 << 15

#define BIT16 0x00010000 //0x01 << 16
#define BIT17 0x00020000 //0x01 << 17
#define BIT18 0x00040000 //0x01 << 18
#define BIT19 0x00080000 //0x01 << 19
#define BIT20 0x00100000 //0x01 << 20
#define BIT21 0x00200000 //0x01 << 21
#define BIT22 0x00400000 //0x01 << 22
#define BIT23 0x00800000 //0x01 << 23
#define BIT24 0x01000000 //0x01 << 24
#define BIT25 0x02000000 //0x01 << 25
#define BIT26 0x04000000 //0x01 << 26
#define BIT27 0x08000000 //0x01 << 27
#define BIT28 0x10000000 //0x01 << 28
#define BIT29 0x20000000 //0x01 << 29
#define BIT30 0x40000000 //0x01 << 30
#define BIT31 0x80000000 //0x01 << 31

//---------------------
#define MaxFlashWords 128 //1K
#define MaxFlashBytes MaxFlashWords*4 //4K Byte
#define MaxBytesForAddress 256 //The addresses to be programmed must not span a 256-byte boundary

typedef union
{
    uint32_t DWords[MaxFlashWords];
    uint8_t Bytes[MaxFlashBytes];
}Flash_Union;
//----------------------------




#define LIMIT    0 // Limit Switch
#define NO_LIMIT 1

//SPI
typedef struct //S_SPI
{
    //unsigned char MotID; //- TODO to remove this field
    unsigned int TX_MOSI; //32bit (Master Output Slave Input )
    unsigned int RX_MISO; //24bit (Master Input  Slave Output)
    //unsigned int BUSY;    //32bit
    unsigned char AMT_OF_Words:3; //The amount of spi words (usually byte sized) per transmission (send 4 to 32bit)

}SPI;//SPI

#define SSI_SPI_TIMEOUT 1000

//---------------------------------------------------------------------
#pragma diag_suppress 169 /*  Avoid warnings on VOID * conversions (protobuf issue)
The warning:
#169-D argument of type "size_t (*)(const CalculateResponse *, uint8_t *)" is incompatible with parameter of type "size_t (*)(void *, uint8_t *)"   Calculate.c /twine_usblib_demo/PMR/Stubs    line 53 C/C++ Problem


//#pragma diag_suppress 190 // Avoid the warning - #190-D enumerated type mixed with another type    protobuf-c.c
 *
or in the environment add command line:

Project -> properties ->
Press on show advanced settings
CCS Build ->
Advanced Options ->
Diagnistic Options ->
Add the warning number in
Supports diagnostic <id> (--diag_suppress, - pds)
169
190
*/

//Project Properties->Build->Compiler->Include Options
//There may be paths there relative to a build variable, rather than hard-coded paths, that may be triggering the error.



#endif /* DATADEF_H */