X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fmcp41.c;h=bfa8fd4ebac7935544e66976c5c3b5001d7d9d6b;hb=e423e63cade618baf616a79b99aaab5de74ec76e;hp=62b96fd7c2e72e2bdb5703a698b26277f9199cfc;hpb=0fbabc305e65dfc5538cfcae10c04f6be9daf657;p=bertos.git diff --git a/bertos/drv/mcp41.c b/bertos/drv/mcp41.c index 62b96fd7..bfa8fd4e 100644 --- a/bertos/drv/mcp41.c +++ b/bertos/drv/mcp41.c @@ -36,18 +36,16 @@ * \author Francesco Sacchi */ -#include "hw_mcp41.h" +#include "hw/hw_mcp41.h" #include #include #include #include -#include +#include -#warning FIXME:This implementation is obsolete. Refactor with KFile interface. - -static Serial *spi_ser; +static KFile *ch; /** * Set resitance for digital pot \a dev @@ -56,9 +54,9 @@ void mcp41_setResistance(Mcp41Dev dev, mcp41_res_t res) { 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); - ser_drain(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); MCP41_OFF(dev); } @@ -67,7 +65,7 @@ void mcp41_setResistance(Mcp41Dev dev, mcp41_res_t res) /** * Initialize mcp41 potentiometer driver */ -void mcp41_init(Serial *spi_port) +void mcp41_init(KFile *_ch) { Mcp41Dev dev; @@ -78,5 +76,5 @@ void mcp41_init(Serial *spi_port) MCP41_OFF(dev); } - spi_ser = spi_port; + ch = _ch; }