#include <drv/timer.h>
#include <drv/mcp41.h>
-#include <drv/ser.h>
+#include <kern/kfile.h>
-#warning FIXME:This implementation is obsolete. Refactor with KFile interface.
-
-#if 0
-static Serial *spi_ser;
+static KFile *ch;
/**
* Set resitance for digital pot \a dev
{
MCP41_ON(dev);
/* send command byte */
- ser_putchar(MCP41_WRITE_DATA, spi_ser);
- ser_putchar(((MCP41_HW_MAX * (uint32_t)res) + (MCP41_MAX / 2)) / MCP41_MAX, spi_ser);
+ kfile_putc(MCP41_WRITE_DATA, ch);
+ kfile_putc(((MCP41_HW_MAX * (uint32_t)res) + (MCP41_MAX / 2)) / MCP41_MAX, ch);
+ kfile_flush(ch);
ser_drain(spi_ser);
MCP41_OFF(dev);
/**
* Initialize mcp41 potentiometer driver
*/
-void mcp41_init(Serial *spi_port)
+void mcp41_init(KFile *_ch)
{
Mcp41Dev dev;
MCP41_OFF(dev);
}
- spi_ser = spi_port;
+ ch = _ch;
}
-
-#endif
*
* \version $Id$
*
- * \brief MCP41xxx digital potentiomenter driver (interface)
+ * \brief MCP41xxx digital potentiomenter driver.
*
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
+ *
+ * $WIZ$ module_name = "mcp41"
+ * $WIZ$ module_depends = "timer", "kfile"
+ * $WIZ$ module_hw = "bertos/hw/hw_mcp41.h"
*/
#ifndef DRV_MCP41_H
#include "hw/mcp41_map.h"
#include <cfg/compiler.h>
-#include <drv/ser.h>
+#include <kern/kfile.h>
#define MCP41_WRITE_DATA 0x11
#define MCP41_HW_MAX 255
typedef uint16_t mcp41_res_t;
void mcp41_setResistance(Mcp41Dev dev, mcp41_res_t res);
-void mcp41_init(Serial *spi_port);
+void mcp41_init(KFile *ch);
#endif /* DRV_MCP41_H */