aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/DataDef.h
blob: 669e2cbe5a6fefda141ea9153241587e2b6a6035 (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
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{40085232-ACED-4CBE-945B-90BA8153C151}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Tango.BrushPicker</RootNamespace>
    <AssemblyName>Tango.BrushPicker</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\Build\Core\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\Build\Core\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup>
    <SignAssembly>false</SignAssembly>
  </PropertyGroup>
  <PropertyGroup>
    <AssemblyOriginatorKeyFile>
    </AssemblyOriginatorKeyFile>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xaml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="..\Versioning\GlobalVersionInfo.cs">
      <Link>GlobalVersionInfo.cs</Link>
    </Compile>
    <Compile Include="Converters\BrushToGradientStopsConverter.cs" />
    <Compile Include="Implementation\AlphaSelector.cs" />
    <Compile Include="Implementation\BaseSelector.cs" />
    <Compile Include="Implementation\BrushPicker.cs" />
    <Compile Include="Implementation\ColorChangedEventArgs.cs" />
    <Compile Include="Implementation\BrushTypes.cs" />
    <Compile Include="Implementation\DoubleUpDown.cs" />
    <Compile Include="Implementation\Enums.cs" />
    <Compile Include="Implementation\GradientStopAdder.cs" />
    <Compile Include="Implementation\GradientStopSlider.cs" />
    <Compile Include="Implementation\HueSelector.cs" />
    <Compile Include="Implementation\SaturationBrightnessSelector.cs" />
    <Compile Include="Implementation\SpinEventArgs .cs" />
    <Compile Include="Implementation\Spinner.cs" />
    <Compile Include="Utils\TextBoxBehavior.cs" />
    <Compile Include="Implementation\UpDownBase.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Utils\ColorHelper.cs" />
    <Compile Include="Utils\InputValidationErrorEventArgs .cs" />
  </ItemGroup>
  <ItemGroup>
    <Page Include="Themes\Generic.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
    </VisualStudio>
  </ProjectExtensions>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
458'>458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
#ifndef DATADEF_H
#define DATADEF_H

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

//#define EVALUATION_BOARD // to use the LCD only when using the evaluation board
//#define USE_USB
#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  test_RTFU_dancer 1
//#define WithTempSensorFiltrer (to use the function Filter_Temparature_Measurement)
//#define DEBUG_TEST_FUNCTIONS
#define  HIZ_TIMEOUT 1000
//#define TEST_LONGER_PID_THREAD
//#define HUNDRED_MICROSECONDS_DANCER_READ
#define NO_INITIAL_HEATING
#define MAX_STRING_LEN              255 //Embedded  version + filter.c

#define WATCHDOG
//#define DISPESER_TEST
//#define FPGA_WATCHDOG_DISABLE

#ifndef WATCHDOG
#define STORE_DEBUG_LOGS
#endif
//#define STORE_DEBUG_LOGS
//#define FOUR_WINDERS
#ifdef FOUR_WINDERS
#define BTSR_NO_FEEDER_TFU
#define BTSR_NO_PULLER_TFU
#define BTSR_ROTATED_WINDER_TFU
#endif
//#define BTSR_ROTATED_WINDER_TFU

//#define UFEEDER_BTSR
#ifdef UFEEDER_BTSR
#define BTSR_NO_FEEDER_TFU
#define BTSR_NO_PULLER_TFU
#define BTSR_ROTATED_WINDER_TFU
#endif

//#define USE_UART4_FOR_BTSR // need change in FRPGA FPGA_1 yy > 0x20 + jumpers in main board need to read HW Version - no need when working only with stubs
//#define FORCE_BTSR_CARD_0023 //0014 only for testing, include changes for BTSR without ASSY ID. use it with USE_UART4_FOR_BTSR

//#define USE_RFID_STUB //stub only. to use it undef USE_RFID_LOGIC
//#define RFID_READ_ONLY //
//#define USE_RFID_LOGIC //See more settings in RFID_Settings.h
//#define USE_POWERSTEP01 -NA
//#define LIGHT_COLORS
//#define EMC_FORCE_MOT_CLOCK_INTERNAL

//#define VAC_TEST
#define DISPENSER_VALVES_OPEN
//#define DISPENSER_PBU_PRE_RUN
//#define USE_TUNNEL_PT100
//#define BTSR_NO_FEEDER_TFU
//#define BTSR_NO_PULLER_TFU
//#define IGNORE_SPIKE

#define USE_OLD_HEAD_EEPROM


//#define USE_VOC_BUZZER_ALARM

#define I2C_2_Data_Transfer_Rate_400kbps
#define I2C_3_Data_Transfer_Rate_400kbps// Head card + WHS card
#define I2C_4_Data_Transfer_Rate_400kbps// RFID + Dispensers

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

#define NFC_HARDWARE_RESET 0x01

#define REPEATED_INIT_FAILURE_LIMIT 10
//#define RUN_AS_MAIN_JIG//(TEST_POWERSTEP01) send GATECFG parameters to work without sending parameters via machine studio + ADC + ADCINT

#define ON  1
#define OFF 0

#define INTERNAL 0
#define EXTERNAL 1

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

typedef enum Status_Enum // don't change used for RFID
{
    S_NA = 0,
    S_SUCCEEDED = 1,
    S_FAILED = -2,
    S_NOTINUSE = -1
}STATUS_ENUM;

typedef enum
{
    //logitag ID
    READER_1 = 0,
    READER_2 = 1,
    READER_3 = 2,
    Max_Readers = 3,
}RFID_READER_ID;


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

#define ENABLE  1
#define DISABLE 0

#define DONTCARE 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
//waste valve reversed
#define Mixer_Head            1
#define Mixer_Waste           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 DOWN 0
#define UP   1

#define TX 0
#define RX 1
#define TXRX 2
#define TX_FIRST_BYTE 3     //for BTSR
#define TX_NOT_FIRST_BYTE 4 //for BTSR

#define ODD         0
#define EVEN        1

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

#define LOW  0x0
#define HIGH 0x1
#define LOW_AND_HIGH 0x2
#define HIGHEST 0x3

#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 HEAD  0
#define WHS   1

#define DONE  1
#define UNKNOWN  0xFF

#define DRIER_LID_OPEN 0
#define DRIER_LID_CLOSE 2

#define DH_LID_OPEN 0
#define DH_LID_CLOSE 2

#define DOUBLE_BUFFER 2

#define STOPPED 0
#define MOVING 1

extern int InitFailures;

/*
#define CurrentMotDriver 0x08
#define VoltageMotDriver 0x00
#define CurrentCombinedMotDriver 0x0108 // 01 Combined Driver, 08 Current
#define VoltageCombinedMotDriver 0x0100 // 01 Combined Driver, 00 Voltage
#define CombinrdMotDriver 0x0300 // 03 Combined Driver + Combined Modes , 00 Voltage mode enabled
*/

typedef enum
{
    //Don't change the value!
    Current = 0x08,
    Voltage = 0x00,
}MOTDRIVER_MODE;

typedef enum
{
    Combinrd = 0x00,
    Current_Or_Voltage = 0x01,
}SPI_MOT_DRIVER_DIRECTION;

typedef enum
{
    UnKnownMotDriver,
    CurrentMotDriver,
    VoltageMotDriver,
    CombinrdMotDriver,
}MOTDRIVER_TYPE;

typedef enum
{
    High_Voltage,
    Normal_Voltage,
    Low_Voltage,
}PowerControlFlag;

typedef enum
{
    OneStep,
    Auto,
}StateMachineMode;

//#define MagneticLImitSwitch 0x01

//#define FPGA_Reg_Size_Bits 16

#define FPGA_Freq 29166667

#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

extern struct tm LocalTime;//Months since January - [0,11]

//LocalTimeInAScii
typedef union
{
    struct
    {
        uint8_t DayH; //0
        uint8_t DayL; //1
        uint8_t SlashD; //2
        uint8_t MonthH; //3
        uint8_t MonthL; //4
        uint8_t SlashM; //5
        uint8_t YearH; //6
        uint8_t YearL; //7
    }Byte;
    uint8_t Buf[8];
    uint64_t Uint64;
}TimeAScii;

#define MAX_PWM_Command 100

typedef enum
{
    //Don't change the value -  keep it according to the bits in F3_GPO_02_bus
    CART_1 = 1,
    CART_2  = 2,
    CART_3  = 3,
    //-------------
    POWER_ON_OFF,
    THREAD_JOGGING ,
    THREAD_LOAD ,
}PANEL_BUTTON_OR_CRAT_ID;

#define CART(readerID) ((PANEL_BUTTON_OR_CRAT_ID)(readerID+1))//readerID 0-2 , CRAT_ID 1-3

typedef enum
{
    MODE_OFF = 0,
    MODE_ON = 1,
}OPERATION_MODE;
/*
typedef enum
{
    //according to the bits of the leds in F3_GPO_01_bus
    ON_OFF = 1,
    THREAD_LOADING  = 2,
    JOGGING = 3,
}BUTTON;
*/
/*
typedef enum
{
    //According to the bits of the leds in F3_GPO_02_bus
    CART1 = 1,
    CART2  = 2,
    CART3 = 3,
}CARTREGE;
*/


typedef union
{
    struct
    {
        uint8_t DRAWER_BIG:1;   //bit 0
        uint8_t DRAWER_SMALL0:1;//bit 1
        uint8_t DRAWER_SMALL1:1;//bit 2
        uint8_t DRAWER_SMALL2:1;//bit 3
        uint8_t DRAWER_SMALL3:1;//bit 4
        uint8_t SYSTEM_FAN0:1;  //bit 5
        uint8_t SYSTEM_FAN1:1;  //bit 6
        uint8_t SYSTEM_FAN2:1;  //bit 7
    }bit;
    uint8_t Uchar;
}FANS_STATUS;

enum
{
    DRAWER_B,
    DRAWER_S0,
    DRAWER_S1,
    DRAWER_S2,
    DRAWER_S3,
    SYSTEM_0,
    SYSTEM_1,
    SYSTEM_2,
    MAX_FANS,
}FANS_ID;

//---------------------
#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

extern char *SW_INFO_DIR;

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




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

#define No_Safety_Event       1
#define Safety_Event_Occurred 0

#define No_Over_Current_Event       1
#define Over_Current_Event_Occurred 0

//#define INVERSION_POLARITY_LIMIT    1 // Limit Switch
//#define INVERSION_POLARITY_NO_LIMIT 0

//Dyeing head types
typedef enum
{
    HEAD_TYPE_UNKNOWN,
    HEAD_TYPE_FLAT_WITHOUT_CARD,
    HEAD_TYPE_UNKNOWN_WITH_CARD,
    HEAD_TYPE_FLAT,
    HEAD_TYPE_ARC,
}HEAD_TYPE;

extern uint8_t Head_Type;

//WHS types
typedef enum
{
    WHS_TYPE_UNKNOWN,
    WHS_TYPE_NEW,
}WHS_TYPE;

extern uint8_t WHS_Type;
extern uint8_t SmallFansCfg;
extern uint8_t LargeFansCfg;

bool Is_PP_Machine(void);

typedef enum
{
    DISP_TYPE_UNKNOWN,
    DISP_TYPE_WITHOUT_EEPROM,
    DISP_TYPE_EEPROM32KB,
    DISP_TYPE_EEPROM128KB,

}DISP_TYPE;

typedef enum
{
    I2C_COMM_UNKNOWN,
    I2C_COMM_PASSED,
    I2C_COMM_FAILED,
}I2C_COMM_STAT;

typedef enum
{
    DEFAULT_POLARITY = 0,//OPTIC_LS , MAGNETIC_LS CARD 2
    INVERSION_POLARITY = 1,//MAGNETIC_LS CARD 2 - must be 1 used for xor the polarity
}LS_POLARITY;

typedef enum
{
    LS_STATUS_OK = 0,
    LS_STATUS_ERROR = 1,
}LS_STATUS;

typedef enum
{
    HEAD_FAN_RIGHT,
    HEAD_FAN_LEFT,
    MAX_HEAD_FAN,
}HEAD_FAN_ENUM;

typedef enum
{
    OPEN_MAGNET,
    CLOSE_MAGNET,
    DISABLE_MAGNET
}MAGNET_COMMAND_ENUM;

typedef union
{
    uint8_t  Byte[4];
    uint32_t Word;
}Word_to_Bytes;

/*
typedef union
{
    struct
    {
        uint32_t SN;            //0-4
        uint8_t  Version;       //5
        uint8_t  Content;       //6
        uint8_t  Location ;     //7
        uint8_t  Life_Time ;    //8
        uint32_t Calibration ;  //9-12
        uint32_t Spare ;        //13-15
    }bytes;
    uint8_t Buf[16];
}DISP_EEPROM;
*/

/*
////////////////////////////////////////////
typedef struct
{
    uint32_t  SN;
    uint32_t  Batch_Productions_data;
    uint32_t  Production_date;
    uint32_t  Dispenser_Part_Number;
    uint32_t  PCB_Serial;
    uint32_t  PCB_Version;
}DISPENSER_DATA;

typedef struct
{
    float  Humidity;
    float  Temperature;
}DISPENSER_TEST_AMBIENT;

typedef struct
{
    uint16_t  Current;
    uint16_t  Batch;
}DISPENSER_COLOR;

typedef struct
{
    float  Calibration0;
    float  Calibration1;
}DISPENSER_CALIBRATION_TABLE;

typedef struct
{
    DISPENSER_DATA Dispebser_Data;
    uint32_t Calibration_Test_Date ;
    uint32_t ATS_location_Slot ;
    uint32_t Nl_Pulse_Value ;
    uint32_t Flow_Pass_Fail ;
    DISPENSER_CALIBRATION_TABLE Calibration_table;
    uint32_t Test_TI_Batch;
    DISPENSER_COLOR     Color;
    DISPENSER_TEST_AMBIENT Test_Ambient;
    uint32_t Total_Cycles_Working_Time;
    uint32_t Spare[5];
}DISP_EEPROM_BYTES;


*/
#define MAX_SYSTEM_DISPENSERS 8

typedef struct
{
    uint32_t Header;
    uint32_t Table_Length;
    uint32_t Table_version;
    uint8_t  Dispenser_Part_Number[20];//String
    uint8_t  PCB_SN[20];//String
    uint8_t  PCB_Part_Number[20];//String
    uint8_t  Dispenser_SN[20];//String
    int32_t  Minimal_Pressure;
    int32_t  Maximal_Pressure;
    int32_t  Minimal_MV;
    int32_t  Maximal_MV;
    uint32_t Total_Cycles;
    uint32_t Bubble_Size;
    uint32_t AVG_Nl_Step_Value_1_4;
    uint32_t AVG_Nl_Step_Value_2_4;
    uint32_t AVG_Nl_Step_Value_3_4;
    uint32_t AVG_Nl_Step_Value_4_4;
    uint32_t SW_Reserve;
    int32_t  Spare1_pressure;
    int32_t  Spare2_pressure;
    uint32_t Motor_PPC;
    uint32_t color;
    uint32_t Pressure_Slope;
    uint8_t  Production_Test_Date[8];//string
    uint32_t ATS_Location;
    uint32_t ATS_Channel;
    uint32_t Spare1;
    uint32_t Spare2;
    uint8_t  Unit_Empty;
    uint8_t  Dry_Run_Status;
    uint8_t  Flow_Status;
    uint8_t  CheckSum;
}DISP_EEPROM_BYTES;

typedef union
{
    DISP_EEPROM_BYTES bytes;
    uint8_t Buf[sizeof(DISP_EEPROM_BYTES)];
}DISP_EEPROM;
////////////////////////////////////////////
typedef struct
{
    DISP_TYPE Type;
    LS_POLARITY LS_Polarity;
    DISP_EEPROM Write_Disp_EEPROM;
    DISP_EEPROM Read_Disp_EEPROM;
    LS_STATUS Status;
    I2C_COMM_STAT I2C_Status;// TBD added to calculate the pressure as new when there is i2c no communication (unable to read the eeprom)
}DISP;

DISP Dispenser_struct[8];

//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

extern void  *my_malloc(size_t _size);
extern void   my_free(void *_ptr);
extern uint32_t msec_millisecondCounter;
//---------------------------------------------------------------------
#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.
//machine 2 only!!!!!!!!!!!
//#define HEAD6_PT100 TEMP_SENSE_ANALOG_MIXCHIP_TEMP
//#define MIXER_PT100 TEMP_SENSE_AN_ENCLOSURETEMP3
//machine 2 only!!!!!!!!!!!
#define HEAD6_PT100 TEMP_SENSE_AN_ENCLOSURETEMP3
#define MIXER_PT100 TEMP_SENSE_ANALOG_MIXCHIP_TEMP

#ifdef LIGHT_COLORS
#define LUBRICANT_DISPENSER 9
#define CLEANER_DISPENSER 9
#define MAX_DYE_DISPENSERS MAX_SYSTEM_DISPENSERS
#else
#define LUBRICANT_DISPENSER 7
#define CLEANER_DISPENSER 6
#define MAX_DYE_DISPENSERS 6
#endif
#define MAX_CARTRIDGES 3

typedef enum
{
    MIDTANK_1,
    MIDTANK_2,
    MIDTANK_3,
    MIDTANK_4,
    MIDTANK_5,
    MIDTANK_6,
    MIDTANK_7,
    MIDTANK_8,
    NUM_OF_MIDTANKS,
} MidTank_t;

extern char* LiquidTypes[10];
extern PackageHandle ControlFilter;
extern PackageHandle HeatersFilter;
extern PackageHandle JobFilter  ;
extern PackageHandle WasteFilter  ;
extern PackageHandle AlarmFilter  ;
extern PackageHandle DiagnosticsFilter;
extern PackageHandle IDSFilter;
extern PackageHandle ThreadFilter;
extern PackageHandle GeneralFilter;
extern PackageHandle CommFilter;
extern PackageHandle FPGAFilter;
extern PackageHandle LoadFilter;
extern PackageHandle InitFilter;
extern PackageHandle MaintFilter;

#ifndef max
    #define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
    #define min(a,b) ((a) < (b) ? (a) : (b))
#endif

#endif /* DATADEF_H */