Example of using the DS271 battery monitor on the ESP motor driver board using PC_12 as the OneWire interface (Any other GPIO can be used)

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ds2781.h Source File

ds2781.h

00001 #include "stdint.h"
00002 
00003 /* ***** net address commands ***** */
00004 #define READ_NETADDRESS 0x33
00005 #define SKIP_NETADDRESS 0xCC
00006 
00007 
00008 /* ***** function commands ***** */
00009 #define READ_DATA 0x69
00010 #define WRITE_DATA 0x6C
00011 #define COPY_DATA 0x48
00012 #define RECALL_DATA 0xB8
00013 #define LOCK_EEPROM 0x6A    //DO NOT USE
00014 
00015 
00016 /* ***** function prototypes ***** */
00017 /* Function details can be found in the .c file */
00018 int ReadVoltage (void);
00019 uint16_t ReadCurrent (void);
00020 uint32_t ReadAccumulatedCurrent (void);
00021 void ResetAccumulatedCurrent (void);
00022 uint32_t ReadNetAddress (void);
00023 uint16_t ReadTemperature (void);
00024 uint8_t ReadCurrentOffset (void);
00025 void  WriteCurrentOffset (uint8_t offset);
00026 void AdjustCurrentOffset (void);
00027 void UpdateControlRegister (uint8_t control);
00028 uint8_t ReadRAM (uint8_t addr);
00029 void WriteRAM (uint8_t byte, uint8_t addr);
00030 void CopyEEPROM (uint8_t addr);
00031 void RecallEEPROM (uint8_t addr);
00032