Subversion Repositories EngineBay2

Rev

Rev 10 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 11
Line 183... Line 183...
183
        plx_sendword(PLX_RPM);
183
        plx_sendword(PLX_RPM);
184
        PutCharSerial(&uc1, instance);
184
        PutCharSerial(&uc1, instance);
185
        plx_sendword(Coded_RPM);
185
        plx_sendword(Coded_RPM);
186
}
186
}
187
 
187
 
-
 
188
uint8_t CHT_Timer = 0;
188
 
189
 
189
// this uses a MAX6675 which is a simple 16 bit read
190
// this uses a MAX6675 which is a simple 16 bit read
190
// SPI is configured for 8 bits so I can use an OLED display if I need it
191
// SPI is configured for 8 bits so I can use an OLED display if I need it
-
 
192
// must wait > 0.22 seconds between conversion attempts as this is the measurement time
-
 
193
//
191
void ProcessCHT(int instance)
194
void ProcessCHT(int instance)
192
{
195
{
193
        uint8_t buffer[2];
196
        uint8_t buffer[2];
-
 
197
        CHT_Timer++;
-
 
198
        if(CHT_Timer >= 3) // every 300 milliseconds
-
 
199
 
-
 
200
        {
-
 
201
                CHT_Timer=0;
-
 
202
 
194
                   HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, SPI_NS_Temp_Pin, GPIO_PIN_RESET);
203
                   HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, SPI_NS_Temp_Pin, GPIO_PIN_RESET);
195
 
204
 
196
 
205
 
-
 
206
                   HAL_Delay(1);
-
 
207
 
197
                   HAL_SPI_Receive(&hspi1, buffer, 2, 2);
208
                   HAL_SPI_Receive(&hspi1, buffer, 2, 2);
198
 
209
 
199
 
210
 
200
 
211
 
201
                   uint16_t obs = (buffer[0]<<8)| buffer[1];
212
                   uint16_t obs = (buffer[0]<<8)| buffer[1];
Line 207... Line 218...
207
                   }
218
                   }
208
                   else
219
                   else
209
                   {
220
                   {
210
                          Coded_CHT= 1000; // signal fail
221
                          Coded_CHT= 1000; // signal fail
211
                   }
222
                   }
-
 
223
        }
-
 
224
 
212
        plx_sendword(PLX_EGT);
225
        plx_sendword(PLX_EGT);
213
        PutCharSerial(&uc1, instance);
226
        PutCharSerial(&uc1, instance);
214
        plx_sendword(Coded_CHT);
227
        plx_sendword(Coded_CHT);
215
        PutCharSerial(&uc2,Coded_CHT + 32);
228
        PutCharSerial(&uc2,Coded_CHT + 32);
216
           HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, SPI_NS_Temp_Pin, GPIO_PIN_SET);
229
           HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, SPI_NS_Temp_Pin, GPIO_PIN_SET);