* \author Francesco Sacchi <batt@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.2 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.1 2006/02/10 12:31:03 bernie
- *#* Add templates for hw definitions.
- *#*
- *#*/
-
#ifndef HW_BUZZER_H
#define HW_BUZZER_H
-#define BUZZER_BIT BV(1)
-#define IS_BUZZER_ON 0
-#define BUZZER_HW_INIT do { } while (0)
-#define BUZZER_ON do { } while (0)
-#define BUZZER_OFF do { } while (0)
+#warning TODO:This is example implemetantion, you must implement it!
+
+#define BUZZER_BIT 1
+#define IS_BUZZER_ON 0
+#define BUZZER_HW_INIT do { /* Implement me! */ } while (0)
+#define BUZZER_ON do { /* Implement me! */ } while (0)
+#define BUZZER_OFF do { /* Implement me! */ } while (0)
#endif /* HW_BUZZER_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Buzzerled hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+
+#ifndef HW_BUZZERLED_H
+#define HW_BUZZERLED_H
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+
+#endif /* HW_BUZZERLED_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Bernardo Innocenti <bernie@develer.com>
+ */
+
+#ifndef HW_CPU_H
+#define HW_CPU_H
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+/// CPU Clock frequency
+#define CLOCK_FREQ (10000000UL /* Implement me! */)
+
+
+/* Timer IRQ strobe */
+//#if CONFIG_TIMER_STROBE
+// #define TIMER_STROBE_ON /* Implement me! */
+// #define TIMER_STROBE_OFF /* Implement me! */
+// #define TIMER_STROBE_INIT /* Implement me! */
+//#endif /* CONFIG_TIMER_STROBE */
+
+#endif /* HW_CPU_H */
/**
* \file
* <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
* All Rights Reserved.
* -->
#include <cfg/module.h>
#include <cfg/macros.h>
-#include <io/arm.h>
-
+#warning TODO:This is example implemetantion, you must implement it!
MOD_DEFINE(hw_dataflash);
*/
void dataflash_hw_init(void)
{
- #warning The data flash init pins function is not implemented!
//Disable CS line (remove if not needed)
dataflash_hw_setCS(false);
*/
void dataflash_hw_setCS(bool enable)
{
- #warning The data flash setCS function is not implemented!
if (enable)
{
/*
*/
void dataflash_hw_setReset(bool enable)
{
- #warning The data flash setReset function is not implemented!
if (enable)
{
/*
/**
* \file
* <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
* All Rights Reserved.
* -->
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief DC motor hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef HW_DC_MOTOR_H
+#define HW_DC_MOTOR_H
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+//DC motor 0
+#define DC_MOTOR0_EN_PIN /* Implement me! */
+#define DC_MOTOR0_DIR_PIN /* Implement me! */
+#define DC_MOTOR0_CLEAR /* Implement me! */
+#define DC_MOTOR0_SET /* Implement me! */
+
+/* Add other motor here */
+
+
+#define DC_MOTOR_PIN_INIT_MACRO(port, index) \
+ do { \
+ /* put here code to init pins */ \
+ } while (0)
+
+
+#define DC_MOTOR_SET_ENABLE(index) do { /* Implement me! */ } while (0)
+#define DC_MOTOR_SET_DISABLE(index) do { /* Implement me! */ } while (0)
+#define DC_MOTOR_DIR_CW_MACRO(index) do { /* Implement me! */ } while (0)
+#define DC_MOTOR_DIR_CCW_MACRO(index) do { /* Implement me! */ } while (0)
+
+
+#define DC_MOTOR_ENABLE(index) \
+ do { \
+ switch (index) \
+ { \
+ case 0:\
+ DC_MOTOR_SET_ENABLE(0); \
+ break; \
+ /* Add other motor here */ \
+ } \
+ } while(0)
+
+#define DC_MOTOR_DISABLE(index) \
+ do { \
+ switch (index) \
+ { \
+ case 0:\
+ DC_MOTOR_SET_DISABLE(0); \
+ break; \
+ /* Add other motor here */ \
+ } \
+ } while(0)
+
+
+#define DC_MOTOR_DIR_CW(index) \
+ do { \
+ switch (index) \
+ { \
+ case 0:\
+ DC_MOTOR_DIR_CW_MACRO(0); \
+ break; \
+ /* Add other motor here */ \
+ } \
+ } while(0)
+
+ #define DC_MOTOR_DIR_CCW(index) \
+ do { \
+ switch (index) \
+ { \
+ case 0:\
+ DC_MOTOR_DIR_CCW_MACRO(0); \
+ break; \
+ /* Add other motor here */ \
+ } \
+ } while(0)
+
+
+
+#define DC_MOTOR_SET_DIR(index, dir) \
+ do { \
+ if (dir) \
+ DC_MOTOR_DIR_CW(index); \
+ else \
+ DC_MOTOR_DIR_CCW(index); \
+ } while (0)
+
+#define DC_MOTOR_INIT(index) \
+ do { \
+ switch (index) \
+ { \
+ case 0: \
+ DC_MOTOR_PIN_INIT_MACRO(A, 0); \
+ break; \
+ case 1: \
+ DC_MOTOR_PIN_INIT_MACRO(A, 1); \
+ break; \
+ } \
+ } while (0)
+
+#endif /* HW_DC_MOTOR_H */
* \author Stefano Fedrigo <a@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.4 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.3 2006/03/22 09:51:27 bernie
- *#* Wrap C++ stuff.
- *#*
- *#* Revision 1.2 2006/02/15 09:13:42 bernie
- *#* Add keyboard emulator.
- *#*
- *#* Revision 1.1 2006/02/10 12:31:03 bernie
- *#* Add templates for hw definitions.
- *#*
- *#*/
-
#ifndef HW_KBD_H
#define HW_KBD_H
#include "kbd_map.h"
+
#include <cfg/macros.h>
+#warning TODO:This is example implemetantion, you must implement it!
+
#define K_RPT_MASK (K_UP | K_DOWN | K_OK | K_CANCEL)
#define KBD_HW_INIT \
do { \
+ /* Put here code to init hw */ \
} while (0)
EXTERN_C int emul_kbdReadCols(void);
*
* -->
*
+ * \brief LCD low-level hardware macros
+ *
* \version $Id$
*
* \author Bernardo Innocenti <bernie@develer.com>
* \author Stefano Fedrigo <aleph@develer.com>
*
- * \brief LCD low-level hardware macros
*/
#ifndef HW_LCD_H
#define HW_LCD_H
#include <appconfig.h>
-//#include <hw.h>
+
+#include <cfg/macros.h> /* BV() */
+#include <cfg/debug.h>
#include <cpu/attr.h>
#include <cpu/irq.h>
#include <cpu/types.h>
-#include <cfg/macros.h> /* BV() */
-#include <cfg/debug.h>
-
-#include <avr/io.h>
-#include <stdbool.h>
-#include <inttypes.h>
+#warning TODO: This is example implementation, you must implement it!
/**
* \name LCD I/O pins/ports
* @{
*/
-#define LCD_RS BV(PG3)
-#define LCD_RW BV(PG0)
-#define LCD_E BV(PG2)
-#define LCD_DB0 BV(PA0)
-#define LCD_DB1 BV(PA1)
-#define LCD_DB2 BV(PA2)
-#define LCD_DB3 BV(PA3)
-#define LCD_DB4 BV(PA4)
-#define LCD_DB5 BV(PA5)
-#define LCD_DB6 BV(PA6)
-#define LCD_DB7 BV(PA7)
+#define LCD_RS /* Implement me! */
+#define LCD_RW /* Implement me! */
+#define LCD_E /* Implement me! */
+#define LCD_DB0 /* Implement me! */
+#define LCD_DB1 /* Implement me! */
+#define LCD_DB2 /* Implement me! */
+#define LCD_DB3 /* Implement me! */
+#define LCD_DB4 /* Implement me! */
+#define LCD_DB5 /* Implement me! */
+#define LCD_DB6 /* Implement me! */
+#define LCD_DB7 /* Implement me! */
/*@}*/
/**
* \name DB high nibble (DB[4-7])
* @{
*/
-#define LCD_PORT PORTG
-#define LCD_DB_PORT PORTA
-#define LCD_PIN PING
-#define LCD_DB_PIN PINA
-#define LCD_DDR DDRG
-#define LCD_DB_DDR DDRA
#if CONFIG_LCD_4BIT
#define LCD_MASK (LCD_DB7 | LCD_DB6 | LCD_DB5 | LCD_DB4)
* \name LCD bus control macros
* @{
*/
-#define LCD_CLR_RS (LCD_PORT &= ~LCD_RS)
-#define LCD_SET_RS (LCD_PORT |= LCD_RS)
-#define LCD_CLR_RD (LCD_PORT &= ~LCD_RW)
-#define LCD_SET_RD (LCD_PORT |= LCD_RW)
-#define LCD_CLR_E (LCD_PORT &= ~LCD_E)
-#define LCD_SET_E (LCD_PORT |= LCD_E)
+#define LCD_CLR_RS /* Implement me! */
+#define LCD_SET_RS /* Implement me! */
+#define LCD_CLR_RD /* Implement me! */
+#define LCD_SET_RD /* Implement me! */
+#define LCD_CLR_E /* Implement me! */
+#define LCD_SET_E /* Implement me! */
#if CONFIG_LCD_4BIT
- #define LCD_WRITE_H(x) (LCD_DB_PORT = (LCD_DB_PORT & ~LCD_MASK) | (((x) >> (4 - LCD_SHIFT)) & LCD_MASK))
- #define LCD_WRITE_L(x) (LCD_DB_PORT = (LCD_DB_PORT & ~LCD_MASK) | (((x) << LCD_SHIFT) & LCD_MASK))
- #define LCD_READ_H ((LCD_DB_PIN & LCD_MASK) >> (4 - LCD_SHIFT))
- #define LCD_READ_L ((LCD_DB_PIN & LCD_MASK) >> LCD_SHIFT)
+ #define LCD_WRITE_H(x) /* Implement me! */
+ #define LCD_WRITE_L(x) /* Implement me! */
+ #define LCD_READ_H /* Implement me! */
+ #define LCD_READ_L /* Implement me! */
#else
- #define LCD_WRITE(x) (LCD_DB_PORT = (x))
- #define LCD_READ (LCD_DB_PIN)
+ #define LCD_WRITE(x) /* Implement me! */
+ #define LCD_READ /* Implement me! */
#endif
/*@}*/
/** Set data bus direction to output (write to display) */
-#define LCD_DB_OUT (LCD_DB_DDR |= LCD_MASK)
+#define LCD_DB_OUT /* Implement me! */
/** Set data bus direction to input (read from display) */
-#define LCD_DB_IN (LCD_DB_DDR &= ~LCD_MASK)
+#define LCD_DB_IN /* Implement me! */
/** Delay for write (Enable pulse width, 220ns) */
#define LCD_DELAY_WRITE \
cpuflags_t flags;
IRQ_SAVE_DISABLE(flags);
- LCD_PORT = (LCD_PORT & ~(LCD_E | LCD_RW)) | LCD_RS;
- LCD_DDR |= LCD_RS | LCD_RW | LCD_E;
+ /*
+ * Here set bus pin!
+ * to init a lcd device.
+ *
+ */
/*
* Data bus is in output state most of the time:
* Copyright 2006 Develer S.r.l. (http://www.develer.com/)
* -->
*
- * \version $Id$
- *
* \brief MCP41 hardware-specific definitions
*
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*/
-#include <hw_mcp41.h>
+#include "hw_mcp41.h"
#include <cfg/macros.h>
#include <cfg/compiler.h>
-#include <avr/io.h>
+#warning TODO: This is example implementation, you must implement it!
+const uint16_t mcp41_ports[MCP41_CNT] =
+{
+ 0, /* add here mcp41 ports */
+};
+const uint8_t mcp41_pins [MCP41_CNT] =
+{
+ 0, /* add here mcp41 ports */
+};
-const uint16_t mcp41_ports[MCP41_CNT] = {
- _SFR_IO_ADDR(PORTB), /** Led pot */
- _SFR_IO_ADDR(PORTB), /** Photometer pot */
- };
-const uint8_t mcp41_pins [MCP41_CNT] = {
- BV(PB7),
- BV(PB6),
- };
* Copyright 2005 Develer S.r.l. (http://www.develer.com/)
* -->
*
- * \version $Id$
- *
* \brief MCP41 hardware-specific definitions
*
* \version $Id$
#ifndef HW_MCP41_H
#define HW_MCP41_H
-#include <mcp41_map.h>
+#include "mcp41_map.h"
+
#include <cfg/compiler.h>
-#include <cpu/irq.h>
-#include <avr/io.h>
-extern const uint16_t mcp41_ports[MCP41_CNT];
-extern const uint8_t mcp41_pins[MCP41_CNT];
-/**
- * Set MCP41 port associated with \a dev to output.
- */
+#warning TODO: This is example implementation, you must implement it!
+
+
INLINE void SET_MCP41_DDR(Mcp41Dev dev)
{
- /* DDR port is 1 address before PORT */
- ATOMIC(_SFR_IO8(mcp41_ports[dev] - 1) |= mcp41_pins[dev]);
+ /* Implement me! */
+ //Warning: this funtions is like avr target name,
+ //fix it to comply for all target.
}
INLINE void MCP41_ON(Mcp41Dev i)
{
- ATOMIC(_SFR_IO8(mcp41_ports[i]) &= ~mcp41_pins[i]);
+ /* Implement me! */
}
INLINE void MCP41_OFF(Mcp41Dev i)
{
- ATOMIC(_SFR_IO8(mcp41_ports[i]) |= mcp41_pins[i]);
+ /* Implement me! */
}
-
#endif /* HW_MCP41_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief NTC hardware-specific definition
+ *
+ * \version $Id$
+ * \author Francesco Sacchi <batt@develer.com>
+ *
+ * A NTC acts as a variable resistor, whose resistance changes as a
+ * function of the temperature it measures. To sample it correctly, it is
+ * usually parallelized and serialized with two fixed resistor. The following diagram shows
+ * what is the exact disposition of the components, as handled by this
+ * library:
+ *
+ *<pre>
+ * o Vref
+ * |
+ * | o Vref
+ * | |
+ * ----- |
+ * | | ---------
+ * | Rser| | |
+ * | | | |
+ * ----- ----- | ADC |
+ * | Vp | | | |
+ * -----------|------| Amp |-------------| |
+ * | | | | Vadc | |
+ * ----- ----- ----- ---------
+ * | | | |
+ * | NTC | | Rpar|
+ * | | | |
+ * ----- -----
+ * | |
+ * | |
+ * ----- -----
+ * --- ---
+ *</pre>
+ * Amp is an amplifier that amplify of AMP times the signal.
+ * If we indicate Rp as the parallel of NTC with Rpar, ADCBITS as the bits of the ad converter
+ * and ADCVAL as the result from the adc convertion (Not Vadc but just the value read
+ * from the adc register), after various calculation, the expression of Rp is:
+ *
+ *<pre>
+ *
+ * ADCVAL * Rser
+ * Rp = ------------------------
+ * ADCBITS
+ * 2 * AMP - ADCVAL
+ *</pre>
+ *
+ * And after that NTC obvisiously is:
+ *<pre>
+ * Rpar * Rp
+ * NTC = ----------
+ * Rpar - Rp
+ *</pre>
+ *
+ *
+ * The function ntc_hw_read() compute the resistence using these formulas above.
+ */
+
+#ifndef HW_NTC_H
+#define HW_NTC_H
+
+#include "ntc_map.h"
+
+#include <cfg/debug.h>
+
+#include <drv/ntc.h>
+#include <drv/adc.h>
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+extern const res_t NTC_RSER[NTC_CNT];
+extern const res_t NTC_RPAR[NTC_CNT];
+extern const amp_t NTC_AMP[NTC_CNT];
+extern const NtcHwInfo* NTC_INFO[NTC_CNT];
+
+
+/*!
+ * Read the resistence of ntc device \a dev.
+ * Return the result in res_t type.
+ */
+INLINE res_t ntc_hw_read(NtcDev dev)
+{
+ ASSERT(dev < NTC_CNT);
+ // See above for formula explanation.
+ adcread_t adcval = adc_read((uint16_t)dev);
+ float rp = (adcval * NTC_RSER[dev] ) / ((1 << adc_bits()) * NTC_AMP[dev] - adcval);
+
+ //kprintf("Rp[%f], Rntc[%f]\n", rp/100, ((NTC_RPAR[dev] * rp) / (NTC_RPAR[dev] - rp)) / 100.0);
+
+ return ( (NTC_RPAR[dev] * rp) / (NTC_RPAR[dev] - rp) );
+}
+
+
+/*!
+ * Return the info (aka the table) associated with ntc device \a dev.
+ */
+INLINE const NtcHwInfo* ntc_hw_getInfo(NtcDev dev)
+{
+ return NTC_INFO[dev];
+}
+
+#define NTC_HW_INIT do { /* Implement me! */ } while(0)
+
+#endif /* HW_NTC_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Phase control hardware-specific definitions
+ *
+ * \version $Id$
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+
+#ifndef HW_PHASE_H
+#define HW_PHASE_H
+
+#include "hw_phase.h"
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+#endif /* HW_PHASE_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief Phase control hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+
+#ifndef HW_PHASE_H
+#define HW_PHASE_H
+
+#include "phase_map.h"
+
+#include <cfg/compiler.h>
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+#define PHASE_HW_INIT do { /* Implement me! */ }while (0)
+
+INLINE void TRIAC_OFF(TriacDev i)
+{
+ /* Implement me! */
+}
+
+
+INLINE void TRIAC_ON(TriacDev i)
+{
+ /* Implement me! */
+}
+
+
+#endif /* HW_PHASE_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Sensor hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef HW_SENSOR_H
+#define HW_SENSOR_H
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+#define NUM_HOME_SENSORS 1
+
+
+INLINE bool hw_home_sensor_read(int sensor)
+{
+ /* Implement me! */
+
+ return 0;
+}
+
+INLINE void hw_home_sensor_set_inverted(int sensor, bool inverted)
+{
+ /* Implement me! */
+}
+
+INLINE bool hw_level_sensor_read(int sensor)
+{
+ /* Implement me! */
+
+ return 0;
+}
+
+INLINE void hw_level_sensor_set_inverted(int sensor, bool inverted)
+{
+ /* Implement me! */
+}
+
+INLINE bool bld_hw_sensor_read(int sensor)
+{
+ /* Implement me! */
+
+ return 0;
+}
+
+#endif /* HW_SENSOR_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Serial hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+
+#ifndef HW_SER_H
+#define HW_SER_H
+
+#warning TODO:This is example implemetantion, you must implement it!
+
+
+#endif /* HW_SER_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * -->
+ *
+ * \brief Hardware macro definition.
+ *
+ *
+ * \version $Id$
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef HW_SPI_H
+#define HW_SPI_H
+
+#warning TODO:This is an example implentation, you must implement it!
+
+#include <cfg/macros.h>
+
+/**
+ * SPI pin definition.
+ *
+ * \note CS is assert when level
+ * is low.
+ *
+ * \{
+ */
+#define CS /* pin */ ///Connect to CS pin of Flash memory.
+#define SCK /* pin */ ///Connect to SCK pin of Flash memory.
+#define MOSI /* pin */ ///Connect to SI pin of Flash memory.
+#define MISO /* pin */ ///Connect to SO pin of Flash memory.
+#define SPI_PORT /* pin */ ///Micro pin PORT register.
+#define SPI_PIN /* pin */ ///Micro pin PIN register.
+#define SPI_DDR /* pin */ ///Micro pin DDR register.
+/*\}*/
+
+/**
+ * Pin logic level.
+ *
+ * \{
+ */
+#define MOSI_LOW() do { /* Implement me! */ } while(0)
+#define MOSI_HIGH() do { /* Implement me! */ } while(0)
+#define MISO_HIGH() do { /* Implement me! */ } while(0)
+#define SCK_LOW() do { /* Implement me! */ } while(0)
+#define SCK_HIGH() do { /* Implement me! */ } while(0)
+#define CS_LOW() do { /* Implement me! */ } while(0)
+#define CS_HIGH() do { /* Implement me! */ } while(0)
+/*\}*/
+
+/**
+ * SPI pin commands.
+ *
+ * \{
+ */
+#define CS_ENABLE() CS_LOW()
+#define CS_DISABLE() CS_HIGH()
+#define SS_ACTIVE() CS_LOW()
+#define SS_INACTIVE() CS_HIGH()
+#define SCK_INACTIVE() SCK_LOW()
+#define SCK_ACTIVE() SCK_HIGH()
+#define CS_OUT() do { /* Implement me! */ } while(0)
+#define MOSI_IN() do { /* Implement me! */ } while(0)
+#define MOSI_OUT() do { /* Implement me! */ } while(0)
+#define IS_MISO_HIGH() (false /* Implement me! */ )
+#define MISO_IN() do { /* Implement me! */ } while(0)
+#define MISO_OUT() do { /* Implement me! */ } while(0)
+#define SCK_OUT() do { /* Implement me! */ } while(0)
+
+#define SCK_PULSE()\
+ do {\
+ SCK_HIGH();\
+ SCK_LOW();\
+ } while (0)
+/*\}*/
+
+
+#define SPI_HW_INIT() \
+ CS_DISABLE();\
+ MOSI_LOW();\
+ SCK_LOW();\
+ MISO_IN();\
+ MOSI_OUT();\
+ SCK_OUT();\
+ CS_OUT();
+
+#endif /* HW_SPI_H */
+
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Stepper hardware-specific definitions
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+
+#ifndef HW_STEPPER_H
+#define HW_STEPPER_H
+
+#include "hw_cpu.h"
+
+#include <cfg/macros.h>
+
+#include <drv/timer.h>
+
+#warning TODO:This is an example implentation, you must implement it!
+
+#define STEPPER_STROBE_INIT \
+do { \
+ /* put init code for strobe */ \
+} while (0)
+
+
+#define STEPPER_STROBE_ON do { /* Implement me! */ } while(0)
+#define STEPPER_STROBE_OFF do { /* Implement me! */ } while(0)
+
+/**
+ * CPU clock frequency is divided by 2^STEPPER_PRESCALER_LOG2 to
+ * obtain stepper clock.
+ */
+#define STEPPER_PRESCALER_LOG2 1
+
+/**
+ * Stepper timer clock frequency.
+ */
+#define STEPPER_CLOCK ((CLOCK_FREQ) >> STEPPER_PRESCALER_LOG2)
+
+/**
+ * us delay to reset a stepper motor.
+ * This is the time neccessary to reset
+ * the stepper controll chip. (see datasheet for more detail).
+ */
+#define STEPPER_RESET_DELAY 1
+
+/*
+ * Pins define for each stepper
+ */
+#define STEPPER_1_CW_CCW_PIN 0
+#define STEPPER_1_HALF_FULL_PIN 0
+#define STEPPER_1_CONTROL_PIN 0
+#define STEPPER_1_ENABLE_PIN 0
+#define STEPPER_1_RESET_PIN 0
+
+/* put here other stepper motor */
+
+#define STEPPER_1_SET do { /* Implement me! */ } while(0)
+/* add here the set for other stepper motor */
+
+#define STEPPER_1_CLEAR do { /* Implement me! */ } while(0)
+/* add here the clear for other stepper motor */
+
+/*
+ * Generic macro definition
+ */
+
+/*
+ * Stepper init macro
+ */
+#define STEPPER_PIN_INIT_MACRO(port, index) do { \
+ /* Add here init pin code */ \
+ } while (0)
+
+/*
+ * Stepper commands macros
+ */
+#define STEPPER_SET_CW(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_CCW(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_HALF(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_FULL(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_CONTROL_LOW(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_CONTROL_HIGHT(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_ENABLE(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_DISABLE(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_RESET_ENABLE(index) do { /* Implement me! */ } while (0)
+#define STEPPER_SET_RESET_DISABLE(index) do { /* Implement me! */ } while (0)
+
+
+/*
+ * Reset stepper macro
+ */
+
+#define STEPPER_RESET_MACRO(index) do { \
+ STEPPER_SET_RESET_ENABLE(index); \
+ timer_udelay(STEPPER_RESET_DELAY); \
+ STEPPER_SET_RESET_DISABLE(index); \
+ } while (0)
+
+/*
+ * Set half or full step macro
+ */
+#define STEPPER_SET_STEP_MODE_MACRO(index, flag) do { \
+ if (flag) \
+ STEPPER_SET_HALF(index); \
+ else \
+ STEPPER_SET_FULL(index); \
+ } while (0)
+
+/*
+ * Set control status macro
+ */
+#warning This macro is not implemented (see below)
+
+#define STEPPER_SET_CONTROL_BIT_MACRO(index, flag) do { \
+ /* if (flag) */ \
+ /* WARNING This macros not implemented */ \
+ /* else */ \
+ /* WARNING This macros not implemented */ \
+ } while (0)
+
+/*
+ * Set current power macro
+ */
+#warning This macro is not implemented (see below)
+
+#define STEPPER_SET_POWER_CURRENT_MACRO(index, flag) do { \
+ /* if (flag) */ \
+ /* WARNING This macrois not implemented */ \
+ /* else */ \
+ /* WARNING This macrois not implemented */ \
+ } while (0)
+
+/*
+ * Set rotation of stepper motor
+ * - dir = 1: positive rotation
+ * - dir = 0: no motor moviment
+ * - dir = -1: negative rotation
+ *
+ */
+#define STEPPER_SET_DIRECTION_MACRO(index, dir) do { \
+ switch (dir) \
+ { \
+ case 1: \
+ STEPPER_SET_CW(index); \
+ break; \
+ case -1: \
+ STEPPER_SET_CCW(index); \
+ break; \
+ case 0: \
+ break; \
+ } \
+ } while (0)
+
+
+/*
+ * Define macros for manage low level of stepper.
+ */
+
+#define STEPPER_INIT() do { \
+ STEPPER_PIN_INIT_MACRO(A, 1); \
+ /* Add here code for other stepper motor */ \
+ } while (0)
+
+
+/*
+ * Enable select stepper motor
+ */
+#define STEPPER_ENABLE(index) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_ENABLE(1); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+/*
+ * Enable all stepper connect to micro
+ */
+#define STEPPER_ENABLE_ALL() do { \
+ STEPPER_SET_ENABLE(1); \
+ /* Add here code for other stepper motor */ \
+ } while (0)
+
+/*
+ * Disable select stepper motor
+ */
+#define STEPPER_DISABLE(index) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_DISABLE(1); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+/*
+ * Disable all stepper connect to micro
+ */
+#define STEPPER_DISABLE_ALL() do { \
+ STEPPER_SET_DISABLE(1); \
+ /* Add here code for other stepper motor */ \
+ } while (0)
+
+/*
+ * Reset selected stepper motor
+ */
+#define STEPPER_RESET(index) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_RESET_MACRO(1); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+/*
+ * Reset all stepper motor
+ */
+#define STEPPER_RESET_ALL() do { \
+ STEPPER_RESET_MACRO(1) \
+ /* Add here code for other stepper motor */ \
+ } while (0)
+
+// Set half/full step macros
+#define STEPPER_SET_HALF_STEP(index, flag) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_STEP_MODE_MACRO(1, flag); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+
+// Control status
+#define STEPPER_SET_CONTROL_BIT(index, flag) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_CONTROL_BIT_MACRO(1, flag); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+
+// Set stepper power current
+#define STEPPER_SET_POWER_CURRENT(index, flag) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_POWER_CURRENT_MACRO(1, flag); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+// Set rotation dirction of stepper motor
+#define STEPPER_SET_DIRECTION(index, dir) do { \
+ switch (index) \
+ { \
+ case 1: \
+ STEPPER_SET_DIRECTION_MACRO(1, dir); \
+ break; \
+ /* Add here code for other stepper motor */ \
+ } \
+ } while (0)
+
+#endif /* HW_STEPPER_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * -->
+ *
+ * \brief thermo hardware-specific control functions.
+ *
+ * \version $Id$
+ * \author Francesco Sacchi <batt@develer.com>
+ *
+ */
+
+#ifndef HW_THERMO_H
+#define HW_THERMO_H
+
+#include "thermo_map.h"
+#include "ntc_map.h"
+
+#include <drv/phase.h>
+#include <drv/ntc.h>
+
+#include <cfg/debug.h>
+#include <cfg/compiler.h>
+
+#warning TODO:This is an example implentation, you must implement it!
+
+/*!
+ * This function should return the temperature set tolerance.
+ */
+INLINE deg_t thermo_hw_tolerance(ThermoDev dev)
+{
+ ASSERT(dev < THERMO_CNT);
+
+ switch (dev)
+ {
+ case THERMO_TEST:
+ /* Put here convertion function to temperature size */
+ break;
+
+ /* Put here your thermo device */
+
+ default:
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
+
+/*!
+ * This function should return the timeout for reaching the
+ * target temperature.
+ */
+INLINE ticks_t thermo_hw_timeout(ThermoDev dev)
+{
+ ASSERT(dev < THERMO_CNT);
+
+ switch (dev)
+ {
+ case THERMO_TEST:
+ /* return ms_to_ticks(60000); */
+ break;
+
+ /* Put here a time out for select thermo device */
+
+ default:
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
+
+
+/*!
+ * Read the temperature of the hw device \a dev.
+ */
+INLINE deg_t thermo_hw_read(ThermoDev dev)
+{
+ return ntc_read(dev);
+}
+
+
+/*!
+ * Turns off a specific device.
+ * This function is usefull to handle errors.
+ */
+INLINE void thermo_hw_off(ThermoDev dev)
+{
+ ASSERT(dev < THERMO_CNT);
+
+ switch (dev)
+ {
+ case THERMO_TEST:
+ phase_setPower(TRIAC_TEST, 0);
+ break;
+
+ /* Put here a thermo device to turn off */
+
+ default:
+ ASSERT(0);
+ }
+
+}
+
+
+/*!
+ * Based on the current temperature \a cur_temp and the target temperature \a target, this function turns on and off specific
+ * triac channel and handles the freezer alarm.
+ * It may use also PID control for thermo-regolations.
+ */
+INLINE void thermo_hw_set(ThermoDev dev, deg_t target, deg_t cur_temp)
+{
+ ASSERT(dev < THERMO_CNT);
+
+ deg_t dist = target - cur_temp;
+ //kprintf("dev[%d], dist[%d]\n", dev, dist);
+
+ switch(dev)
+ {
+ case THERMO_TEST:
+ if (dist > 0)
+ {
+ /* phase_setPower(TRIAC_TEST, dist * PID_TEST_K); */
+ }
+ else
+ {
+ /* phase_setPower(TRIAC_TEST, 0); */
+ }
+ break;
+
+ /* Put here an other thermo device */
+
+ default:
+ ASSERT(0);
+ }
+}
+
+
+#define THERMO_HW_INIT _thermo_hw_init()
+
+/*!
+ * Init hw associated with thermo-control.
+ */
+INLINE void _thermo_hw_init(void)
+{
+ ASSERT(phase_initialized);
+ ASSERT(ntc_initialized);
+
+ phase_setPower(TRIAC_TEST, 0);
+
+ /* Add here the other thermo device */
+}
+
+#endif /* HW_THERMO_H */
* \author Stefano Fedrigo <a@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.2 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.1 2006/02/10 12:31:03 bernie
- *#* Add templates for hw definitions.
- *#*
- *#*/
-
#ifndef HW_KBD_MAP_H
#define HW_KBD_MAP_H
#include <cfg/macros.h>
+#warning TODO:This is an example implentation, you must implement it!
+
/**
* Type for keyboard mask.
#ifndef MCP41_MAP_H
#define MCP41_MAP_H
+#warning TODO:This is an example implentation, you must implement it!
+
/** \name Enum for mcp41 pot evices.
* \{
*/
typedef enum Mcp41Dev
{
MCP41_LED,
- MCP41_PHOTO_GAIN,
+
+ /* put here other mcp41 device */
MCP41_CNT,
} Mcp41Dev;
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief NTC map definitions.
+ *
+ * \version $Id$
+ *
+ * \author Giovanni Bajo <rasky@develer.com>
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+
+#ifndef NTC_MAP_H
+#define NTC_MAP_H
+
+#include <cfg/compiler.h>
+
+#warning TODO:This is an example implentation, you must implement it!
+
+/*! \name Enum for ntc devices.
+ * \{
+ */
+typedef enum NtcDev
+{
+ NTC_TEST,
+
+ /* Put here your thermo device */
+
+ NTC_CNT
+} NtcDev;
+/* \} */
+
+#endif /* NTC_MAP_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief Triac map definitions.
+ *
+ * \version $Id$
+ *
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+
+#ifndef PHASE_MAP_H
+#define PHASE_MAP_H
+
+#warning TODO:This is an example implentation, you must implement it!
+
+/*! \name Enum for triac devices.
+ * \{
+ */
+typedef enum TriacDev
+{
+ TRIAC_TEST,
+
+ /* Put here other triac device */
+
+ TRIAC_CNT
+} TriacDev;
+/* \} */
+
+#endif /* PHASE_MAP_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
+ * -->
+ *
+ *
+ * \brief PWM map device.
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef HW_PWM_MAP_H
+#define HW_PWM_MAP_H
+
+#warning TODO:This is an example implentation, you must implement it!
+
+typedef enum
+{
+ PWM_CH0 = 0,
+
+/* add other PWM channel */
+
+ PWM_CNT
+} PwmDev;
+
+#endif /* HW_PWM_MAP_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Thermo regulation control map definitions.
+ *
+ * \version $Id$
+ *
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+
+#ifndef THERMO_MAP_H
+#define THERMO_MAP_H
+
+#include <cfg/compiler.h>
+#include <cfg/macros.h>
+
+#warning TODO:This is an example implentation, you must implement it!
+
+typedef uint8_t thermostatus_t;
+
+#define THERMO_OFF 0
+#define THERMO_HEATING BV(0)
+#define THERMO_FREEZING BV(1)
+#define THERMO_TGT_REACH BV(2)
+#define THERMOERRF_NTCSHORT BV(3)
+#define THERMOERRF_NTCOPEN BV(4)
+#define THERMOERRF_TIMEOUT BV(5)
+#define THERMO_ACTIVE BV(6)
+
+#define THERMO_ERRMASK (THERMOERRF_NTCSHORT | THERMOERRF_NTCOPEN | THERMOERRF_TIMEOUT)
+
+typedef enum ThermoDev
+{
+ THERMO_TEST,
+
+ /* Put here your thermo device */
+
+ THERMO_CNT,
+} ThermoDev;
+
+#endif /* THERMO_MAP_H */