git-svn-id: http://moon:8086/svn/projects/HendiControl@21 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-02-20 20:01:04 +00:00
parent 21dacf4be6
commit a794460fdc
14 changed files with 446 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
/*
* 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;
}