various changes, introduced calc_temp function

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

@ -17,7 +17,7 @@
#include "main.h" #include "main.h"
uint8_t newThermoData = 1; uint8_t newThermoData = 1;
uint16_t thermoData[] = {1024, 814, 2475, 2243}; uint16_t thermoData[];
void hardinit() { void hardinit() {
@ -75,12 +75,12 @@ int __attribute__((noreturn)) main(void) {
for(;;){ for(;;){
usbPoll(); usbPoll();
SOFTTIMER(2,500) { SOFTTIMER(2,800) {
thermoData[0]=thermoData[0]+5; uint16_t recv;
thermoData[1]=thermoData[1]+15; for(int i=0; i<4; i++) {
thermoData[2]=thermoData[2]+7; thermoData[i] = spi_master_transceive(7, i, 0);
thermoData[3]=thermoData[3]+18; }
newThermoData = 1; newThermoData = 1;
} }
SOFTTIMER(1,250) { 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){ ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
uint16_t tmp; uint16_t tmp;

@ -29,6 +29,11 @@ int16_t temp_avg_count[4];
#define MUXER_CHANNEL_2 1 #define MUXER_CHANNEL_2 1
#define MUXER_CHANNEL_3 3 #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 */ /* initializes the hardware */
void hardinit() { void hardinit() {
// enable softtimer isr // enable softtimer isr
@ -60,7 +65,7 @@ int __attribute__((noreturn)) main(void) {
SOFTTIMER(1,10) { SOFTTIMER(1,10) {
for(int i=0; i<4; i++) { for(int i=0; i<4; i++) {
if(sensor_active[i] && mcpadc_has_new_data(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_cumul[i] += temperatures[i];
temp_avg_count[i] += 1; temp_avg_count[i] += 1;
} }
@ -84,7 +89,6 @@ int __attribute__((noreturn)) main(void) {
} }
ISR(TIMER1_OVF_vect,ISR_NOBLOCK){ ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
timertmp=timer1_acc; timertmp=timer1_acc;
timertmp++; timertmp++;

Loading…
Cancel
Save