mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2026-03-20 19:03:02 +01:00
minor mod for trackball
add read_adc to read temperature for thermal_printer
This commit is contained in:
@@ -333,6 +333,26 @@ void print_dots_8bit(CONFIG*cfg,uint8_t *Array, uint8_t characters,uint8_t feed_
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t read_adc() {
|
||||
long ret;
|
||||
char c[16];
|
||||
FILE *fptr;
|
||||
if ((fptr = fopen(ADC_FILE, "r")) == NULL) {
|
||||
printf("Error! ADC File cannot be opened\n");
|
||||
// Program exits if the file pointer returns NULL.
|
||||
return 0;
|
||||
}
|
||||
fscanf(fptr, "%[^\n]", c);
|
||||
//printf("Data from the file:\n%s", c);
|
||||
fclose(fptr);
|
||||
|
||||
ret = strtol(c, NULL, 10);
|
||||
//printf("the number ret %d\n",ret);
|
||||
|
||||
return (uint16_t)ret;
|
||||
}
|
||||
|
||||
|
||||
uint16_t temperature() {
|
||||
|
||||
|
||||
@@ -344,7 +364,8 @@ uint16_t temperature() {
|
||||
|
||||
while(Sample<=NumSamples)
|
||||
{
|
||||
ADCSamples += analogRead(THERMISTORPIN);
|
||||
//ADCSamples += analogRead(THERMISTORPIN); //stm32
|
||||
ADCSamples += read_adc();
|
||||
Sample++;
|
||||
}
|
||||
//Thermistor Resistance at x Kelvin
|
||||
|
||||
Reference in New Issue
Block a user