* add readme with comments on debugging
* add optional CFLAGS in Makefile for debugging * fix _patternChangeColor function in pattern.c * add debug variant for measure exec function
This commit is contained in:
45
measure.c
45
measure.c
@ -28,20 +28,8 @@ const uint8_t AVERAGING_CYCLES = 50;
|
||||
|
||||
|
||||
|
||||
void measureInit() {
|
||||
ADC10CTL0 = SREF1 | ADC10SHT_3 | ADC10SR | REFOUT | REFON | REF2_5V | ADC10ON;
|
||||
ADC10CTL1 = INCH_3;
|
||||
ADC10AE0 = BIT3;
|
||||
}
|
||||
|
||||
void measureCollectAndProcessConversion();
|
||||
|
||||
void measureStartConversion(void *handleArg) {
|
||||
ADC10CTL0 |= ENC | ADC10SC;
|
||||
schAdd(measureCollectAndProcessConversion, NULL, MEASURE_FETCH_RESULT_DELAY, 0);
|
||||
}
|
||||
|
||||
void measureCollectAndProcessConversion() {
|
||||
|
||||
static uint32_t averagingSum = 0;
|
||||
static uint8_t averagingCnt = 0;
|
||||
|
||||
@ -81,4 +69,35 @@ void measureCollectAndProcessConversion() {
|
||||
}
|
||||
}
|
||||
|
||||
void measureTestExec() {
|
||||
static uint8_t t = 0;
|
||||
static int8_t dir = 1;
|
||||
|
||||
if (t == 0) {
|
||||
dir = 1;
|
||||
}
|
||||
|
||||
if (t == 50) {
|
||||
dir = -1;
|
||||
}
|
||||
|
||||
t += dir;
|
||||
|
||||
patternSetTemperature(t);
|
||||
}
|
||||
|
||||
void measureInit() {
|
||||
ADC10CTL0 = SREF1 | ADC10SHT_3 | ADC10SR | REFOUT | REFON | REF2_5V | ADC10ON;
|
||||
ADC10CTL1 = INCH_0;
|
||||
ADC10AE0 = BIT0;
|
||||
|
||||
// schAdd(measureStartConversion, NULL, 0, 100);
|
||||
schAdd(measureTestExec, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
void measureStartConversion() {
|
||||
ADC10CTL0 |= ENC | ADC10SC;
|
||||
schAdd(measureCollectAndProcessConversion, NULL, MEASURE_FETCH_RESULT_DELAY, 0);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user