Files
HendiControlFirmware/Control/firmware/uart_echo/mcp42x6.c
T
jens a794460fdc - added
git-svn-id: http://moon:8086/svn/projects/HendiControl@21 fda53097-d464-4ada-af97-ba876c37ca34
2019-02-20 20:01:04 +00:00

27 lines
547 B
C

/*
* mcp42x6.c
*
* Created: 20.02.2019 20:44:16
* Author: jens
*/
#include "mcp42x6.h"
size_t MCP47x6_write_volatile_dac(uint16_t dac_value, uint8_t *buffer, size_t size)
{
*(buffer++) = ~mask & (uint8_t)(dac_value >> 8);
*(buffer++) = (uint8_t)(dac_value >> 0);
return 2;
}
size_t MCP47x6_write_volatile_mem(uint16_t dac_value, uint8_t *buffer, size_t size)
{
*(buffer++) = mask & 0x40;
dac_value <<= 4;
*(buffer++) = (uint8_t)(dac_value >> 8);
*(buffer++) = (uint8_t)(dac_value >> 0);
return 3;
}