BeRTOS
Functions | Variables
phase.c File Reference

Phase control driver (implementation) More...

#include "hw/hw_phase.h"
#include <cfg/macros.h>
#include <cfg/compiler.h>
#include <cpu/irq.h>
#include <cpu/types.h>
#include <drv/timer.h>
#include <drv/phase.h>
#include <math.h>

Go to the source code of this file.

Functions

 DEFINE_ZEROCROSS_ISR ()
 Zerocross interrupt, call when 220V cross zero.
void phase_setDuty (TriacDev dev, triac_duty_t duty)
 Set duty of the triac channel dev (interrupt safe).
void phase_setDutyUnlock (TriacDev dev, triac_duty_t duty)
 Set duty of the triac channel dev (NOT INTERRUPT SAFE).
void phase_setPower (TriacDev dev, triac_power_t power)
 Set power of the triac channel dev (interrupt safe).
static void phase_softint (void *_dev)
 Soft int for each _dev triac.
void phase_init (void)
 Initialize phase control driver.

Variables

static Triac triacs [TRIAC_CNT]
 Array of triacs.

Detailed Description

Phase control driver (implementation)

Author:
Francesco Sacchi <batt@develer.com>

Definition in file phase.c.


Function Documentation

DEFINE_ZEROCROSS_ISR ( )

Zerocross interrupt, call when 220V cross zero.

This function turn off all triacs that have duty < 100% and arm the triac timers for phase control. This function is frequency adaptive so can work both at 50 or 60Hz.

Definition at line 64 of file phase.c.

void phase_setPower ( TriacDev  dev,
triac_power_t  power 
)

Set power of the triac channel dev (interrupt safe).

This function approsimate the sine wave to a triangular wave to compute RMS power.

Definition at line 128 of file phase.c.

static void phase_softint ( void *  _dev) [static]

Soft int for each _dev triac.

The triacs are turned on at different time to achieve phase control.

Definition at line 155 of file phase.c.