projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct exception for toolchains that don't have the right attributes
[bertos.git]
/
bertos
/
drv
/
thermo.c
diff --git
a/bertos/drv/thermo.c
b/bertos/drv/thermo.c
index db395210f449d1c184f3ef48e9754bdfba51db02..37a1a02a2977bccea5fe5f9537d18819d590404e 100644
(file)
--- a/
bertos/drv/thermo.c
+++ b/
bertos/drv/thermo.c
@@
-41,6
+41,8
@@
#include "hw/thermo_map.h"
#include "hw/hw_thermo.h"
#include "hw/thermo_map.h"
#include "hw/hw_thermo.h"
+#include "cfg/cfg_thermo.h"
+
#include <cfg/module.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <cfg/module.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
@@
-51,18
+53,13
@@
-/** Interval at which thermo control is performed. */
-#define THERMO_INTERVAL_MS 100
-
-/** Number of different samples we interpolate over to get the hifi temperature. */
-#define THERMO_HIFI_NUM_SAMPLES 10
/** Timer for thermo-regulation. */
static Timer thermo_timer;
typedef struct ThermoControlDev
{
/** Timer for thermo-regulation. */
static Timer thermo_timer;
typedef struct ThermoControlDev
{
- deg_t hifi_samples[THERMO_HIFI_NUM_SAMPLES];
+ deg_t hifi_samples[
CONFIG_
THERMO_HIFI_NUM_SAMPLES];
deg_t cur_hifi_sample;
deg_t target;
thermostatus_t status;
deg_t cur_hifi_sample;
deg_t target;
thermostatus_t status;
@@
-95,7
+92,7
@@
static void thermo_do(ThermoDev index)
// Store the sample into the hifi FIFO buffer for later interpolation
dev->hifi_samples[dev->cur_hifi_sample] = cur_temp;
// Store the sample into the hifi FIFO buffer for later interpolation
dev->hifi_samples[dev->cur_hifi_sample] = cur_temp;
- if (++dev->cur_hifi_sample == THERMO_HIFI_NUM_SAMPLES)
+ if (++dev->cur_hifi_sample ==
CONFIG_
THERMO_HIFI_NUM_SAMPLES)
dev->cur_hifi_sample = 0;
cur_temp = thermo_readTemperature(index);
dev->cur_hifi_sample = 0;
cur_temp = thermo_readTemperature(index);
@@
-197,7
+194,7
@@
void thermo_start(ThermoDev dev)
/* Initialize the hifi FIFO with a constant value (the current temperature) */
temp = thermo_hw_read(dev);
/* Initialize the hifi FIFO with a constant value (the current temperature) */
temp = thermo_hw_read(dev);
- for (i = 0; i < THERMO_HIFI_NUM_SAMPLES; ++i)
+ for (i = 0; i <
CONFIG_
THERMO_HIFI_NUM_SAMPLES; ++i)
devs[dev].hifi_samples[i] = temp;
devs[dev].cur_hifi_sample = 0;
devs[dev].hifi_samples[i] = temp;
devs[dev].cur_hifi_sample = 0;
@@
-237,10
+234,10
@@
deg_t thermo_readTemperature(ThermoDev dev)
MOD_CHECK(thermo);
MOD_CHECK(thermo);
- for (i = 0; i < THERMO_HIFI_NUM_SAMPLES; i++)
+ for (i = 0; i <
CONFIG_
THERMO_HIFI_NUM_SAMPLES; i++)
accum += devs[dev].hifi_samples[i];
accum += devs[dev].hifi_samples[i];
- return (deg_t)(accum / THERMO_HIFI_NUM_SAMPLES);
+ return (deg_t)(accum /
CONFIG_
THERMO_HIFI_NUM_SAMPLES);
}
MOD_DEFINE(thermo)
}
MOD_DEFINE(thermo)
@@
-258,7
+255,7
@@
void thermo_init(void)
MOD_INIT(thermo);
MOD_INIT(thermo);
- timer_setDelay(&thermo_timer, ms_to_ticks(THERMO_INTERVAL_MS));
+ timer_setDelay(&thermo_timer, ms_to_ticks(
CONFIG_
THERMO_INTERVAL_MS));
timer_setSoftint(&thermo_timer, (Hook)thermo_softint, 0);
timer_add(&thermo_timer);
}
timer_setSoftint(&thermo_timer, (Hook)thermo_softint, 0);
timer_add(&thermo_timer);
}