|
|
|
@ -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++;
|
|
|
|
|