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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#include "include.h"
#include <DataDef.h>
#include <Modules/Waste/newWHS_init.h>
#include <Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.h>
#include <Drivers/I2C_Communication/I2C.h>
#include "Drivers/I2C_Communication/WHS_Card/WHS_data.h"
#include <Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.h>
#include <Drivers/I2C_Communication/I2C_Task.h>
#include <Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h>
#include <Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h>
#include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h>
#include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h>
#include <Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.h>
#include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h>
#include <Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h>
bool test_9555(void);
bool WHS_I2C_EEprom_Write_Ch_shai_taest(void);
uint8_t WHS_Write_Buf[9];
uint8_t WHS_Read_Buf[9];
#define PAGE 256
bool WHS_I2C_EEprom_Read_Buf()
{
bool status= OK;
uint8_t address_high_byte = 0x00;
uint8_t address_low_byte = 0x00;
status |= Select_Main_WHS_Mux_Channel();
//Set to read
WHS_Write_Buf[0] = address_high_byte;
WHS_Write_Buf[1] = address_low_byte;
status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, 2);
status |= I2C_Read(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS + 1, WHS_Eeprom.Buf, sizeof(WHS_EEPROM_BYTES));
return status;
}
bool newWHS_init(void)
{
bool status = OK;
//Main_Mux_Flag = 0;
// delayms(4000);
// status = Select_Main_WHS_Mux_Channel();
//Trigger_Check_WHS_Type_Via_EEPROM();
Trigger_WHS_init_IO();
Trigger_WHS_init_fan();
Trigger_WHS_init_PT100();
Trigger_WHS_init_Blower();
Trigger_WHS_MAX11614_Init();
Trigger_WHS_Rheostat_init();
status |= WHS_I2C_EEprom_Read_Buf();
Trigger_WHS_I2C_EEprom_Read ( 0, sizeof(WHS_Eeprom.bytes), WHS_Eeprom.Buf);
//status |= WHS_IO_Init();
//status |= init_WHS_fan();
//
//status |= WHS_PT100_InitConfigReg();
// if (Test_WHS_EEPROM()!= OK)
// {
// ReportWithPackageFilter(WasteFilter,"------------ Test_WHS_EEPROM U32: test is failed-----------------", __FILE__,__LINE__,0, RpMessage, 0, 0);
// }
// status = Test_WHS_Fan();
// status = Test_WHS_blower();
// status |= Test_WHS_valve();
// status |= Test_WHS_pump();
// status |= Test_WHS_max11614();
// status |= Test_WHS_AD5272_A2D();
// status |= Test_WHS_PT100_ADC();
// //test_9555();
// status |= WHS_I2C_EEprom_Write_Ch_shai_taest();
//Set_All_WHS_Fans(0xFF);
// delayms(4000);
//Trigger_SetWHSBlowerVoltage (0x0C00);
return status;
}
bool test_9555(void)
{
bool status = OK;
status = WHS_Write_IO(I2CExp1_ADDRESS, D_TCA9555_PORT_0);
return status;
}
bool WHS_I2C_EEprom_Write_Ch_shai_taest()
{
bool status= OK;
uint8_t data[256] ;
uint8_t Rdata[256] ;
uint32_t address = 0;
uint16_t i = 0;
// uint8_t address_high_byte = 0xF0;
// uint8_t address_low_byte = 0x00;
uint16_t size = 0;
size = PAGE;
for (i=0; i< PAGE; i=i+2)
{
data[i]= 0xAA;
data[i+1]= 0x55;
}
for (address=0; address < 0x1F3FF; address=address+256)
{
Trigger_WHS_I2C_EEprom_Write( address, size, data);
SysCtlDelay(5000000);//Must delay for at least 5 milli. !!! (See data sheet )
Trigger_WHS_I2C_EEprom_Read ( address, size, Rdata);
address= i*256;
}
// status |= Select_Main_WHS_Mux_Channel();
//
// WHS_Write_Buf[0] = address_high_byte;
// WHS_Write_Buf[1] = address_low_byte;
// WHS_Write_Buf[2] = 0xAA;
// WHS_Write_Buf[4] = 0xAA;
// WHS_Write_Buf[6] = 0xAA;
// WHS_Write_Buf[8] = 0xAA;
// WHS_Write_Buf[3] = 0x55;
// WHS_Write_Buf[5] = 0x55;
// WHS_Write_Buf[7] = 0x55;
//
//
//
//
// status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, 9);
// SysCtlDelay(5000000);//Must delay for at least 5 milli. !!! (See data sheet )
// status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, 2);
// status |= I2C_Read(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS + 1, WHS_Read_Buf, 7);
return status;
}
|