SELKIELogger  1.0.0
I2C-SN3218.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Swansea University
3  *
4  * This file is part of the SELKIELogger suite of tools.
5  *
6  * SELKIELogger is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * SELKIELogger is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this SELKIELogger product.
18  * If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef SELKIELoggerI2C_SN3218
22 #define SELKIELoggerI2C_SN3218
23 
29 #include <stdbool.h>
30 #include <stdint.h>
31 
33 #define SN3218_ADDR_DEFAULT 0x54
34 
43 #define SN3218_REG_ENABLE 0x00
44 
57 #define SN3218_REG_PWM_01 0x01
58 
60 #define SN3218_REG_PWM_02 0x02
61 
63 #define SN3218_REG_PWM_03 0x03
64 
66 #define SN3218_REG_PWM_04 0x04
67 
69 #define SN3218_REG_PWM_05 0x05
70 
72 #define SN3218_REG_PWM_06 0x06
73 
75 #define SN3218_REG_PWM_07 0x07
76 
78 #define SN3218_REG_PWM_08 0x08
79 
81 #define SN3218_REG_PWM_09 0x09
82 
84 #define SN3218_REG_PWM_10 0x0A
85 
87 #define SN3218_REG_PWM_11 0x0B
88 
90 #define SN3218_REG_PWM_12 0x0C
91 
93 #define SN3218_REG_PWM_13 0x0D
94 
96 #define SN3218_REG_PWM_14 0x0E
97 
99 #define SN3218_REG_PWM_15 0x0F
100 
102 #define SN3218_REG_PWM_16 0x10
103 
105 #define SN3218_REG_PWM_17 0x11
106 
108 #define SN3218_REG_PWM_18 0x12
110 
123 #define SN3218_REG_LED_01 0x13
124 
126 #define SN3218_REG_LED_02 0x14
127 
129 #define SN3218_REG_LED_03 0x15
131 
133 #define SN3218_REG_UPDATE 0x16
134 
136 #define SN3218_REG_RESET 0x17
137 
139 
152 typedef struct {
153  uint8_t led[18];
156 
158 bool i2c_sn3218_reset(const int busHandle);
159 
161 bool i2c_sn3218_update(const int busHandle, const i2c_sn3218_state *state);
162 
164 #endif
bool i2c_sn3218_reset(const int busHandle)
Reset device to defaults.
Definition: I2C-SN3218.c:32
bool i2c_sn3218_update(const int busHandle, const i2c_sn3218_state *state)
Configure SN3218 chip to match state object.
Definition: I2C-SN3218.c:50
SN3218 State representation.
Definition: I2C-SN3218.h:152
bool global_enable
Global on/off switch.
Definition: I2C-SN3218.h:154