Subversion Repositories EngineBay2

Rev

Rev 52 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52 Rev 55
Line 9... Line 9...
9
#include "main.h"
9
#include "main.h"
10
 
10
 
11
// this is set if there is a timer timeout interrupt
11
// this is set if there is a timer timeout interrupt
12
unsigned char volatile periodPulse = 0;
12
unsigned char volatile periodPulse = 0;
13
 
13
 
14
// this is set when timer 3 was triggerd 
14
// this is set when timer 3 was triggerd
15
unsigned char volatile tim3triggered = 0;
15
unsigned char volatile tim3triggered = 0;
16
 
16
 
17
// this is exported 
17
// this is exported
18
void
-
 
19
triggerTim3(void)
18
void triggerTim3(void)
20
{
19
{
21
  htim3.Instance->CNT = 0;
20
  htim3.Instance->CNT = 0;
22
  htim3.Instance->CR1 |= TIM_CR1_CEN;
21
  htim3.Instance->CR1 |= TIM_CR1_CEN;
23
}
22
}
24
 
23
 
Line 48... Line 47...
48
 
47
 
49
        // good observation if the status bit is clear, and the reading is less than 1023
48
        // good observation if the status bit is clear, and the reading is less than 1023
50
 
49
 
51
        uint16_t temp_c = obs >> 5;
50
        uint16_t temp_c = obs >> 5;
52
 
51
 
53
        uint8_t good = ((obs & 7) == 0) && (temp_c > 0) && (temp_c < 250);
52
        if (((obs & 7) == 0) && (temp_c > 0) && (temp_c < 250))
54
 
-
 
55
        if (good)
-
 
56
        {
-
 
57
          Temp_Observations[instance] = temp_c;
53
          AddTempReading(temp_c, instance);
58
        }
-
 
59
      }
54
      }
60
      nextTempCS(); // clock CS one more time to deselect all chips
55
      nextTempCS(); // clock CS one more time to deselect all chips
61
    }
56
    }
62
  }
57
  }
63
}
58
}
Line 72... Line 67...
72
 
67
 
73
    blink = !blink;
68
    blink = !blink;
74
    HAL_GPIO_WritePin(LED_Blink_GPIO_Port, LED_Blink_Pin,
69
    HAL_GPIO_WritePin(LED_Blink_GPIO_Port, LED_Blink_Pin,
75
                      blink ? GPIO_PIN_SET : GPIO_PIN_RESET);
70
                      blink ? GPIO_PIN_SET : GPIO_PIN_RESET);
76
 
71
 
77
 
-
 
78
    if (periodPulse == 1)
72
    if (periodPulse == 1)
79
    {
73
    {
80
      triggerTim3();
74
      triggerTim3();
81
    }
75
    }
82
    // indicate that timer 4 firing is owning the timer 3 trigger
76
    // indicate that timer 4 firing is owning the timer 3 trigger