projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add reg definition for adc driver.
[bertos.git]
/
bertos
/
drv
/
phase.c
diff --git
a/bertos/drv/phase.c
b/bertos/drv/phase.c
index 39eadf470cda0bd456595a95863173ce6ece4d49..275b133db80f27328782bb5be6405bd672d84566 100644
(file)
--- a/
bertos/drv/phase.c
+++ b/
bertos/drv/phase.c
@@
-31,13
+31,12
@@
*
* \brief Phase control driver (implementation)
*
*
* \brief Phase control driver (implementation)
*
- * \version $Id$
*
* \author Francesco Sacchi <batt@develer.com>
*/
*
* \author Francesco Sacchi <batt@develer.com>
*/
-#include
<hw/hw_phase.h>
+#include
"hw/hw_phase.h"
#include <cfg/macros.h>
#include <cfg/compiler.h>
#include <cfg/macros.h>
#include <cfg/compiler.h>
@@
-50,8
+49,6
@@
#include <math.h>
#include <math.h>
-#warning FIXME:Generalize this moduele for all target supported.
-
/** Array of triacs */
static Triac triacs[TRIAC_CNT];
/** Array of triacs */
static Triac triacs[TRIAC_CNT];
@@
-76,10
+73,10
@@
DEFINE_ZEROCROSS_ISR()
for (dev = 0; dev < TRIAC_CNT; dev++)
{
/* Only turn off triac if duty is != 100% */
for (dev = 0; dev < TRIAC_CNT; dev++)
{
/* Only turn off triac if duty is != 100% */
- if (triacs[dev].duty != TRIAC_MAX_DUTY)
+ if (triacs[dev].duty !=
CONFIG_
TRIAC_MAX_DUTY)
TRIAC_OFF(dev);
/* Compute delay from duty */
TRIAC_OFF(dev);
/* Compute delay from duty */
- timer_setDelay(&triacs[dev].timer, DIV_ROUND(period * (
TRIAC_MAX_DUTY - triacs[dev].duty),
TRIAC_MAX_DUTY));
+ timer_setDelay(&triacs[dev].timer, DIV_ROUND(period * (
CONFIG_TRIAC_MAX_DUTY - triacs[dev].duty), CONFIG_
TRIAC_MAX_DUTY));
/* This check avoids inserting the same timer twice
* in case of an intempestive zerocross or spike */
/* This check avoids inserting the same timer twice
* in case of an intempestive zerocross or spike */
@@
-102,7
+99,7
@@
DEFINE_ZEROCROSS_ISR()
*/
void phase_setDuty(TriacDev dev, triac_duty_t duty)
{
*/
void phase_setDuty(TriacDev dev, triac_duty_t duty)
{
- cpuflags_t flags;
+ cpu
_
flags_t flags;
IRQ_SAVE_DISABLE(flags);
phase_setDutyUnlock(dev,duty);
IRQ_SAVE_DISABLE(flags);
phase_setDutyUnlock(dev,duty);
@@
-117,7
+114,7
@@
void phase_setDuty(TriacDev dev, triac_duty_t duty)
*/
void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty)
{
*/
void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty)
{
- triacs[dev].duty = MIN(duty, (triac_duty_t)TRIAC_MAX_DUTY);
+ triacs[dev].duty = MIN(duty, (triac_duty_t)
CONFIG_
TRIAC_MAX_DUTY);
}
}
@@
-133,18
+130,18
@@
void phase_setPower(TriacDev dev, triac_power_t power)
bool greater_fifty = false;
triac_duty_t duty;
bool greater_fifty = false;
triac_duty_t duty;
- power = MIN(power, (triac_power_t)TRIAC_MAX_POWER);
+ power = MIN(power, (triac_power_t)
CONFIG_
TRIAC_MAX_POWER);
- if (power > TRIAC_MAX_POWER / 2)
+ if (power >
CONFIG_
TRIAC_MAX_POWER / 2)
{
greater_fifty = true;
{
greater_fifty = true;
- power = TRIAC_MAX_POWER - power;
+ power =
CONFIG_
TRIAC_MAX_POWER - power;
}
duty = TRIAC_POWER_K * sqrt(power);
if (greater_fifty)
}
duty = TRIAC_POWER_K * sqrt(power);
if (greater_fifty)
- duty = TRIAC_MAX_DUTY - duty;
+ duty =
CONFIG_
TRIAC_MAX_DUTY - duty;
phase_setDuty(dev, duty);
}
phase_setDuty(dev, duty);
}
@@
-172,7
+169,7
@@
static void phase_softint(void *_dev)
*/
void phase_init(void)
{
*/
void phase_init(void)
{
- cpuflags_t flags;
+ cpu
_
flags_t flags;
TriacDev dev;
/* Init timers and ensure that all triac are off */
TriacDev dev;
/* Init timers and ensure that all triac are off */
@@
-182,7
+179,7
@@
void phase_init(void)
triacs[dev].running = false;
SET_TRIAC_DDR(dev);
TRIAC_OFF(dev);
triacs[dev].running = false;
SET_TRIAC_DDR(dev);
TRIAC_OFF(dev);
- timer_set
_event_s
oftint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev);
+ timer_set
S
oftint(&triacs[dev].timer, (Hook)phase_softint, (void *)dev);
}
IRQ_SAVE_DISABLE(flags);
}
IRQ_SAVE_DISABLE(flags);
@@
-191,3
+188,4
@@
void phase_init(void)
DB(phase_initialized = true;)
IRQ_RESTORE(flags);
}
DB(phase_initialized = true;)
IRQ_RESTORE(flags);
}
+