fg004_a1/TriacOut.c

65 lines
1.1 KiB
C
Raw Normal View History

/*
* Author: username
* Date: todays_date
* filename: TriacOut.c
* description: module_purpose
*/
#ifndef __AVR_ATtiny404__
#define __AVR_ATtiny404__
#endif
#include <avr/io.h>
#include "TriacOut.h"
#include "RegEdit.h"
#define G1 1
#define G2 3
#define G3 2
#define G1_BM (1<<1)
#define G2_BM (1<<3)
#define G3_BM (1<<2)
void Delay_MicroSeconds_impl(double us){
return;
}
//Delay_MicroSeconds =
//void (*Delay_MicroSeconds)(double us) = Delay_MicroSeconds_impl;
void (*Delay_MicroSecnds)(double us) = Delay_MicroSeconds_impl;
void TriacOut_InitTimerA(void)
{
}
void TriacOut_SetupPins(void)
{
RegEdit_SetBit((void *) &PORTA.DIR, G1);
RegEdit_SetBit((void *) &PORTB.DIR, G2);
RegEdit_SetBit((void *) &PORTB.DIR, G3);
}
void TriacOut_SetAllHigh(void)
{
RegEdit_SetBit((void *) &PORTA.OUT, G1);
RegEdit_SetBit((void *) &PORTB.OUT, G2);
RegEdit_SetBit((void *) &PORTB.OUT, G3);
}
void TriacOut_PulsePins(uint16_t pulse_time)
{
Delay_MicroSeconds(pulse_time);
RegEdit_ClearBit((void *) &PORTA.OUT, G1);
RegEdit_ClearBit((void *) &PORTB.OUT, G2);
RegEdit_ClearBit((void *) &PORTB.OUT, G3);
}