-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI2CManager.h
More file actions
67 lines (58 loc) · 1.67 KB
/
I2CManager.h
File metadata and controls
67 lines (58 loc) · 1.67 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file I2CManager.h
* @author M. Rakeh Saleem
* @brief I2C communication manager for sensor control
* @date Created: 2020
* @version 1.0
*/
#ifndef I2C_MANAGER_H
#define I2C_MANAGER_H
#include <Wire.h>
#include "SensorConfig.h"
class I2CManager {
public:
/**
* @brief Initialize I2C communication
*/
static void init();
/**
* @brief Configure MAX5479 digital potentiometer
* @param address I2C address of the potentiometer
* @param waValue Value for WA register
* @param wbValue Value for WB register
* @return true if successful
*/
static bool configureMAX5479(uint8_t address, uint8_t waValue, uint8_t wbValue);
/**
* @brief Configure DS1342 RTC
* @param hour Hour value
* @param minute Minute value
* @param second Second value
* @return true if successful
*/
static bool configureDS1342(uint8_t hour, uint8_t minute, uint8_t second);
/**
* @brief Set DS1342 alarm
* @param alarmNum Alarm number (1 or 2)
* @param hour Hour value
* @param minute Minute value
* @param second Second value
* @return true if successful
*/
static bool setDS1342Alarm(uint8_t alarmNum, uint8_t hour, uint8_t minute, uint8_t second);
/**
* @brief Clear DS1342 status flags
* @return true if successful
*/
static bool clearDS1342Status();
private:
/**
* @brief Send I2C command
* @param address Device address
* @param cmd Command byte
* @param data Data byte
* @return true if successful
*/
static bool sendCommand(uint8_t address, uint8_t cmd, uint8_t data);
};
#endif // I2C_MANAGER_H