-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathi2cslave.h
More file actions
43 lines (36 loc) · 1.53 KB
/
i2cslave.h
File metadata and controls
43 lines (36 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//header for a library of functions to communicate with the i2cslave
#ifndef EEPROM_CONFIG_H
#define EEPROM_CONFIG_H
#include "globals.h"
#include <stdint.h>
#include <Wire.h>
#include "config.h" // <-- gives access to ci[] and cs[]
#include "utilities.h"
void saveAllConfigToEEPROM(uint16_t addr);
void readDataParsedFromSlaveSerial();
int loadAllConfigFromEEPROM(int mode, uint16_t addr);
int readIntFromEEPROM(uint16_t addr);
long readLongFromEEPROM(uint16_t addr);
void writeIntToEEPROM(uint16_t addr, int value);
void writeStringToEEPROM(uint16_t addr, const char* s);
void testWrite();
void testRead();
void setAddress(uint16_t addr);
void readStringFromSlaveEEPROM(uint16_t addr, char* buffer, size_t maxLen);
void readBytesFromSlaveEEPROM(uint16_t addr, char* buffer, size_t maxLen);
size_t readBytesFromSlaveSerial( char* buffer, size_t maxLen);
void sendSlaveSerial(String inVal);
void normalSlaveMode();
void enableSlaveSerial(int baudSelector);
uint32_t getParsedSlaveDatum(uint8_t ordinal);
uint32_t getSlaveConfigItem(uint8_t ordinal);
uint32_t getSlaveLong(uint8_t ordinal);
void setSlaveConfigItem(uint8_t ordinal, uint16_t value);
void setSlaveLong(uint8_t ordinal, uint32_t value);
uint32_t requestLong(byte slaveAddress, byte command);
void sendLong(byte slaveAddress, byte command, uint32_t value);
uint32_t requestLongWithData(byte slaveAddress, byte command, uint32_t value);
void petWatchDog(uint8_t command, uint32_t unixTime);
void slaveWatchdogInfo();
String slaveWatchdogData();
#endif