various changes, introduced calc_temp function

master
Dario Ernst 15 years ago
parent 4056a4051f
commit 687c51d2ef

@ -17,7 +17,7 @@
#include "main.h"
uint8_t newThermoData = 1;
uint16_t thermoData[] = {1024, 814, 2475, 2243};
uint16_t thermoData[];
void hardinit() {
@ -75,12 +75,12 @@ int __attribute__((noreturn)) main(void) {
for(;;){
usbPoll();
SOFTTIMER(2,500) {
thermoData[0]=thermoData[0]+5;
thermoData[1]=thermoData[1]+15;
thermoData[2]=thermoData[2]+7;
thermoData[3]=thermoData[3]+18;
newThermoData = 1;
SOFTTIMER(2,800) {
uint16_t recv;
for(int i=0; i<4; i++) {
thermoData[i] = spi_master_transceive(7, i, 0);
}
newThermoData = 1;
}
SOFTTIMER(1,250) {
@ -89,13 +89,6 @@ int __attribute__((noreturn)) main(void) {
}
}
/*
ISR(TIMER1_OVF_vect, ISR_NAKED){
asm volatile ("in %0, %1\n" : "=r" (sreg_store) : "I" (_SFR_IO_ADDR(SREG)));
timer1_acc++;
asm volatile ("out %1, %0\n" : "=r" (sreg_store) : "I" (_SFR_IO_ADDR(SREG)));
reti();
}*/
ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
uint16_t tmp;

@ -29,6 +29,11 @@ int16_t temp_avg_count[4];
#define MUXER_CHANNEL_2 1
#define MUXER_CHANNEL_3 3
uint16_t calc_temp(uint16_t val) {
// TODO: implement polygon ... wait, no, polyester, uh, no again? ... poly-thingy?
}
/* initializes the hardware */
void hardinit() {
// enable softtimer isr
@ -60,7 +65,7 @@ int __attribute__((noreturn)) main(void) {
SOFTTIMER(1,10) {
for(int i=0; i<4; i++) {
if(sensor_active[i] && mcpadc_has_new_data(i)) {
temperatures[i] = mcpadc_get_data(i);
temperatures[i] = calc_temp( mcpadc_get_data(i) );
temp_avg_cumul[i] += temperatures[i];
temp_avg_count[i] += 1;
}
@ -84,7 +89,6 @@ int __attribute__((noreturn)) main(void) {
}
ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
timertmp=timer1_acc;
timertmp++;

Loading…
Cancel
Save