// Todo [CRITICAL]: External pull-down resistors 10kOhm
// Outputs
DDRD|=(1<<PORTD4);
@ -69,7 +67,9 @@ int main()
/*
*HighVoltageboosting
*/
if(boost_highVoltage_nextTick>0&&(uint16_t)TCNT1>=boost_highVoltage_nextTick)// If we are on or after the tick it should be executed
if(boost_highVoltage_nextTick>0)// If there is a nextTick
{
if((uint16_t)TCNT1>=boost_highVoltage_nextTick&&((uint16_t)TCNT1-boost_highVoltage_nextTick)<(timer1_overflow_value/2))// If we are on or after the tick it should be executed
{
// Flip pin state
PORTD^=(1<<PORTD4);
@ -78,12 +78,15 @@ int main()
boost_highVoltage_nextTick=(uint16_t)TCNT1+F_CPU/timer1_prescaler*1/(boost_frequency/2);// Half of time it should be high/low
if(boost_highVoltage_nextTick==0)boost_highVoltage_nextTick++;// If its 0, it stops, we dont want that
}
}
/*
*Signaloutput
*/
// Piezo
if(signalOutput_piezo_nextTick>0&&(uint16_t)TCNT1>=signalOutput_piezo_nextTick)// If we are on or after the tick it should be executed
if(signalOutput_piezo_nextTick>0)// If there is a nextTick
{
if((uint16_t)TCNT1>=signalOutput_piezo_nextTick&&((uint16_t)TCNT1-signalOutput_piezo_nextTick)<(timer1_overflow_value/2))// If we are on or after the tick it should be executed
{
// Flip pin state
PORTD^=(1<<PORTD5);
@ -98,8 +101,11 @@ int main()
signalOutput_piezo_nextTick=(uint16_t)TCNT1+F_CPU/timer1_prescaler*signalOutput_piezo_time/1000;// Calculate nextTick based on time in ms
if(signalOutput_piezo_nextTick==0)signalOutput_piezo_nextTick++;// If its 0, it stops, we dont want that
}
}
// LED
if(signalOutput_led_nextTick>0&&(uint16_t)TCNT1>=signalOutput_led_nextTick)// If we are on or after the tick it should be executed
if(signalOutput_led_nextTick>0)// If there is a nextTick
{
if((uint16_t)TCNT1>=signalOutput_led_nextTick&&((uint16_t)TCNT1-signalOutput_led_nextTick)<(timer1_overflow_value/2))// If we are on or after the tick it should be executed
{
// Flip pin state
PORTD^=(1<<PORTD6);
@ -115,6 +121,7 @@ int main()
if(signalOutput_led_nextTick==0)signalOutput_led_nextTick++;// If its 0, it stops, we dont want that
}
}
}
sei();// Activate global interrupts (after checks) [when an interrupt was fired, it will now be executed]