Changeset - c451612527c8
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-08-23 23:46:28
ez@ethanzonca.com
updated config interface
1 file changed with 2 insertions and 2 deletions:
main.c
2
2
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -177,28 +177,28 @@ int16_t temp = 0;
 
uint8_t temp_frac = 0;
 
void update_temp() {
 
    // Assert CS
 
    GPIO_ResetBits(MAX_CS);
 
    Delay(1);
 
 
    // This may not clock at all... might need to send 16 bits first
 
    SPI_I2S_SendData(SPI2, 0xAAAA); // send dummy data
 
    //SPI_I2S_SendData(SPI2, 0xAA); // send dummy data
 
    uint16_t temp_pre = SPI_I2S_ReceiveData(SPI2);
 
 
    if(temp_pre & 0b0000000000000010) {
 
        ssd1306_DrawString("Fatal Error", 3, 35);
 
        ssd1306_DrawString("Fatal Error", 2, 35);
 
    }
 
    else if(temp_pre & 0b0000000000000001) {
 
        ssd1306_DrawString("TC Fault", 3, 35);
 
        ssd1306_DrawString("TC Fault", 2, 35);
 
    }
 
 
    uint8_t sign = temp >> 15;// top bit is sign
 
 
    temp_pre = temp_pre >> 2; // Drop 2 lowest bits
 
    temp_frac = temp_pre & 0b11; // get fractional part
 
    temp_frac *= 25; // each bit is .25 a degree, up to fixed point
 
    temp_pre = temp_pre >> 2; // Drop 2 fractional bits 
 
 
    if(sign) {
 
        temp = -temp_pre;
 
    }
0 comments (0 inline, 0 general)