|
|
@ -20,7 +20,7 @@ uint16_t boost_frequency = 2000; // 2kHz frequency
|
|
|
|
uint16_t signalOutput_time = 200; // 200ms
|
|
|
|
uint16_t signalOutput_time = 200; // 200ms
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t boost_highVoltage_nextHigh = 1;
|
|
|
|
uint8_t boost_highVoltage_nextHigh = 1;
|
|
|
|
uint16_t boost_highVoltage_nextTick = 0;
|
|
|
|
uint16_t boost_highVoltage_nextTick = 1;
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t signalOutput_nextHigh = 1;
|
|
|
|
uint8_t signalOutput_nextHigh = 1;
|
|
|
|
uint16_t signalOutput_nextTick = 0;
|
|
|
|
uint16_t signalOutput_nextTick = 0;
|
|
|
@ -42,6 +42,7 @@ int main()
|
|
|
|
DDRD |= (1 << PORTD4);
|
|
|
|
DDRD |= (1 << PORTD4);
|
|
|
|
DDRD |= (1 << PORTD5);
|
|
|
|
DDRD |= (1 << PORTD5);
|
|
|
|
DDRD |= (1 << PORTD6);
|
|
|
|
DDRD |= (1 << PORTD6);
|
|
|
|
|
|
|
|
DDRB |= (1 << PORTB5); // Onboard-Led
|
|
|
|
|
|
|
|
|
|
|
|
// Interrupt for INT0 Pin-D2 High-voltage check
|
|
|
|
// Interrupt for INT0 Pin-D2 High-voltage check
|
|
|
|
EICRA |= (0 << ISC01)|(1 << ISC00); // On at any edge [Code: 01]
|
|
|
|
EICRA |= (0 << ISC01)|(1 << ISC00); // On at any edge [Code: 01]
|
|
|
@ -159,12 +160,16 @@ ISR(INT0_vect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Below ~400V, activate booster
|
|
|
|
// Below ~400V, activate booster
|
|
|
|
boost_highVoltage_nextTick = 1; // Run as soon as possible
|
|
|
|
boost_highVoltage_nextTick = 1; // Run as soon as possible
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PORTB |= (1 << PORTB5); // Onboard-Led
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // Rising edge
|
|
|
|
else // Rising edge
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reached ~400V, deactivate booster
|
|
|
|
// Reached ~400V, deactivate booster
|
|
|
|
boost_highVoltage_nextTick = 0;
|
|
|
|
boost_highVoltage_nextTick = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PORTB |= (0 << PORTB5); // Onboard-Led
|
|
|
|
|
|
|
|
|
|
|
|
// reset state
|
|
|
|
// reset state
|
|
|
|
PORTD |= (0 << PORTD4); // pin on low
|
|
|
|
PORTD |= (0 << PORTD4); // pin on low
|
|
|
|
boost_highVoltage_nextHigh = 1; // next is high
|
|
|
|
boost_highVoltage_nextHigh = 1; // next is high
|
|
|
|