X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=drv%2Fthermo.c;h=fb8cbb7958ccda1bedc1a59444bcd58534118b18;hb=1ab5fa0763879ab997884c8bc88631b69205a191;hp=811ee25f6282ee33945ad2969fe64d5fa9764833;hpb=0c2f7108e2f9b6fa567bc83dda9a313fffceb286;p=bertos.git diff --git a/drv/thermo.c b/drv/thermo.c old mode 100755 new mode 100644 index 811ee25f..fb8cbb79 --- a/drv/thermo.c +++ b/drv/thermo.c @@ -1,8 +1,33 @@ -/*! +/** * \file * * * \brief Thermo-control driver @@ -15,6 +40,12 @@ /*#* *#* $Log$ + *#* Revision 1.3 2006/09/20 20:12:41 marco + *#* Names convention, MOD_* macros. + *#* + *#* Revision 1.2 2006/07/19 12:56:26 bernie + *#* Convert to new Doxygen style. + *#* *#* Revision 1.1 2005/11/04 17:59:47 bernie *#* Import into DevLib. *#* @@ -30,13 +61,13 @@ #include -/*! Interval at which thermo control is performed. */ +/** Interval at which thermo control is performed. */ #define THERMO_INTERVAL_MS 100 -/*! Number of different samples we interpolate over to get the hifi temperature. */ +/** Number of different samples we interpolate over to get the hifi temperature. */ #define THERMO_HIFI_NUM_SAMPLES 10 -/*! Timer for thermo-regulation. */ +/** Timer for thermo-regulation. */ static Timer thermo_timer; typedef struct ThermoControlDev @@ -48,11 +79,11 @@ typedef struct ThermoControlDev ticks_t expire; } ThermoControlDev; -/*! Array of thermo-devices. */ +/** Array of thermo-devices. */ ThermoControlDev devs[THERMO_CNT]; -/*! +/** * Return the status of the specific \a dev thermo-device. */ thermostatus_t thermo_status(ThermoDev dev) @@ -61,7 +92,7 @@ thermostatus_t thermo_status(ThermoDev dev) } -/*! +/** * Do a single thermo control for device \a dev. */ static void thermo_do(ThermoDev index) @@ -77,7 +108,7 @@ static void thermo_do(ThermoDev index) if (++dev->cur_hifi_sample == THERMO_HIFI_NUM_SAMPLES) dev->cur_hifi_sample = 0; - cur_temp = thermo_read_temperature(index); + cur_temp = thermo_readTemperature(index); if (cur_temp == NTC_SHORT_CIRCUIT || cur_temp == NTC_OPEN_CIRCUIT) { @@ -136,7 +167,7 @@ static void thermo_do(ThermoDev index) } -/*! +/** * Thermo soft interrupt. */ static void thermo_softint(void) @@ -150,7 +181,7 @@ static void thermo_softint(void) } -/*! +/** * Set the target temperature \a temperature for a specific \a dev thermo-device. */ void thermo_setTarget(ThermoDev dev, deg_t temperature) @@ -162,7 +193,7 @@ void thermo_setTarget(ThermoDev dev, deg_t temperature) kprintf("setTarget dev[%d], T[%d.%d]\n", dev, temperature / 10, temperature % 10); } -/*! +/** * Starts a thermo-regulation for channel \a dev. */ void thermo_start(ThermoDev dev) @@ -184,7 +215,7 @@ void thermo_start(ThermoDev dev) devs[dev].expire = timer_clock() + thermo_hw_timeout(dev); } -/*! +/** * Stops a thermo-regulation for channel \a dev. */ void thermo_stop(ThermoDev dev) @@ -196,7 +227,7 @@ void thermo_stop(ThermoDev dev) } -/*! +/** * Clear errors for channel \a dev. */ void thermo_clearErrors(ThermoDev dev) @@ -206,22 +237,25 @@ void thermo_clearErrors(ThermoDev dev) } -/*! +/** * Read the temperature of the thermo-device \a dev using mobile mean. */ -deg_t thermo_read_temperature(ThermoDev dev) +deg_t thermo_readTemperature(ThermoDev dev) { int i; long accum = 0; + MOD_CHECK(thermo); + for (i = 0; i < THERMO_HIFI_NUM_SAMPLES; i++) accum += devs[dev].hifi_samples[i]; return (deg_t)(accum / THERMO_HIFI_NUM_SAMPLES); } +MOD_DEFINE(thermo) -/*! +/** * Init thermo-control and associated hw. */ void thermo_init(void) @@ -232,6 +266,8 @@ void thermo_init(void) for (int i = 0; i < THERMO_CNT; i++) devs[i].status = THERMO_OFF; + MOD_INIT(thermo); + timer_setDelay(&thermo_timer, ms_to_ticks(THERMO_INTERVAL_MS)); timer_set_event_softint(&thermo_timer, (Hook)thermo_softint, 0); timer_add(&thermo_timer);