mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2025-12-12 18:28:50 +01:00
minor mod for trackball
add read_adc to read temperature for thermal_printer
This commit is contained in:
parent
c626e1f797
commit
46944be3ce
@ -5,7 +5,7 @@
|
||||
|
||||
#include <USBComposite.h>
|
||||
|
||||
#define SER_NUM_STR "20210517"
|
||||
#define SER_NUM_STR "20210515"
|
||||
|
||||
USBHID HID;
|
||||
DEVTERM dev_term;
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
#include "keys_io_map.h"
|
||||
|
||||
#define BOUNCE_INTERVAL 30
|
||||
#define BASE_MOVE_PIXELS 5
|
||||
#define EXPONENTIAL_BOUND 15
|
||||
#define BOUNCE_INTERVAL 100
|
||||
#define BASE_MOVE_PIXELS 3
|
||||
#define EXPONENTIAL_BOUND 10
|
||||
#define EXPONENTIAL_BASE 1.2
|
||||
|
||||
#define BTN_PIN KEY0
|
||||
|
||||
@ -112,14 +112,15 @@
|
||||
#define BCoefficent 3950
|
||||
#define RthNominal 30000
|
||||
#define TempNominal 25
|
||||
#define ADCResolution 4096
|
||||
#define ADCResolution 1024
|
||||
#define SeriesResistor 30000
|
||||
|
||||
#define NumSamples 10
|
||||
|
||||
#define KELVIN 1
|
||||
#define CELSIUS 0
|
||||
|
||||
#define ADC_FILE "/sys/class/i2c-dev/i2c-1/device/1-0054/iio:device1/in_voltage_raw"
|
||||
|
||||
#define HEAT_TIME 300 // heat time,better not greater than 1000,300-1000 0-f
|
||||
|
||||
#define int16 uint16_t
|
||||
|
||||
@ -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
|
||||
|
||||
@ -26,6 +26,7 @@ void print_dots_8bit_split(CONFIG*cfg,uint8_t *Array, uint8_t characters);
|
||||
|
||||
void print_dots_8bit(CONFIG*cfg,uint8_t *Array, uint8_t characters,uint8_t feed_num);
|
||||
|
||||
uint16_t read_adc();
|
||||
uint16_t temperature();
|
||||
|
||||
uint8_t print_lines8(CONFIG*);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user