updated with code from the high branch
This commit is contained in:
parent
0676abc259
commit
8e3978a089
28
src/main.c
28
src/main.c
|
@ -11,12 +11,6 @@
|
||||||
|
|
||||||
#define F_CPU 3333333UL
|
#define F_CPU 3333333UL
|
||||||
|
|
||||||
//These defines are mostly useful for when you want you editors LSP server to
|
|
||||||
//function correctly.
|
|
||||||
//#ifndef __AVR_ATtiny404__
|
|
||||||
//#define __AVR_ATtiny404__
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//This can prevent issues with utils/delay.h library with the gcc toolchain
|
//This can prevent issues with utils/delay.h library with the gcc toolchain
|
||||||
#define __DELAY_BACKWARD_COMPATIBLE__
|
#define __DELAY_BACKWARD_COMPATIBLE__
|
||||||
|
|
||||||
|
@ -35,6 +29,16 @@
|
||||||
//Set the function pointer for the delay func
|
//Set the function pointer for the delay func
|
||||||
void (*Delay_MicroSeconds)(double us) = _delay_us;
|
void (*Delay_MicroSeconds)(double us) = _delay_us;
|
||||||
|
|
||||||
|
static void setEnablePinsHigh(void)
|
||||||
|
{
|
||||||
|
//Pins 12, 6 and 7 are all set high.
|
||||||
|
PORTA.DIR |= (1<<2); //PA2= pin 12
|
||||||
|
PORTB.DIR |= (1<<2)|(1<<3); //PB2 = pin 7, PB3 = pin 6
|
||||||
|
|
||||||
|
PORTA.OUT |= (1<<2);
|
||||||
|
PORTB.OUT |= (1<<2)|(1<<3);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
while(true){
|
while(true){
|
||||||
|
@ -42,20 +46,14 @@ int main(int argc, char **argv)
|
||||||
ZCD_Poll();
|
ZCD_Poll();
|
||||||
_delay_us(Tau);
|
_delay_us(Tau);
|
||||||
TriacOut_SetupPins();
|
TriacOut_SetupPins();
|
||||||
TriacOut_SetAllHigh();
|
TriacOut_SetAllHigh(); //Only G1 exists in High power mode
|
||||||
TriacOut_PulsePins(GatePulses[i]);
|
TriacOut_PulsePins(GatePulses[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//The G1-G3 pins are low at this point.
|
//The G1 pin is low at this point.
|
||||||
_delay_ms(2500);
|
_delay_ms(2500);
|
||||||
ZCD_Poll();
|
ZCD_Poll();
|
||||||
TriacOut_SetupPins();
|
//setEnablePinsHigh();
|
||||||
TriacOut_SetAllHigh();
|
|
||||||
|
|
||||||
Load_HandleLoadPortA(ADC_LOAD1, 1);
|
|
||||||
Load_HandleLoadPortB(ADC_LOAD2, 3);
|
|
||||||
Load_HandleLoadPortB(ADC_LOAD3, 2);
|
|
||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
; //Do nothing until new Power cycle/reset occurs
|
; //Do nothing until new Power cycle/reset occurs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue