MAX77654 Ultra-Low Power PMIC Mbed Driver

Committer:
metin.ozkan@analog.com
Date:
Tue Apr 26 09:43:41 2022 +0300
Revision:
1:4ad70542956e
Parent:
0:788f63dcf0a0
Child:
2:951902a65736
[MBUISTSW-103]: [MAX77654_Mbed_Driver] ERCFLAG descriptions is incorrect
[MBUISTSW-104]: [MAX77654_Mbed_Driver] Remove unused constructor inputs (dataPin, powerPin) and <iostream> header.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
metin.ozkan@analog.com 0:788f63dcf0a0 1 /*******************************************************************************
metin.ozkan@analog.com 0:788f63dcf0a0 2 * Copyright (C) 2022 Maxim Integrated Products, Inc., All rights Reserved.
metin.ozkan@analog.com 0:788f63dcf0a0 3 *
metin.ozkan@analog.com 0:788f63dcf0a0 4 * This software is protected by copyright laws of the United States and
metin.ozkan@analog.com 0:788f63dcf0a0 5 * of foreign countries. This material may also be protected by patent laws
metin.ozkan@analog.com 0:788f63dcf0a0 6 * and technology transfer regulations of the United States and of foreign
metin.ozkan@analog.com 0:788f63dcf0a0 7 * countries. This software is furnished under a license agreement and/or a
metin.ozkan@analog.com 0:788f63dcf0a0 8 * nondisclosure agreement and may only be used or reproduced in accordance
metin.ozkan@analog.com 0:788f63dcf0a0 9 * with the terms of those agreements. Dissemination of this information to
metin.ozkan@analog.com 0:788f63dcf0a0 10 * any party or parties not specified in the license agreement and/or
metin.ozkan@analog.com 0:788f63dcf0a0 11 * nondisclosure agreement is expressly prohibited.
metin.ozkan@analog.com 0:788f63dcf0a0 12 *
metin.ozkan@analog.com 0:788f63dcf0a0 13 * The above copyright notice and this permission notice shall be included
metin.ozkan@analog.com 0:788f63dcf0a0 14 * in all copies or substantial portions of the Software.
metin.ozkan@analog.com 0:788f63dcf0a0 15 *
metin.ozkan@analog.com 0:788f63dcf0a0 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
metin.ozkan@analog.com 0:788f63dcf0a0 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
metin.ozkan@analog.com 0:788f63dcf0a0 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
metin.ozkan@analog.com 0:788f63dcf0a0 19 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
metin.ozkan@analog.com 0:788f63dcf0a0 20 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
metin.ozkan@analog.com 0:788f63dcf0a0 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
metin.ozkan@analog.com 0:788f63dcf0a0 22 * OTHER DEALINGS IN THE SOFTWARE.
metin.ozkan@analog.com 0:788f63dcf0a0 23 *
metin.ozkan@analog.com 0:788f63dcf0a0 24 * Except as contained in this notice, the name of Maxim Integrated
metin.ozkan@analog.com 0:788f63dcf0a0 25 * Products, Inc. shall not be used except as stated in the Maxim Integrated
metin.ozkan@analog.com 0:788f63dcf0a0 26 * Products, Inc. Branding Policy.
metin.ozkan@analog.com 0:788f63dcf0a0 27 *
metin.ozkan@analog.com 0:788f63dcf0a0 28 * The mere transfer of this software does not imply any licenses
metin.ozkan@analog.com 0:788f63dcf0a0 29 * of trade secrets, proprietary technology, copyrights, patents,
metin.ozkan@analog.com 0:788f63dcf0a0 30 * trademarks, maskwork rights, or any other form of intellectual
metin.ozkan@analog.com 0:788f63dcf0a0 31 * property whatsoever. Maxim Integrated Products, Inc. retains all
metin.ozkan@analog.com 0:788f63dcf0a0 32 * ownership rights.
metin.ozkan@analog.com 0:788f63dcf0a0 33 *******************************************************************************
metin.ozkan@analog.com 0:788f63dcf0a0 34 */
metin.ozkan@analog.com 0:788f63dcf0a0 35
metin.ozkan@analog.com 0:788f63dcf0a0 36 #include <iostream>
metin.ozkan@analog.com 0:788f63dcf0a0 37 #include <Thread.h>
metin.ozkan@analog.com 0:788f63dcf0a0 38 #include "MAX77654.h"
metin.ozkan@analog.com 0:788f63dcf0a0 39 using namespace std;
metin.ozkan@analog.com 0:788f63dcf0a0 40
metin.ozkan@analog.com 0:788f63dcf0a0 41 #define POST_INTR_WORK_SIGNAL_ID 0x1
metin.ozkan@analog.com 0:788f63dcf0a0 42
metin.ozkan@analog.com 1:4ad70542956e 43 MAX77654::MAX77654(I2C *i2c, PinName IRQPin)
metin.ozkan@analog.com 0:788f63dcf0a0 44 {
metin.ozkan@analog.com 1:4ad70542956e 45 if (i2c == NULL)
metin.ozkan@analog.com 0:788f63dcf0a0 46 return;
metin.ozkan@analog.com 0:788f63dcf0a0 47
metin.ozkan@analog.com 0:788f63dcf0a0 48 i2c_handler = i2c;
metin.ozkan@analog.com 0:788f63dcf0a0 49
metin.ozkan@analog.com 0:788f63dcf0a0 50 if (IRQPin != NC) {
metin.ozkan@analog.com 0:788f63dcf0a0 51 IRQDisableAll();
metin.ozkan@analog.com 0:788f63dcf0a0 52 post_intr_work_thread = new Thread();
metin.ozkan@analog.com 0:788f63dcf0a0 53 post_intr_work_thread->start(Callback<void()>(this, &MAX77654::PostInterruptWork));
metin.ozkan@analog.com 0:788f63dcf0a0 54
metin.ozkan@analog.com 0:788f63dcf0a0 55 this->irq_pin = new InterruptIn(IRQPin);
metin.ozkan@analog.com 0:788f63dcf0a0 56 this->irq_pin->fall(Callback<void()>(this, &MAX77654::InterruptHandler));
metin.ozkan@analog.com 0:788f63dcf0a0 57 this->irq_pin->enable_irq();
metin.ozkan@analog.com 0:788f63dcf0a0 58 } else {
metin.ozkan@analog.com 0:788f63dcf0a0 59 this->irq_pin = NULL;
metin.ozkan@analog.com 0:788f63dcf0a0 60 }
metin.ozkan@analog.com 0:788f63dcf0a0 61 }
metin.ozkan@analog.com 0:788f63dcf0a0 62
metin.ozkan@analog.com 0:788f63dcf0a0 63 MAX77654::~MAX77654()
metin.ozkan@analog.com 0:788f63dcf0a0 64 {
metin.ozkan@analog.com 0:788f63dcf0a0 65 if (post_intr_work_thread) {
metin.ozkan@analog.com 0:788f63dcf0a0 66 delete post_intr_work_thread;
metin.ozkan@analog.com 0:788f63dcf0a0 67 }
metin.ozkan@analog.com 0:788f63dcf0a0 68
metin.ozkan@analog.com 0:788f63dcf0a0 69 if (irq_pin) {
metin.ozkan@analog.com 0:788f63dcf0a0 70 delete irq_pin;
metin.ozkan@analog.com 0:788f63dcf0a0 71 }
metin.ozkan@analog.com 0:788f63dcf0a0 72 }
metin.ozkan@analog.com 0:788f63dcf0a0 73
metin.ozkan@analog.com 0:788f63dcf0a0 74 int MAX77654::read_register(uint8_t reg, uint8_t *value)
metin.ozkan@analog.com 0:788f63dcf0a0 75 {
metin.ozkan@analog.com 0:788f63dcf0a0 76 int rtn_val;
metin.ozkan@analog.com 0:788f63dcf0a0 77
metin.ozkan@analog.com 0:788f63dcf0a0 78 if (value == NULL) {
metin.ozkan@analog.com 0:788f63dcf0a0 79 return MAX77654_VALUE_NULL;
metin.ozkan@analog.com 0:788f63dcf0a0 80 }
metin.ozkan@analog.com 0:788f63dcf0a0 81
metin.ozkan@analog.com 0:788f63dcf0a0 82 rtn_val = i2c_handler->write(MAX77654_I2C_ADDRESS, (const char *)&reg, 1, true);
metin.ozkan@analog.com 0:788f63dcf0a0 83 if (rtn_val != 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 84 return MAX77654_WRITE_DATA_FAILED;
metin.ozkan@analog.com 0:788f63dcf0a0 85 }
metin.ozkan@analog.com 0:788f63dcf0a0 86
metin.ozkan@analog.com 0:788f63dcf0a0 87 rtn_val = i2c_handler->read(MAX77654_I2C_ADDRESS, (char *) value, 1, false);
metin.ozkan@analog.com 0:788f63dcf0a0 88 if (rtn_val < 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 89 return MAX77654_READ_DATA_FAILED;
metin.ozkan@analog.com 0:788f63dcf0a0 90 }
metin.ozkan@analog.com 0:788f63dcf0a0 91
metin.ozkan@analog.com 0:788f63dcf0a0 92 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 93 }
metin.ozkan@analog.com 0:788f63dcf0a0 94
metin.ozkan@analog.com 0:788f63dcf0a0 95 int MAX77654::write_register(uint8_t reg, const uint8_t *value)
metin.ozkan@analog.com 0:788f63dcf0a0 96 {
metin.ozkan@analog.com 0:788f63dcf0a0 97 int rtn_val;
metin.ozkan@analog.com 0:788f63dcf0a0 98 uint8_t local_data[2];
metin.ozkan@analog.com 0:788f63dcf0a0 99
metin.ozkan@analog.com 0:788f63dcf0a0 100 if (value == NULL) {
metin.ozkan@analog.com 0:788f63dcf0a0 101 return MAX77654_VALUE_NULL;
metin.ozkan@analog.com 0:788f63dcf0a0 102 }
metin.ozkan@analog.com 0:788f63dcf0a0 103
metin.ozkan@analog.com 0:788f63dcf0a0 104 local_data[0] = reg;
metin.ozkan@analog.com 0:788f63dcf0a0 105
metin.ozkan@analog.com 0:788f63dcf0a0 106 memcpy(&local_data[1], value, 1);
metin.ozkan@analog.com 0:788f63dcf0a0 107
metin.ozkan@analog.com 0:788f63dcf0a0 108 rtn_val = i2c_handler->write(MAX77654_I2C_ADDRESS, (const char *)local_data, sizeof(local_data));
metin.ozkan@analog.com 0:788f63dcf0a0 109 if (rtn_val != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 110 return MAX77654_WRITE_DATA_FAILED;
metin.ozkan@analog.com 0:788f63dcf0a0 111 }
metin.ozkan@analog.com 0:788f63dcf0a0 112
metin.ozkan@analog.com 0:788f63dcf0a0 113 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 114 }
metin.ozkan@analog.com 0:788f63dcf0a0 115
metin.ozkan@analog.com 0:788f63dcf0a0 116 #define SET_BIT_FIELD(address, reg_name, bit_field_name, value) \
metin.ozkan@analog.com 0:788f63dcf0a0 117 int ret; \
metin.ozkan@analog.com 0:788f63dcf0a0 118 ret = read_register(address, (uint8_t *)&(reg_name)); \
metin.ozkan@analog.com 0:788f63dcf0a0 119 if (ret) { \
metin.ozkan@analog.com 0:788f63dcf0a0 120 return ret; \
metin.ozkan@analog.com 0:788f63dcf0a0 121 } \
metin.ozkan@analog.com 0:788f63dcf0a0 122 bit_field_name = value; \
metin.ozkan@analog.com 0:788f63dcf0a0 123 ret = write_register(address, (uint8_t *)&(reg_name)); \
metin.ozkan@analog.com 0:788f63dcf0a0 124 if (ret) { \
metin.ozkan@analog.com 0:788f63dcf0a0 125 return ret; \
metin.ozkan@analog.com 0:788f63dcf0a0 126 }
metin.ozkan@analog.com 0:788f63dcf0a0 127
metin.ozkan@analog.com 0:788f63dcf0a0 128 int MAX77654::GetThermalOverload(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 129 {
metin.ozkan@analog.com 0:788f63dcf0a0 130 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 131 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 132
metin.ozkan@analog.com 0:788f63dcf0a0 133 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 134 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 135 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 136 }
metin.ozkan@analog.com 0:788f63dcf0a0 137
metin.ozkan@analog.com 0:788f63dcf0a0 138 *ercflag = (ercflag_t)reg_ercflag.bits.tovld;
metin.ozkan@analog.com 0:788f63dcf0a0 139
metin.ozkan@analog.com 0:788f63dcf0a0 140 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 141 }
metin.ozkan@analog.com 0:788f63dcf0a0 142
metin.ozkan@analog.com 0:788f63dcf0a0 143 int MAX77654::GetSysOvervoltageLockout(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 144 {
metin.ozkan@analog.com 0:788f63dcf0a0 145 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 146 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 147
metin.ozkan@analog.com 0:788f63dcf0a0 148 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 149 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 150 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 151 }
metin.ozkan@analog.com 0:788f63dcf0a0 152
metin.ozkan@analog.com 0:788f63dcf0a0 153 *ercflag = (ercflag_t)reg_ercflag.bits.sysovlo;
metin.ozkan@analog.com 0:788f63dcf0a0 154
metin.ozkan@analog.com 0:788f63dcf0a0 155 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 156 }
metin.ozkan@analog.com 0:788f63dcf0a0 157
metin.ozkan@analog.com 0:788f63dcf0a0 158 int MAX77654::GetSysUndervoltageLockout(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 159 {
metin.ozkan@analog.com 0:788f63dcf0a0 160 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 161 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 162
metin.ozkan@analog.com 0:788f63dcf0a0 163 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 164 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 165 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 166 }
metin.ozkan@analog.com 0:788f63dcf0a0 167
metin.ozkan@analog.com 0:788f63dcf0a0 168 *ercflag = (ercflag_t)reg_ercflag.bits.sysuvlo;
metin.ozkan@analog.com 0:788f63dcf0a0 169
metin.ozkan@analog.com 0:788f63dcf0a0 170 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 171 }
metin.ozkan@analog.com 0:788f63dcf0a0 172
metin.ozkan@analog.com 0:788f63dcf0a0 173 int MAX77654::GetManualResetTimer(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 174 {
metin.ozkan@analog.com 0:788f63dcf0a0 175 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 176 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 177
metin.ozkan@analog.com 0:788f63dcf0a0 178 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 179 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 180 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 181 }
metin.ozkan@analog.com 0:788f63dcf0a0 182
metin.ozkan@analog.com 0:788f63dcf0a0 183 *ercflag = (ercflag_t)reg_ercflag.bits.mrst;
metin.ozkan@analog.com 0:788f63dcf0a0 184
metin.ozkan@analog.com 0:788f63dcf0a0 185 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 186 }
metin.ozkan@analog.com 0:788f63dcf0a0 187
metin.ozkan@analog.com 0:788f63dcf0a0 188 int MAX77654::GetSoftwareOffFlag(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 189 {
metin.ozkan@analog.com 0:788f63dcf0a0 190 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 191 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 192
metin.ozkan@analog.com 0:788f63dcf0a0 193 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 194 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 195 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 196 }
metin.ozkan@analog.com 0:788f63dcf0a0 197
metin.ozkan@analog.com 0:788f63dcf0a0 198 *ercflag = (ercflag_t)reg_ercflag.bits.sft_off_f;
metin.ozkan@analog.com 0:788f63dcf0a0 199
metin.ozkan@analog.com 0:788f63dcf0a0 200 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 201 }
metin.ozkan@analog.com 0:788f63dcf0a0 202
metin.ozkan@analog.com 0:788f63dcf0a0 203 int MAX77654::GetSoftwareColdResetFlag(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 204 {
metin.ozkan@analog.com 0:788f63dcf0a0 205 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 206 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 207
metin.ozkan@analog.com 0:788f63dcf0a0 208 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 209 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 210 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 211 }
metin.ozkan@analog.com 0:788f63dcf0a0 212
metin.ozkan@analog.com 0:788f63dcf0a0 213 *ercflag = (ercflag_t)reg_ercflag.bits.sft_crst_f;
metin.ozkan@analog.com 0:788f63dcf0a0 214
metin.ozkan@analog.com 0:788f63dcf0a0 215 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 216 }
metin.ozkan@analog.com 0:788f63dcf0a0 217
metin.ozkan@analog.com 0:788f63dcf0a0 218 int MAX77654::GetWatchdogTimerOffFlag(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 219 {
metin.ozkan@analog.com 0:788f63dcf0a0 220 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 221 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 222
metin.ozkan@analog.com 0:788f63dcf0a0 223 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 224 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 225 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 226 }
metin.ozkan@analog.com 0:788f63dcf0a0 227
metin.ozkan@analog.com 0:788f63dcf0a0 228 *ercflag = (ercflag_t)reg_ercflag.bits.wdt_off;
metin.ozkan@analog.com 0:788f63dcf0a0 229
metin.ozkan@analog.com 0:788f63dcf0a0 230 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 231 }
metin.ozkan@analog.com 0:788f63dcf0a0 232
metin.ozkan@analog.com 0:788f63dcf0a0 233 int MAX77654::GetWatchdogTimerResetFlag(ercflag_t *ercflag)
metin.ozkan@analog.com 0:788f63dcf0a0 234 {
metin.ozkan@analog.com 0:788f63dcf0a0 235 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 236 reg_ercflag_t reg_ercflag;
metin.ozkan@analog.com 0:788f63dcf0a0 237
metin.ozkan@analog.com 0:788f63dcf0a0 238 ret = read_register(ERCFLAG, (uint8_t *)&(reg_ercflag));
metin.ozkan@analog.com 0:788f63dcf0a0 239 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 240 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 241 }
metin.ozkan@analog.com 0:788f63dcf0a0 242
metin.ozkan@analog.com 0:788f63dcf0a0 243 *ercflag = (ercflag_t)reg_ercflag.bits.wdt_rst;
metin.ozkan@analog.com 0:788f63dcf0a0 244
metin.ozkan@analog.com 0:788f63dcf0a0 245 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 246 }
metin.ozkan@analog.com 0:788f63dcf0a0 247
metin.ozkan@analog.com 0:788f63dcf0a0 248 int MAX77654::GetDeviceIdentification(didm_t *didm)
metin.ozkan@analog.com 0:788f63dcf0a0 249 {
metin.ozkan@analog.com 0:788f63dcf0a0 250 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 251 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 252
metin.ozkan@analog.com 0:788f63dcf0a0 253 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 254 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 255 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 256 }
metin.ozkan@analog.com 0:788f63dcf0a0 257
metin.ozkan@analog.com 0:788f63dcf0a0 258 *didm = (didm_t)reg_stat_glbl.bits.didm;
metin.ozkan@analog.com 0:788f63dcf0a0 259
metin.ozkan@analog.com 0:788f63dcf0a0 260 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 261 }
metin.ozkan@analog.com 0:788f63dcf0a0 262
metin.ozkan@analog.com 0:788f63dcf0a0 263 int MAX77654::GetBOKInterruptStatus(bok_t* bok)
metin.ozkan@analog.com 0:788f63dcf0a0 264 {
metin.ozkan@analog.com 0:788f63dcf0a0 265 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 266 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 267
metin.ozkan@analog.com 0:788f63dcf0a0 268 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 269 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 270 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 271 }
metin.ozkan@analog.com 0:788f63dcf0a0 272
metin.ozkan@analog.com 0:788f63dcf0a0 273 *bok = (bok_t)reg_stat_glbl.bits.bok;
metin.ozkan@analog.com 0:788f63dcf0a0 274
metin.ozkan@analog.com 0:788f63dcf0a0 275 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 276 }
metin.ozkan@analog.com 0:788f63dcf0a0 277
metin.ozkan@analog.com 0:788f63dcf0a0 278 int MAX77654::GetLDO0DropoutRisingStatus(dod0_s_t* dod0_s)
metin.ozkan@analog.com 0:788f63dcf0a0 279 {
metin.ozkan@analog.com 0:788f63dcf0a0 280 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 281 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 282
metin.ozkan@analog.com 0:788f63dcf0a0 283 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 284 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 285 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 286 }
metin.ozkan@analog.com 0:788f63dcf0a0 287
metin.ozkan@analog.com 0:788f63dcf0a0 288 *dod0_s = (dod0_s_t)reg_stat_glbl.bits.dod0_s;
metin.ozkan@analog.com 0:788f63dcf0a0 289
metin.ozkan@analog.com 0:788f63dcf0a0 290 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 291 }
metin.ozkan@analog.com 0:788f63dcf0a0 292
metin.ozkan@analog.com 0:788f63dcf0a0 293 int MAX77654::GetLDO1DropoutRisingStatus(dod1_s_t* dod1_s)
metin.ozkan@analog.com 0:788f63dcf0a0 294 {
metin.ozkan@analog.com 0:788f63dcf0a0 295 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 296 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 297
metin.ozkan@analog.com 0:788f63dcf0a0 298 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 299 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 300 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 301 }
metin.ozkan@analog.com 0:788f63dcf0a0 302
metin.ozkan@analog.com 0:788f63dcf0a0 303 *dod1_s = (dod1_s_t)reg_stat_glbl.bits.dod1_s;
metin.ozkan@analog.com 0:788f63dcf0a0 304
metin.ozkan@analog.com 0:788f63dcf0a0 305 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 306 }
metin.ozkan@analog.com 0:788f63dcf0a0 307
metin.ozkan@analog.com 0:788f63dcf0a0 308 int MAX77654::GetThermalAlarm2Status(tjal2_s_t* tjal2_s)
metin.ozkan@analog.com 0:788f63dcf0a0 309 {
metin.ozkan@analog.com 0:788f63dcf0a0 310 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 311 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 312
metin.ozkan@analog.com 0:788f63dcf0a0 313 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 314 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 315 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 316 }
metin.ozkan@analog.com 0:788f63dcf0a0 317
metin.ozkan@analog.com 0:788f63dcf0a0 318 *tjal2_s = (tjal2_s_t)reg_stat_glbl.bits.tjal2_s;
metin.ozkan@analog.com 0:788f63dcf0a0 319
metin.ozkan@analog.com 0:788f63dcf0a0 320 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 321 }
metin.ozkan@analog.com 0:788f63dcf0a0 322
metin.ozkan@analog.com 0:788f63dcf0a0 323 int MAX77654::GetThermalAlarm1Status(tjal1_s_t* tjal1_s)
metin.ozkan@analog.com 0:788f63dcf0a0 324 {
metin.ozkan@analog.com 0:788f63dcf0a0 325 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 326 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 327
metin.ozkan@analog.com 0:788f63dcf0a0 328 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 329 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 330 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 331 }
metin.ozkan@analog.com 0:788f63dcf0a0 332
metin.ozkan@analog.com 0:788f63dcf0a0 333 *tjal1_s = (tjal1_s_t)reg_stat_glbl.bits.tjal1_s;
metin.ozkan@analog.com 0:788f63dcf0a0 334
metin.ozkan@analog.com 0:788f63dcf0a0 335 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 336 }
metin.ozkan@analog.com 0:788f63dcf0a0 337
metin.ozkan@analog.com 0:788f63dcf0a0 338 int MAX77654::GetnENDebouncedStatus(stat_en_t* stat_en)
metin.ozkan@analog.com 0:788f63dcf0a0 339 {
metin.ozkan@analog.com 0:788f63dcf0a0 340 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 341 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 342
metin.ozkan@analog.com 0:788f63dcf0a0 343 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 344 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 345 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 346 }
metin.ozkan@analog.com 0:788f63dcf0a0 347
metin.ozkan@analog.com 0:788f63dcf0a0 348 *stat_en = (stat_en_t)reg_stat_glbl.bits.stat_en;
metin.ozkan@analog.com 0:788f63dcf0a0 349
metin.ozkan@analog.com 0:788f63dcf0a0 350 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 351 }
metin.ozkan@analog.com 0:788f63dcf0a0 352
metin.ozkan@analog.com 0:788f63dcf0a0 353 int MAX77654::GetSoftwareVersionGateDrive(stat_irq_t* stat_irq)
metin.ozkan@analog.com 0:788f63dcf0a0 354 {
metin.ozkan@analog.com 0:788f63dcf0a0 355 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 356 reg_stat_glbl_t reg_stat_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 357
metin.ozkan@analog.com 0:788f63dcf0a0 358 ret = read_register(STAT_GLBL, (uint8_t *)&(reg_stat_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 359 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 360 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 361 }
metin.ozkan@analog.com 0:788f63dcf0a0 362
metin.ozkan@analog.com 0:788f63dcf0a0 363 *stat_irq = (stat_irq_t)reg_stat_glbl.bits.stat_irq;
metin.ozkan@analog.com 0:788f63dcf0a0 364
metin.ozkan@analog.com 0:788f63dcf0a0 365 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 366 }
metin.ozkan@analog.com 0:788f63dcf0a0 367
metin.ozkan@analog.com 0:788f63dcf0a0 368 int MAX77654::SetLDO1FaultInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 369 {
metin.ozkan@analog.com 0:788f63dcf0a0 370 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 371
metin.ozkan@analog.com 0:788f63dcf0a0 372 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.ldo1_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 373
metin.ozkan@analog.com 0:788f63dcf0a0 374 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 375 }
metin.ozkan@analog.com 0:788f63dcf0a0 376
metin.ozkan@analog.com 0:788f63dcf0a0 377 int MAX77654::GetLDO1FaultInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 378 {
metin.ozkan@analog.com 0:788f63dcf0a0 379 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 380 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 381
metin.ozkan@analog.com 0:788f63dcf0a0 382 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 383 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 384 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 385 }
metin.ozkan@analog.com 0:788f63dcf0a0 386
metin.ozkan@analog.com 0:788f63dcf0a0 387 *intm = (intm_t)reg_intm_glbl1.bits.ldo1_m;
metin.ozkan@analog.com 0:788f63dcf0a0 388
metin.ozkan@analog.com 0:788f63dcf0a0 389 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 390 }
metin.ozkan@analog.com 0:788f63dcf0a0 391
metin.ozkan@analog.com 0:788f63dcf0a0 392 int MAX77654::SetLDO0FaultInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 393 {
metin.ozkan@analog.com 0:788f63dcf0a0 394 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 395
metin.ozkan@analog.com 0:788f63dcf0a0 396 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.ldo0_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 397
metin.ozkan@analog.com 0:788f63dcf0a0 398 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 399 }
metin.ozkan@analog.com 0:788f63dcf0a0 400
metin.ozkan@analog.com 0:788f63dcf0a0 401 int MAX77654::GetLDO0FaultInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 402 {
metin.ozkan@analog.com 0:788f63dcf0a0 403 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 404 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 405
metin.ozkan@analog.com 0:788f63dcf0a0 406 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 407 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 408 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 409 }
metin.ozkan@analog.com 0:788f63dcf0a0 410
metin.ozkan@analog.com 0:788f63dcf0a0 411 *intm = (intm_t)reg_intm_glbl1.bits.ldo0_m;
metin.ozkan@analog.com 0:788f63dcf0a0 412
metin.ozkan@analog.com 0:788f63dcf0a0 413 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 414 }
metin.ozkan@analog.com 0:788f63dcf0a0 415
metin.ozkan@analog.com 0:788f63dcf0a0 416 int MAX77654::SetSBBTimeoutMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 417 {
metin.ozkan@analog.com 0:788f63dcf0a0 418 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 419
metin.ozkan@analog.com 0:788f63dcf0a0 420 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.sbb_to_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 421
metin.ozkan@analog.com 0:788f63dcf0a0 422 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 423 }
metin.ozkan@analog.com 0:788f63dcf0a0 424
metin.ozkan@analog.com 0:788f63dcf0a0 425 int MAX77654::GetSBBTimeoutMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 426 {
metin.ozkan@analog.com 0:788f63dcf0a0 427 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 428 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 429
metin.ozkan@analog.com 0:788f63dcf0a0 430 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 431 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 432 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 433 }
metin.ozkan@analog.com 0:788f63dcf0a0 434
metin.ozkan@analog.com 0:788f63dcf0a0 435 *intm = (intm_t)reg_intm_glbl1.bits.sbb_to_m;
metin.ozkan@analog.com 0:788f63dcf0a0 436
metin.ozkan@analog.com 0:788f63dcf0a0 437 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 438 }
metin.ozkan@analog.com 0:788f63dcf0a0 439
metin.ozkan@analog.com 0:788f63dcf0a0 440 int MAX77654::SetGPI2RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 441 {
metin.ozkan@analog.com 0:788f63dcf0a0 442 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 443
metin.ozkan@analog.com 0:788f63dcf0a0 444 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.gpi2_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 445
metin.ozkan@analog.com 0:788f63dcf0a0 446 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 447 }
metin.ozkan@analog.com 0:788f63dcf0a0 448
metin.ozkan@analog.com 0:788f63dcf0a0 449 int MAX77654::GetGPI2RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 450 {
metin.ozkan@analog.com 0:788f63dcf0a0 451 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 452 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 453
metin.ozkan@analog.com 0:788f63dcf0a0 454 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 455 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 456 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 457 }
metin.ozkan@analog.com 0:788f63dcf0a0 458
metin.ozkan@analog.com 0:788f63dcf0a0 459 *intm = (intm_t)reg_intm_glbl1.bits.gpi2_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 460
metin.ozkan@analog.com 0:788f63dcf0a0 461 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 462 }
metin.ozkan@analog.com 0:788f63dcf0a0 463
metin.ozkan@analog.com 0:788f63dcf0a0 464 int MAX77654::SetGPI2FallingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 465 {
metin.ozkan@analog.com 0:788f63dcf0a0 466 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 467
metin.ozkan@analog.com 0:788f63dcf0a0 468 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.gpi2_fm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 469
metin.ozkan@analog.com 0:788f63dcf0a0 470 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 471 }
metin.ozkan@analog.com 0:788f63dcf0a0 472
metin.ozkan@analog.com 0:788f63dcf0a0 473 int MAX77654::GetGPI2FallingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 474 {
metin.ozkan@analog.com 0:788f63dcf0a0 475 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 476 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 477
metin.ozkan@analog.com 0:788f63dcf0a0 478 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 479 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 480 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 481 }
metin.ozkan@analog.com 0:788f63dcf0a0 482
metin.ozkan@analog.com 0:788f63dcf0a0 483 *intm = (intm_t)reg_intm_glbl1.bits.gpi2_fm;
metin.ozkan@analog.com 0:788f63dcf0a0 484
metin.ozkan@analog.com 0:788f63dcf0a0 485 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 486 }
metin.ozkan@analog.com 0:788f63dcf0a0 487
metin.ozkan@analog.com 0:788f63dcf0a0 488 int MAX77654::SetGPI1RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 489 {
metin.ozkan@analog.com 0:788f63dcf0a0 490 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 491
metin.ozkan@analog.com 0:788f63dcf0a0 492 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.gpi1_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 493
metin.ozkan@analog.com 0:788f63dcf0a0 494 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 495 }
metin.ozkan@analog.com 0:788f63dcf0a0 496
metin.ozkan@analog.com 0:788f63dcf0a0 497 int MAX77654::GetGPI1RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 498 {
metin.ozkan@analog.com 0:788f63dcf0a0 499 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 500 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 501
metin.ozkan@analog.com 0:788f63dcf0a0 502 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 503 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 504 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 505 }
metin.ozkan@analog.com 0:788f63dcf0a0 506
metin.ozkan@analog.com 0:788f63dcf0a0 507 *intm = (intm_t)reg_intm_glbl1.bits.gpi1_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 508
metin.ozkan@analog.com 0:788f63dcf0a0 509 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 510 }
metin.ozkan@analog.com 0:788f63dcf0a0 511
metin.ozkan@analog.com 0:788f63dcf0a0 512 int MAX77654::SetGPI1FallingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 513 {
metin.ozkan@analog.com 0:788f63dcf0a0 514 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 515
metin.ozkan@analog.com 0:788f63dcf0a0 516 SET_BIT_FIELD(INTM_GLBL1, reg_intm_glbl1, reg_intm_glbl1.bits.gpi1_fm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 517
metin.ozkan@analog.com 0:788f63dcf0a0 518 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 519 }
metin.ozkan@analog.com 0:788f63dcf0a0 520
metin.ozkan@analog.com 0:788f63dcf0a0 521 int MAX77654::GetGPI1FallingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 522 {
metin.ozkan@analog.com 0:788f63dcf0a0 523 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 524 reg_intm_glbl1_t reg_intm_glbl1;
metin.ozkan@analog.com 0:788f63dcf0a0 525
metin.ozkan@analog.com 0:788f63dcf0a0 526 ret = read_register(INTM_GLBL1, (uint8_t *)&(reg_intm_glbl1));
metin.ozkan@analog.com 0:788f63dcf0a0 527 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 528 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 529 }
metin.ozkan@analog.com 0:788f63dcf0a0 530
metin.ozkan@analog.com 0:788f63dcf0a0 531 *intm = (intm_t)reg_intm_glbl1.bits.gpi1_fm;
metin.ozkan@analog.com 0:788f63dcf0a0 532
metin.ozkan@analog.com 0:788f63dcf0a0 533 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 534 }
metin.ozkan@analog.com 0:788f63dcf0a0 535
metin.ozkan@analog.com 0:788f63dcf0a0 536 int MAX77654::SetDropout0RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 537 {
metin.ozkan@analog.com 0:788f63dcf0a0 538 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 539
metin.ozkan@analog.com 0:788f63dcf0a0 540 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.dod0_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 541
metin.ozkan@analog.com 0:788f63dcf0a0 542 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 543 }
metin.ozkan@analog.com 0:788f63dcf0a0 544
metin.ozkan@analog.com 0:788f63dcf0a0 545 int MAX77654::GetDropout0RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 546 {
metin.ozkan@analog.com 0:788f63dcf0a0 547 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 548 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 549
metin.ozkan@analog.com 0:788f63dcf0a0 550 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 551 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 552 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 553 }
metin.ozkan@analog.com 0:788f63dcf0a0 554
metin.ozkan@analog.com 0:788f63dcf0a0 555 *intm = (intm_t)reg_intm_glbl0.bits.dod0_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 556
metin.ozkan@analog.com 0:788f63dcf0a0 557 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 558 }
metin.ozkan@analog.com 0:788f63dcf0a0 559
metin.ozkan@analog.com 0:788f63dcf0a0 560 int MAX77654::SetDropout1RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 561 {
metin.ozkan@analog.com 0:788f63dcf0a0 562 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 563
metin.ozkan@analog.com 0:788f63dcf0a0 564 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.dod1_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 565
metin.ozkan@analog.com 0:788f63dcf0a0 566 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 567 }
metin.ozkan@analog.com 0:788f63dcf0a0 568
metin.ozkan@analog.com 0:788f63dcf0a0 569 int MAX77654::GetDropout1RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 570 {
metin.ozkan@analog.com 0:788f63dcf0a0 571 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 572 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 573
metin.ozkan@analog.com 0:788f63dcf0a0 574 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 575 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 576 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 577 }
metin.ozkan@analog.com 0:788f63dcf0a0 578
metin.ozkan@analog.com 0:788f63dcf0a0 579 *intm = (intm_t)reg_intm_glbl0.bits.dod1_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 580
metin.ozkan@analog.com 0:788f63dcf0a0 581 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 582 }
metin.ozkan@analog.com 0:788f63dcf0a0 583
metin.ozkan@analog.com 0:788f63dcf0a0 584 int MAX77654::SetThermalAlarm2RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 585 {
metin.ozkan@analog.com 0:788f63dcf0a0 586 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 587
metin.ozkan@analog.com 0:788f63dcf0a0 588 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.tjal2_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 589
metin.ozkan@analog.com 0:788f63dcf0a0 590 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 591 }
metin.ozkan@analog.com 0:788f63dcf0a0 592
metin.ozkan@analog.com 0:788f63dcf0a0 593 int MAX77654::GetThermalAlarm2RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 594 {
metin.ozkan@analog.com 0:788f63dcf0a0 595 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 596 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 597
metin.ozkan@analog.com 0:788f63dcf0a0 598 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 599 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 600 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 601 }
metin.ozkan@analog.com 0:788f63dcf0a0 602
metin.ozkan@analog.com 0:788f63dcf0a0 603 *intm = (intm_t)reg_intm_glbl0.bits.tjal2_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 604
metin.ozkan@analog.com 0:788f63dcf0a0 605 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 606 }
metin.ozkan@analog.com 0:788f63dcf0a0 607
metin.ozkan@analog.com 0:788f63dcf0a0 608 int MAX77654::SetThermalAlarm1RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 609 {
metin.ozkan@analog.com 0:788f63dcf0a0 610 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 611
metin.ozkan@analog.com 0:788f63dcf0a0 612 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.tjal1_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 613
metin.ozkan@analog.com 0:788f63dcf0a0 614 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 615 }
metin.ozkan@analog.com 0:788f63dcf0a0 616
metin.ozkan@analog.com 0:788f63dcf0a0 617 int MAX77654::GetThermalAlarm1RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 618 {
metin.ozkan@analog.com 0:788f63dcf0a0 619 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 620 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 621
metin.ozkan@analog.com 0:788f63dcf0a0 622 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 623 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 624 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 625 }
metin.ozkan@analog.com 0:788f63dcf0a0 626
metin.ozkan@analog.com 0:788f63dcf0a0 627 *intm = (intm_t)reg_intm_glbl0.bits.tjal1_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 628
metin.ozkan@analog.com 0:788f63dcf0a0 629 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 630 }
metin.ozkan@analog.com 0:788f63dcf0a0 631
metin.ozkan@analog.com 0:788f63dcf0a0 632 int MAX77654::SetnENRisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 633 {
metin.ozkan@analog.com 0:788f63dcf0a0 634 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 635
metin.ozkan@analog.com 0:788f63dcf0a0 636 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.nen_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 637
metin.ozkan@analog.com 0:788f63dcf0a0 638 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 639 }
metin.ozkan@analog.com 0:788f63dcf0a0 640
metin.ozkan@analog.com 0:788f63dcf0a0 641 int MAX77654::GetnENRisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 642 {
metin.ozkan@analog.com 0:788f63dcf0a0 643 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 644 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 645
metin.ozkan@analog.com 0:788f63dcf0a0 646 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 647 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 648 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 649 }
metin.ozkan@analog.com 0:788f63dcf0a0 650
metin.ozkan@analog.com 0:788f63dcf0a0 651 *intm = (intm_t)reg_intm_glbl0.bits.nen_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 652
metin.ozkan@analog.com 0:788f63dcf0a0 653 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 654 }
metin.ozkan@analog.com 0:788f63dcf0a0 655
metin.ozkan@analog.com 0:788f63dcf0a0 656 int MAX77654::SetnENFallingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 657 {
metin.ozkan@analog.com 0:788f63dcf0a0 658 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 659
metin.ozkan@analog.com 0:788f63dcf0a0 660 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.nen_fm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 661
metin.ozkan@analog.com 0:788f63dcf0a0 662 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 663 }
metin.ozkan@analog.com 0:788f63dcf0a0 664
metin.ozkan@analog.com 0:788f63dcf0a0 665 int MAX77654::GetnENFallingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 666 {
metin.ozkan@analog.com 0:788f63dcf0a0 667 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 668 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 669
metin.ozkan@analog.com 0:788f63dcf0a0 670 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 671 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 672 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 673 }
metin.ozkan@analog.com 0:788f63dcf0a0 674
metin.ozkan@analog.com 0:788f63dcf0a0 675 *intm = (intm_t)reg_intm_glbl0.bits.nen_fm;
metin.ozkan@analog.com 0:788f63dcf0a0 676
metin.ozkan@analog.com 0:788f63dcf0a0 677 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 678 }
metin.ozkan@analog.com 0:788f63dcf0a0 679
metin.ozkan@analog.com 0:788f63dcf0a0 680 int MAX77654::SetGPI0RisingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 681 {
metin.ozkan@analog.com 0:788f63dcf0a0 682 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 683
metin.ozkan@analog.com 0:788f63dcf0a0 684 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.gpi0_rm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 685
metin.ozkan@analog.com 0:788f63dcf0a0 686 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 687 }
metin.ozkan@analog.com 0:788f63dcf0a0 688
metin.ozkan@analog.com 0:788f63dcf0a0 689 int MAX77654::GetGPI0RisingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 690 {
metin.ozkan@analog.com 0:788f63dcf0a0 691 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 692 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 693
metin.ozkan@analog.com 0:788f63dcf0a0 694 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 695 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 696 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 697 }
metin.ozkan@analog.com 0:788f63dcf0a0 698
metin.ozkan@analog.com 0:788f63dcf0a0 699 *intm = (intm_t)reg_intm_glbl0.bits.gpi0_rm;
metin.ozkan@analog.com 0:788f63dcf0a0 700
metin.ozkan@analog.com 0:788f63dcf0a0 701 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 702 }
metin.ozkan@analog.com 0:788f63dcf0a0 703
metin.ozkan@analog.com 0:788f63dcf0a0 704 int MAX77654::SetGPI0FallingInterruptMask(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 705 {
metin.ozkan@analog.com 0:788f63dcf0a0 706 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 707
metin.ozkan@analog.com 0:788f63dcf0a0 708 SET_BIT_FIELD(INTM_GLBL0, reg_intm_glbl0, reg_intm_glbl0.bits.gpi0_fm, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 709
metin.ozkan@analog.com 0:788f63dcf0a0 710 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 711 }
metin.ozkan@analog.com 0:788f63dcf0a0 712
metin.ozkan@analog.com 0:788f63dcf0a0 713 int MAX77654::GetGPI0FallingInterruptMask(intm_t* intm)
metin.ozkan@analog.com 0:788f63dcf0a0 714 {
metin.ozkan@analog.com 0:788f63dcf0a0 715 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 716 reg_intm_glbl0_t reg_intm_glbl0;
metin.ozkan@analog.com 0:788f63dcf0a0 717
metin.ozkan@analog.com 0:788f63dcf0a0 718 ret = read_register(INTM_GLBL0, (uint8_t *)&(reg_intm_glbl0));
metin.ozkan@analog.com 0:788f63dcf0a0 719 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 720 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 721 }
metin.ozkan@analog.com 0:788f63dcf0a0 722
metin.ozkan@analog.com 0:788f63dcf0a0 723 *intm = (intm_t)reg_intm_glbl0.bits.gpi0_fm;
metin.ozkan@analog.com 0:788f63dcf0a0 724
metin.ozkan@analog.com 0:788f63dcf0a0 725 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 726 }
metin.ozkan@analog.com 0:788f63dcf0a0 727
metin.ozkan@analog.com 0:788f63dcf0a0 728 int MAX77654::SetnENInternalPullupResistor(pu_dis_t pu_dis)
metin.ozkan@analog.com 0:788f63dcf0a0 729 {
metin.ozkan@analog.com 0:788f63dcf0a0 730 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 731
metin.ozkan@analog.com 0:788f63dcf0a0 732 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.pu_dis, pu_dis);
metin.ozkan@analog.com 0:788f63dcf0a0 733
metin.ozkan@analog.com 0:788f63dcf0a0 734 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 735 }
metin.ozkan@analog.com 0:788f63dcf0a0 736
metin.ozkan@analog.com 0:788f63dcf0a0 737 int MAX77654::GetnENInternalPullupResistor(pu_dis_t* pu_dis)
metin.ozkan@analog.com 0:788f63dcf0a0 738 {
metin.ozkan@analog.com 0:788f63dcf0a0 739 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 740 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 741
metin.ozkan@analog.com 0:788f63dcf0a0 742 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 743 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 744 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 745 }
metin.ozkan@analog.com 0:788f63dcf0a0 746
metin.ozkan@analog.com 0:788f63dcf0a0 747 *pu_dis = (pu_dis_t)reg_cnfg_glbl.bits.pu_dis;
metin.ozkan@analog.com 0:788f63dcf0a0 748
metin.ozkan@analog.com 0:788f63dcf0a0 749 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 750 }
metin.ozkan@analog.com 0:788f63dcf0a0 751
metin.ozkan@analog.com 0:788f63dcf0a0 752 int MAX77654::SetManualResetTime(t_mrst_t t_mrst)
metin.ozkan@analog.com 0:788f63dcf0a0 753 {
metin.ozkan@analog.com 0:788f63dcf0a0 754 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 755
metin.ozkan@analog.com 0:788f63dcf0a0 756 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.t_mrst, t_mrst);
metin.ozkan@analog.com 0:788f63dcf0a0 757
metin.ozkan@analog.com 0:788f63dcf0a0 758 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 759 }
metin.ozkan@analog.com 0:788f63dcf0a0 760
metin.ozkan@analog.com 0:788f63dcf0a0 761 int MAX77654::GetManualResetTime(t_mrst_t* t_mrst)
metin.ozkan@analog.com 0:788f63dcf0a0 762 {
metin.ozkan@analog.com 0:788f63dcf0a0 763 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 764 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 765
metin.ozkan@analog.com 0:788f63dcf0a0 766 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 767 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 768 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 769 }
metin.ozkan@analog.com 0:788f63dcf0a0 770
metin.ozkan@analog.com 0:788f63dcf0a0 771 *t_mrst = (t_mrst_t)reg_cnfg_glbl.bits.t_mrst;
metin.ozkan@analog.com 0:788f63dcf0a0 772
metin.ozkan@analog.com 0:788f63dcf0a0 773 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 774 }
metin.ozkan@analog.com 0:788f63dcf0a0 775
metin.ozkan@analog.com 0:788f63dcf0a0 776 int MAX77654::SetMainBiasLowerPowerModeReq(sbia_lpm_t sbia_lpm)
metin.ozkan@analog.com 0:788f63dcf0a0 777 {
metin.ozkan@analog.com 0:788f63dcf0a0 778 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 779
metin.ozkan@analog.com 0:788f63dcf0a0 780 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.sbia_lpm, sbia_lpm);
metin.ozkan@analog.com 0:788f63dcf0a0 781
metin.ozkan@analog.com 0:788f63dcf0a0 782 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 783 }
metin.ozkan@analog.com 0:788f63dcf0a0 784
metin.ozkan@analog.com 0:788f63dcf0a0 785 int MAX77654::GetMainBiasLowerPowerModeReq(sbia_lpm_t* sbia_lpm)
metin.ozkan@analog.com 0:788f63dcf0a0 786 {
metin.ozkan@analog.com 0:788f63dcf0a0 787 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 788 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 789
metin.ozkan@analog.com 0:788f63dcf0a0 790 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 791 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 792 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 793 }
metin.ozkan@analog.com 0:788f63dcf0a0 794
metin.ozkan@analog.com 0:788f63dcf0a0 795 *sbia_lpm = (sbia_lpm_t)reg_cnfg_glbl.bits.sbia_lpm;
metin.ozkan@analog.com 0:788f63dcf0a0 796
metin.ozkan@analog.com 0:788f63dcf0a0 797 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 798 }
metin.ozkan@analog.com 0:788f63dcf0a0 799
metin.ozkan@analog.com 0:788f63dcf0a0 800 int MAX77654::SetMainBiasEnableReq(sbia_en_t sbia_en)
metin.ozkan@analog.com 0:788f63dcf0a0 801 {
metin.ozkan@analog.com 0:788f63dcf0a0 802 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 803
metin.ozkan@analog.com 0:788f63dcf0a0 804 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.sbia_en, sbia_en);
metin.ozkan@analog.com 0:788f63dcf0a0 805
metin.ozkan@analog.com 0:788f63dcf0a0 806 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 807 }
metin.ozkan@analog.com 0:788f63dcf0a0 808
metin.ozkan@analog.com 0:788f63dcf0a0 809 int MAX77654::GetMainBiasEnableReq(sbia_en_t* sbia_en)
metin.ozkan@analog.com 0:788f63dcf0a0 810 {
metin.ozkan@analog.com 0:788f63dcf0a0 811 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 812 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 813
metin.ozkan@analog.com 0:788f63dcf0a0 814 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 815 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 816 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 817 }
metin.ozkan@analog.com 0:788f63dcf0a0 818
metin.ozkan@analog.com 0:788f63dcf0a0 819 *sbia_en = (sbia_en_t)reg_cnfg_glbl.bits.sbia_en;
metin.ozkan@analog.com 0:788f63dcf0a0 820
metin.ozkan@analog.com 0:788f63dcf0a0 821 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 822 }
metin.ozkan@analog.com 0:788f63dcf0a0 823
metin.ozkan@analog.com 0:788f63dcf0a0 824 int MAX77654::SetnEnInputMode(nen_mode_t nen_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 825 {
metin.ozkan@analog.com 0:788f63dcf0a0 826 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 827
metin.ozkan@analog.com 0:788f63dcf0a0 828 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.nen_mode, nen_mode);
metin.ozkan@analog.com 0:788f63dcf0a0 829
metin.ozkan@analog.com 0:788f63dcf0a0 830 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 831 }
metin.ozkan@analog.com 0:788f63dcf0a0 832
metin.ozkan@analog.com 0:788f63dcf0a0 833 int MAX77654::GetnEnInputMode(nen_mode_t* nen_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 834 {
metin.ozkan@analog.com 0:788f63dcf0a0 835 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 836 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 837
metin.ozkan@analog.com 0:788f63dcf0a0 838 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 839 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 840 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 841 }
metin.ozkan@analog.com 0:788f63dcf0a0 842
metin.ozkan@analog.com 0:788f63dcf0a0 843 *nen_mode = (nen_mode_t)reg_cnfg_glbl.bits.nen_mode;
metin.ozkan@analog.com 0:788f63dcf0a0 844
metin.ozkan@analog.com 0:788f63dcf0a0 845 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 846 }
metin.ozkan@analog.com 0:788f63dcf0a0 847
metin.ozkan@analog.com 0:788f63dcf0a0 848 int MAX77654::SetDebounceTimerEnable(dben_nen_t dben_nen)
metin.ozkan@analog.com 0:788f63dcf0a0 849 {
metin.ozkan@analog.com 0:788f63dcf0a0 850 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 851
metin.ozkan@analog.com 0:788f63dcf0a0 852 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.dben_nen, dben_nen);
metin.ozkan@analog.com 0:788f63dcf0a0 853
metin.ozkan@analog.com 0:788f63dcf0a0 854 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 855 }
metin.ozkan@analog.com 0:788f63dcf0a0 856
metin.ozkan@analog.com 0:788f63dcf0a0 857 int MAX77654::GetDebounceTimerEnable(dben_nen_t* dben_nen)
metin.ozkan@analog.com 0:788f63dcf0a0 858 {
metin.ozkan@analog.com 0:788f63dcf0a0 859 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 860 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 861
metin.ozkan@analog.com 0:788f63dcf0a0 862 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 863 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 864 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 865 }
metin.ozkan@analog.com 0:788f63dcf0a0 866
metin.ozkan@analog.com 0:788f63dcf0a0 867 *dben_nen = (dben_nen_t)reg_cnfg_glbl.bits.dben_nen;
metin.ozkan@analog.com 0:788f63dcf0a0 868
metin.ozkan@analog.com 0:788f63dcf0a0 869 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 870 }
metin.ozkan@analog.com 0:788f63dcf0a0 871
metin.ozkan@analog.com 0:788f63dcf0a0 872 int MAX77654::SetSoftwareResetFunctions(sft_ctrl_t sft_ctrl)
metin.ozkan@analog.com 0:788f63dcf0a0 873 {
metin.ozkan@analog.com 0:788f63dcf0a0 874 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 875
metin.ozkan@analog.com 0:788f63dcf0a0 876 SET_BIT_FIELD(CNFG_GLBL, reg_cnfg_glbl, reg_cnfg_glbl.bits.sft_ctrl, sft_ctrl);
metin.ozkan@analog.com 0:788f63dcf0a0 877
metin.ozkan@analog.com 0:788f63dcf0a0 878 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 879 }
metin.ozkan@analog.com 0:788f63dcf0a0 880
metin.ozkan@analog.com 0:788f63dcf0a0 881 int MAX77654::GetSoftwareResetFunctions(sft_ctrl_t* sft_ctrl)
metin.ozkan@analog.com 0:788f63dcf0a0 882 {
metin.ozkan@analog.com 0:788f63dcf0a0 883 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 884 reg_cnfg_glbl_t reg_cnfg_glbl;
metin.ozkan@analog.com 0:788f63dcf0a0 885
metin.ozkan@analog.com 0:788f63dcf0a0 886 ret = read_register(CNFG_GLBL, (uint8_t *)&(reg_cnfg_glbl));
metin.ozkan@analog.com 0:788f63dcf0a0 887 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 888 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 889 }
metin.ozkan@analog.com 0:788f63dcf0a0 890
metin.ozkan@analog.com 0:788f63dcf0a0 891 *sft_ctrl = (sft_ctrl_t)reg_cnfg_glbl.bits.sft_ctrl;
metin.ozkan@analog.com 0:788f63dcf0a0 892
metin.ozkan@analog.com 0:788f63dcf0a0 893 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 894 }
metin.ozkan@analog.com 0:788f63dcf0a0 895
metin.ozkan@analog.com 0:788f63dcf0a0 896 int MAX77654::SetAlternateModeEnable(uint8_t channel, alt_gpio_t alt_gpio)
metin.ozkan@analog.com 0:788f63dcf0a0 897 {
metin.ozkan@analog.com 0:788f63dcf0a0 898 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 899 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 900 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.alt_gpio0, alt_gpio);
metin.ozkan@analog.com 0:788f63dcf0a0 901 }
metin.ozkan@analog.com 0:788f63dcf0a0 902 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 903 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 904 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.alt_gpio1, alt_gpio);
metin.ozkan@analog.com 0:788f63dcf0a0 905 }
metin.ozkan@analog.com 0:788f63dcf0a0 906 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 907 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 908 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.alt_gpio2, alt_gpio);
metin.ozkan@analog.com 0:788f63dcf0a0 909 }
metin.ozkan@analog.com 0:788f63dcf0a0 910 else {
metin.ozkan@analog.com 0:788f63dcf0a0 911 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 912 }
metin.ozkan@analog.com 0:788f63dcf0a0 913
metin.ozkan@analog.com 0:788f63dcf0a0 914 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 915 }
metin.ozkan@analog.com 0:788f63dcf0a0 916
metin.ozkan@analog.com 0:788f63dcf0a0 917 int MAX77654::GetAlternateModeEnable(uint8_t channel, alt_gpio_t* alt_gpio)
metin.ozkan@analog.com 0:788f63dcf0a0 918 {
metin.ozkan@analog.com 0:788f63dcf0a0 919 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 920
metin.ozkan@analog.com 0:788f63dcf0a0 921 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 922 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 923 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 924 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 925 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 926 }
metin.ozkan@analog.com 0:788f63dcf0a0 927
metin.ozkan@analog.com 0:788f63dcf0a0 928 *alt_gpio = (alt_gpio_t)reg_cnfg_gpio0.bits.alt_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 929 }
metin.ozkan@analog.com 0:788f63dcf0a0 930 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 931 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 932 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 933 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 934 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 935 }
metin.ozkan@analog.com 0:788f63dcf0a0 936
metin.ozkan@analog.com 0:788f63dcf0a0 937 *alt_gpio = (alt_gpio_t)reg_cnfg_gpio1.bits.alt_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 938 }
metin.ozkan@analog.com 0:788f63dcf0a0 939 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 940 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 941 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 942 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 943 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 944 }
metin.ozkan@analog.com 0:788f63dcf0a0 945
metin.ozkan@analog.com 0:788f63dcf0a0 946 *alt_gpio = (alt_gpio_t)reg_cnfg_gpio2.bits.alt_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 947 }
metin.ozkan@analog.com 0:788f63dcf0a0 948 else {
metin.ozkan@analog.com 0:788f63dcf0a0 949 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 950 }
metin.ozkan@analog.com 0:788f63dcf0a0 951
metin.ozkan@analog.com 0:788f63dcf0a0 952 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 953 }
metin.ozkan@analog.com 0:788f63dcf0a0 954
metin.ozkan@analog.com 0:788f63dcf0a0 955 int MAX77654::SetGPIDebounceTimerEnable(uint8_t channel, dben_gpi_t dben_gpi)
metin.ozkan@analog.com 0:788f63dcf0a0 956 {
metin.ozkan@analog.com 0:788f63dcf0a0 957 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 958 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 959 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.dben_gpi, dben_gpi);
metin.ozkan@analog.com 0:788f63dcf0a0 960 }
metin.ozkan@analog.com 0:788f63dcf0a0 961 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 962 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 963 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.dben_gpi, dben_gpi);
metin.ozkan@analog.com 0:788f63dcf0a0 964 }
metin.ozkan@analog.com 0:788f63dcf0a0 965 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 966 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 967 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.dben_gpi, dben_gpi);
metin.ozkan@analog.com 0:788f63dcf0a0 968 }
metin.ozkan@analog.com 0:788f63dcf0a0 969 else {
metin.ozkan@analog.com 0:788f63dcf0a0 970 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 971 }
metin.ozkan@analog.com 0:788f63dcf0a0 972
metin.ozkan@analog.com 0:788f63dcf0a0 973 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 974 }
metin.ozkan@analog.com 0:788f63dcf0a0 975
metin.ozkan@analog.com 0:788f63dcf0a0 976 int MAX77654::GetGPIDebounceTimerEnable(uint8_t channel, dben_gpi_t* dben_gpi)
metin.ozkan@analog.com 0:788f63dcf0a0 977 {
metin.ozkan@analog.com 0:788f63dcf0a0 978 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 979
metin.ozkan@analog.com 0:788f63dcf0a0 980 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 981 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 982 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 983 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 984 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 985 }
metin.ozkan@analog.com 0:788f63dcf0a0 986
metin.ozkan@analog.com 0:788f63dcf0a0 987 *dben_gpi = (dben_gpi_t)reg_cnfg_gpio0.bits.dben_gpi;
metin.ozkan@analog.com 0:788f63dcf0a0 988 }
metin.ozkan@analog.com 0:788f63dcf0a0 989 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 990 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 991 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 992 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 993 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 994 }
metin.ozkan@analog.com 0:788f63dcf0a0 995
metin.ozkan@analog.com 0:788f63dcf0a0 996 *dben_gpi = (dben_gpi_t)reg_cnfg_gpio1.bits.dben_gpi;
metin.ozkan@analog.com 0:788f63dcf0a0 997 }
metin.ozkan@analog.com 0:788f63dcf0a0 998 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 999 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1000 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 1001 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1002 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1003 }
metin.ozkan@analog.com 0:788f63dcf0a0 1004
metin.ozkan@analog.com 0:788f63dcf0a0 1005 *dben_gpi = (dben_gpi_t)reg_cnfg_gpio2.bits.dben_gpi;
metin.ozkan@analog.com 0:788f63dcf0a0 1006 }
metin.ozkan@analog.com 0:788f63dcf0a0 1007 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1008 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1009 }
metin.ozkan@analog.com 0:788f63dcf0a0 1010
metin.ozkan@analog.com 0:788f63dcf0a0 1011 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1012 }
metin.ozkan@analog.com 0:788f63dcf0a0 1013
metin.ozkan@analog.com 0:788f63dcf0a0 1014 int MAX77654::SetGPODataOutput(uint8_t channel, gpo_do_t gpo_do)
metin.ozkan@analog.com 0:788f63dcf0a0 1015 {
metin.ozkan@analog.com 0:788f63dcf0a0 1016
metin.ozkan@analog.com 0:788f63dcf0a0 1017 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1018 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1019 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.gpo_do, gpo_do);
metin.ozkan@analog.com 0:788f63dcf0a0 1020 }
metin.ozkan@analog.com 0:788f63dcf0a0 1021 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1022 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1023 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.gpo_do, gpo_do);
metin.ozkan@analog.com 0:788f63dcf0a0 1024 }
metin.ozkan@analog.com 0:788f63dcf0a0 1025 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1026 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1027 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.gpo_do, gpo_do);
metin.ozkan@analog.com 0:788f63dcf0a0 1028 }
metin.ozkan@analog.com 0:788f63dcf0a0 1029 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1030 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1031 }
metin.ozkan@analog.com 0:788f63dcf0a0 1032
metin.ozkan@analog.com 0:788f63dcf0a0 1033 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1034 }
metin.ozkan@analog.com 0:788f63dcf0a0 1035
metin.ozkan@analog.com 0:788f63dcf0a0 1036 int MAX77654::GetGPODataOutput(uint8_t channel, gpo_do_t *gpo_do)
metin.ozkan@analog.com 0:788f63dcf0a0 1037 {
metin.ozkan@analog.com 0:788f63dcf0a0 1038 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1039
metin.ozkan@analog.com 0:788f63dcf0a0 1040 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1041 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1042 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 1043 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1044 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1045 }
metin.ozkan@analog.com 0:788f63dcf0a0 1046
metin.ozkan@analog.com 0:788f63dcf0a0 1047 *gpo_do = (gpo_do_t)reg_cnfg_gpio0.bits.gpo_do;
metin.ozkan@analog.com 0:788f63dcf0a0 1048 }
metin.ozkan@analog.com 0:788f63dcf0a0 1049 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1050 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1051 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 1052 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1053 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1054 }
metin.ozkan@analog.com 0:788f63dcf0a0 1055
metin.ozkan@analog.com 0:788f63dcf0a0 1056 *gpo_do = (gpo_do_t)reg_cnfg_gpio1.bits.gpo_do;
metin.ozkan@analog.com 0:788f63dcf0a0 1057 }
metin.ozkan@analog.com 0:788f63dcf0a0 1058 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1059 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1060 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 1061 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1062 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1063 }
metin.ozkan@analog.com 0:788f63dcf0a0 1064
metin.ozkan@analog.com 0:788f63dcf0a0 1065 *gpo_do = (gpo_do_t)reg_cnfg_gpio2.bits.gpo_do;
metin.ozkan@analog.com 0:788f63dcf0a0 1066 }
metin.ozkan@analog.com 0:788f63dcf0a0 1067 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1068 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1069 }
metin.ozkan@analog.com 0:788f63dcf0a0 1070
metin.ozkan@analog.com 0:788f63dcf0a0 1071 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1072 }
metin.ozkan@analog.com 0:788f63dcf0a0 1073
metin.ozkan@analog.com 0:788f63dcf0a0 1074 int MAX77654::SetGPODriveType(uint8_t channel, gpo_drv_t gpo_drv)
metin.ozkan@analog.com 0:788f63dcf0a0 1075 {
metin.ozkan@analog.com 0:788f63dcf0a0 1076 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1077 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1078 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.gpo_drv, gpo_drv);
metin.ozkan@analog.com 0:788f63dcf0a0 1079 }
metin.ozkan@analog.com 0:788f63dcf0a0 1080 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1081 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1082 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.gpo_drv, gpo_drv);
metin.ozkan@analog.com 0:788f63dcf0a0 1083 }
metin.ozkan@analog.com 0:788f63dcf0a0 1084 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1085 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1086 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.gpo_drv, gpo_drv);
metin.ozkan@analog.com 0:788f63dcf0a0 1087 }
metin.ozkan@analog.com 0:788f63dcf0a0 1088 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1089 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1090 }
metin.ozkan@analog.com 0:788f63dcf0a0 1091
metin.ozkan@analog.com 0:788f63dcf0a0 1092 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1093 }
metin.ozkan@analog.com 0:788f63dcf0a0 1094
metin.ozkan@analog.com 0:788f63dcf0a0 1095 int MAX77654::GetGPODriveType(uint8_t channel, gpo_drv_t *gpo_drv)
metin.ozkan@analog.com 0:788f63dcf0a0 1096 {
metin.ozkan@analog.com 0:788f63dcf0a0 1097 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1098
metin.ozkan@analog.com 0:788f63dcf0a0 1099 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1100 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1101 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 1102 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1103 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1104 }
metin.ozkan@analog.com 0:788f63dcf0a0 1105
metin.ozkan@analog.com 0:788f63dcf0a0 1106 *gpo_drv = (gpo_drv_t)reg_cnfg_gpio0.bits.gpo_drv;
metin.ozkan@analog.com 0:788f63dcf0a0 1107 }
metin.ozkan@analog.com 0:788f63dcf0a0 1108 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1109 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1110 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 1111 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1112 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1113 }
metin.ozkan@analog.com 0:788f63dcf0a0 1114
metin.ozkan@analog.com 0:788f63dcf0a0 1115 *gpo_drv = (gpo_drv_t)reg_cnfg_gpio1.bits.gpo_drv;
metin.ozkan@analog.com 0:788f63dcf0a0 1116 }
metin.ozkan@analog.com 0:788f63dcf0a0 1117 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1118 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1119 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 1120 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1121 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1122 }
metin.ozkan@analog.com 0:788f63dcf0a0 1123
metin.ozkan@analog.com 0:788f63dcf0a0 1124 *gpo_drv = (gpo_drv_t)reg_cnfg_gpio2.bits.gpo_drv;
metin.ozkan@analog.com 0:788f63dcf0a0 1125 }
metin.ozkan@analog.com 0:788f63dcf0a0 1126 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1127 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1128 }
metin.ozkan@analog.com 0:788f63dcf0a0 1129
metin.ozkan@analog.com 0:788f63dcf0a0 1130 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1131 }
metin.ozkan@analog.com 0:788f63dcf0a0 1132
metin.ozkan@analog.com 0:788f63dcf0a0 1133 int MAX77654::SetGPIOInputValue(uint8_t channel, gpo_di_t gpo_di)
metin.ozkan@analog.com 0:788f63dcf0a0 1134 {
metin.ozkan@analog.com 0:788f63dcf0a0 1135 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1136 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1137 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.gpo_di, gpo_di);
metin.ozkan@analog.com 0:788f63dcf0a0 1138 }
metin.ozkan@analog.com 0:788f63dcf0a0 1139 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1140 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1141 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.gpo_di, gpo_di);
metin.ozkan@analog.com 0:788f63dcf0a0 1142 }
metin.ozkan@analog.com 0:788f63dcf0a0 1143 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1144 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1145 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.gpo_di, gpo_di);
metin.ozkan@analog.com 0:788f63dcf0a0 1146 }
metin.ozkan@analog.com 0:788f63dcf0a0 1147 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1148 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1149 }
metin.ozkan@analog.com 0:788f63dcf0a0 1150
metin.ozkan@analog.com 0:788f63dcf0a0 1151 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1152 }
metin.ozkan@analog.com 0:788f63dcf0a0 1153
metin.ozkan@analog.com 0:788f63dcf0a0 1154 int MAX77654::GetGPIOInputValue(uint8_t channel, gpo_di_t *gpo_di)
metin.ozkan@analog.com 0:788f63dcf0a0 1155 {
metin.ozkan@analog.com 0:788f63dcf0a0 1156 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1157
metin.ozkan@analog.com 0:788f63dcf0a0 1158 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1159 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1160 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 1161 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1162 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1163 }
metin.ozkan@analog.com 0:788f63dcf0a0 1164
metin.ozkan@analog.com 0:788f63dcf0a0 1165 *gpo_di = (gpo_di_t)reg_cnfg_gpio0.bits.gpo_di;
metin.ozkan@analog.com 0:788f63dcf0a0 1166 }
metin.ozkan@analog.com 0:788f63dcf0a0 1167 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1168 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1169 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 1170 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1171 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1172 }
metin.ozkan@analog.com 0:788f63dcf0a0 1173
metin.ozkan@analog.com 0:788f63dcf0a0 1174 *gpo_di = (gpo_di_t)reg_cnfg_gpio1.bits.gpo_di;
metin.ozkan@analog.com 0:788f63dcf0a0 1175 }
metin.ozkan@analog.com 0:788f63dcf0a0 1176 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1177 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1178 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 1179 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1180 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1181 }
metin.ozkan@analog.com 0:788f63dcf0a0 1182
metin.ozkan@analog.com 0:788f63dcf0a0 1183 *gpo_di = (gpo_di_t)reg_cnfg_gpio2.bits.gpo_di;
metin.ozkan@analog.com 0:788f63dcf0a0 1184 }
metin.ozkan@analog.com 0:788f63dcf0a0 1185 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1186 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1187 }
metin.ozkan@analog.com 0:788f63dcf0a0 1188
metin.ozkan@analog.com 0:788f63dcf0a0 1189 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1190 }
metin.ozkan@analog.com 0:788f63dcf0a0 1191
metin.ozkan@analog.com 0:788f63dcf0a0 1192 int MAX77654::SetGPIODirection(uint8_t channel, gpo_dir_t gpo_dir)
metin.ozkan@analog.com 0:788f63dcf0a0 1193 {
metin.ozkan@analog.com 0:788f63dcf0a0 1194 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1195 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1196 SET_BIT_FIELD(CNFG_GPIO0, reg_cnfg_gpio0, reg_cnfg_gpio0.bits.gpo_dir, gpo_dir);
metin.ozkan@analog.com 0:788f63dcf0a0 1197 }
metin.ozkan@analog.com 0:788f63dcf0a0 1198 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1199 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1200 SET_BIT_FIELD(CNFG_GPIO1, reg_cnfg_gpio1, reg_cnfg_gpio1.bits.gpo_dir, gpo_dir);
metin.ozkan@analog.com 0:788f63dcf0a0 1201 }
metin.ozkan@analog.com 0:788f63dcf0a0 1202 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1203 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1204 SET_BIT_FIELD(CNFG_GPIO2, reg_cnfg_gpio2, reg_cnfg_gpio2.bits.gpo_dir, gpo_dir);
metin.ozkan@analog.com 0:788f63dcf0a0 1205 }
metin.ozkan@analog.com 0:788f63dcf0a0 1206 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1207 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1208 }
metin.ozkan@analog.com 0:788f63dcf0a0 1209
metin.ozkan@analog.com 0:788f63dcf0a0 1210 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1211 }
metin.ozkan@analog.com 0:788f63dcf0a0 1212
metin.ozkan@analog.com 0:788f63dcf0a0 1213 int MAX77654::GetGPIODirection(uint8_t channel, gpo_dir_t *gpo_dir)
metin.ozkan@analog.com 0:788f63dcf0a0 1214 {
metin.ozkan@analog.com 0:788f63dcf0a0 1215 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1216
metin.ozkan@analog.com 0:788f63dcf0a0 1217 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 1218 reg_cnfg_gpio0_t reg_cnfg_gpio0;
metin.ozkan@analog.com 0:788f63dcf0a0 1219 ret = read_register(CNFG_GPIO0, (uint8_t *)&(reg_cnfg_gpio0));
metin.ozkan@analog.com 0:788f63dcf0a0 1220 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1221 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1222 }
metin.ozkan@analog.com 0:788f63dcf0a0 1223
metin.ozkan@analog.com 0:788f63dcf0a0 1224 *gpo_dir = (gpo_dir_t)reg_cnfg_gpio0.bits.gpo_dir;
metin.ozkan@analog.com 0:788f63dcf0a0 1225 }
metin.ozkan@analog.com 0:788f63dcf0a0 1226 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 1227 reg_cnfg_gpio1_t reg_cnfg_gpio1;
metin.ozkan@analog.com 0:788f63dcf0a0 1228 ret = read_register(CNFG_GPIO1, (uint8_t *)&(reg_cnfg_gpio1));
metin.ozkan@analog.com 0:788f63dcf0a0 1229 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1230 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1231 }
metin.ozkan@analog.com 0:788f63dcf0a0 1232
metin.ozkan@analog.com 0:788f63dcf0a0 1233 *gpo_dir = (gpo_dir_t)reg_cnfg_gpio1.bits.gpo_dir;
metin.ozkan@analog.com 0:788f63dcf0a0 1234 }
metin.ozkan@analog.com 0:788f63dcf0a0 1235 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 1236 reg_cnfg_gpio2_t reg_cnfg_gpio2;
metin.ozkan@analog.com 0:788f63dcf0a0 1237 ret = read_register(CNFG_GPIO2, (uint8_t *)&(reg_cnfg_gpio2));
metin.ozkan@analog.com 0:788f63dcf0a0 1238 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1239 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1240 }
metin.ozkan@analog.com 0:788f63dcf0a0 1241
metin.ozkan@analog.com 0:788f63dcf0a0 1242 *gpo_dir = (gpo_dir_t)reg_cnfg_gpio2.bits.gpo_dir;
metin.ozkan@analog.com 0:788f63dcf0a0 1243 }
metin.ozkan@analog.com 0:788f63dcf0a0 1244 else {
metin.ozkan@analog.com 0:788f63dcf0a0 1245 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 1246 }
metin.ozkan@analog.com 0:788f63dcf0a0 1247
metin.ozkan@analog.com 0:788f63dcf0a0 1248 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1249 }
metin.ozkan@analog.com 0:788f63dcf0a0 1250
metin.ozkan@analog.com 0:788f63dcf0a0 1251 int MAX77654::GetCID(void) {
metin.ozkan@analog.com 0:788f63dcf0a0 1252 char rbuf[1];
metin.ozkan@analog.com 0:788f63dcf0a0 1253 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1254
metin.ozkan@analog.com 0:788f63dcf0a0 1255 ret = read_register(CID, (uint8_t *)&(rbuf));
metin.ozkan@analog.com 0:788f63dcf0a0 1256 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1257 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1258 }
metin.ozkan@analog.com 0:788f63dcf0a0 1259
metin.ozkan@analog.com 0:788f63dcf0a0 1260 return *rbuf;
metin.ozkan@analog.com 0:788f63dcf0a0 1261 }
metin.ozkan@analog.com 0:788f63dcf0a0 1262
metin.ozkan@analog.com 0:788f63dcf0a0 1263 int MAX77654::SetWatchdogTimerPeriod(wdt_per_t wdt_per)
metin.ozkan@analog.com 0:788f63dcf0a0 1264 {
metin.ozkan@analog.com 0:788f63dcf0a0 1265 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1266
metin.ozkan@analog.com 0:788f63dcf0a0 1267 SET_BIT_FIELD(CNFG_WDT, reg_cnfg_wdt, reg_cnfg_wdt.bits.wdt_per, wdt_per);
metin.ozkan@analog.com 0:788f63dcf0a0 1268
metin.ozkan@analog.com 0:788f63dcf0a0 1269 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1270 }
metin.ozkan@analog.com 0:788f63dcf0a0 1271
metin.ozkan@analog.com 0:788f63dcf0a0 1272 int MAX77654::GetWatchdogTimerPeriod(wdt_per_t *wdt_per)
metin.ozkan@analog.com 0:788f63dcf0a0 1273 {
metin.ozkan@analog.com 0:788f63dcf0a0 1274 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1275 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1276
metin.ozkan@analog.com 0:788f63dcf0a0 1277 ret = read_register(CNFG_WDT, (uint8_t *)&(reg_cnfg_wdt));
metin.ozkan@analog.com 0:788f63dcf0a0 1278 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1279 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1280 }
metin.ozkan@analog.com 0:788f63dcf0a0 1281
metin.ozkan@analog.com 0:788f63dcf0a0 1282 *wdt_per = (wdt_per_t)reg_cnfg_wdt.bits.wdt_per;
metin.ozkan@analog.com 0:788f63dcf0a0 1283
metin.ozkan@analog.com 0:788f63dcf0a0 1284 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1285 }
metin.ozkan@analog.com 0:788f63dcf0a0 1286
metin.ozkan@analog.com 0:788f63dcf0a0 1287 int MAX77654::SetWatchdogTimerExpiredAction(wdt_mode_t wdt_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 1288 {
metin.ozkan@analog.com 0:788f63dcf0a0 1289 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1290
metin.ozkan@analog.com 0:788f63dcf0a0 1291 SET_BIT_FIELD(CNFG_WDT, reg_cnfg_wdt, reg_cnfg_wdt.bits.wdt_mode, wdt_mode);
metin.ozkan@analog.com 0:788f63dcf0a0 1292
metin.ozkan@analog.com 0:788f63dcf0a0 1293 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1294 }
metin.ozkan@analog.com 0:788f63dcf0a0 1295
metin.ozkan@analog.com 0:788f63dcf0a0 1296 int MAX77654::GetWatchdogTimerExpiredAction(wdt_mode_t *wdt_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 1297 {
metin.ozkan@analog.com 0:788f63dcf0a0 1298 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1299 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1300
metin.ozkan@analog.com 0:788f63dcf0a0 1301 ret = read_register(CNFG_WDT, (uint8_t *)&(reg_cnfg_wdt));
metin.ozkan@analog.com 0:788f63dcf0a0 1302 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1303 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1304 }
metin.ozkan@analog.com 0:788f63dcf0a0 1305
metin.ozkan@analog.com 0:788f63dcf0a0 1306 *wdt_mode = (wdt_mode_t)reg_cnfg_wdt.bits.wdt_mode;
metin.ozkan@analog.com 0:788f63dcf0a0 1307
metin.ozkan@analog.com 0:788f63dcf0a0 1308 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1309 }
metin.ozkan@analog.com 0:788f63dcf0a0 1310
metin.ozkan@analog.com 0:788f63dcf0a0 1311 int MAX77654::SetWatchdogTimerClearControl(wdt_clr_t wdt_clr)
metin.ozkan@analog.com 0:788f63dcf0a0 1312 {
metin.ozkan@analog.com 0:788f63dcf0a0 1313 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1314
metin.ozkan@analog.com 0:788f63dcf0a0 1315 SET_BIT_FIELD(CNFG_WDT, reg_cnfg_wdt, reg_cnfg_wdt.bits.wdt_clr, wdt_clr);
metin.ozkan@analog.com 0:788f63dcf0a0 1316
metin.ozkan@analog.com 0:788f63dcf0a0 1317 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1318 }
metin.ozkan@analog.com 0:788f63dcf0a0 1319
metin.ozkan@analog.com 0:788f63dcf0a0 1320 int MAX77654::GetWatchdogTimerClearControl(wdt_clr_t *wdt_clr)
metin.ozkan@analog.com 0:788f63dcf0a0 1321 {
metin.ozkan@analog.com 0:788f63dcf0a0 1322 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1323 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1324
metin.ozkan@analog.com 0:788f63dcf0a0 1325 ret = read_register(CNFG_WDT, (uint8_t *)&(reg_cnfg_wdt));
metin.ozkan@analog.com 0:788f63dcf0a0 1326 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1327 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1328 }
metin.ozkan@analog.com 0:788f63dcf0a0 1329
metin.ozkan@analog.com 0:788f63dcf0a0 1330 *wdt_clr = (wdt_clr_t)reg_cnfg_wdt.bits.wdt_clr;
metin.ozkan@analog.com 0:788f63dcf0a0 1331
metin.ozkan@analog.com 0:788f63dcf0a0 1332 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1333 }
metin.ozkan@analog.com 0:788f63dcf0a0 1334
metin.ozkan@analog.com 0:788f63dcf0a0 1335 int MAX77654::SetWatchdogTimerEnable(wdt_en_t wdt_en)
metin.ozkan@analog.com 0:788f63dcf0a0 1336 {
metin.ozkan@analog.com 0:788f63dcf0a0 1337 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1338
metin.ozkan@analog.com 0:788f63dcf0a0 1339 SET_BIT_FIELD(CNFG_WDT, reg_cnfg_wdt, reg_cnfg_wdt.bits.wdt_en, wdt_en);
metin.ozkan@analog.com 0:788f63dcf0a0 1340
metin.ozkan@analog.com 0:788f63dcf0a0 1341 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1342 }
metin.ozkan@analog.com 0:788f63dcf0a0 1343
metin.ozkan@analog.com 0:788f63dcf0a0 1344 int MAX77654::GetWatchdogTimerEnable(wdt_en_t *wdt_en)
metin.ozkan@analog.com 0:788f63dcf0a0 1345 {
metin.ozkan@analog.com 0:788f63dcf0a0 1346 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1347 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1348
metin.ozkan@analog.com 0:788f63dcf0a0 1349 ret = read_register(CNFG_WDT, (uint8_t *)&(reg_cnfg_wdt));
metin.ozkan@analog.com 0:788f63dcf0a0 1350 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1351 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1352 }
metin.ozkan@analog.com 0:788f63dcf0a0 1353
metin.ozkan@analog.com 0:788f63dcf0a0 1354 *wdt_en = (wdt_en_t)reg_cnfg_wdt.bits.wdt_en;
metin.ozkan@analog.com 0:788f63dcf0a0 1355
metin.ozkan@analog.com 0:788f63dcf0a0 1356 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1357 }
metin.ozkan@analog.com 0:788f63dcf0a0 1358
metin.ozkan@analog.com 0:788f63dcf0a0 1359 int MAX77654::SetFactorySetSafetyBit(wdt_lock_t wdt_lock)
metin.ozkan@analog.com 0:788f63dcf0a0 1360 {
metin.ozkan@analog.com 0:788f63dcf0a0 1361 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1362
metin.ozkan@analog.com 0:788f63dcf0a0 1363 SET_BIT_FIELD(CNFG_WDT, reg_cnfg_wdt, reg_cnfg_wdt.bits.wdt_lock, wdt_lock);
metin.ozkan@analog.com 0:788f63dcf0a0 1364
metin.ozkan@analog.com 0:788f63dcf0a0 1365 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1366 }
metin.ozkan@analog.com 0:788f63dcf0a0 1367
metin.ozkan@analog.com 0:788f63dcf0a0 1368 int MAX77654::GetFactorySetSafetyBit(wdt_lock_t *wdt_lock)
metin.ozkan@analog.com 0:788f63dcf0a0 1369 {
metin.ozkan@analog.com 0:788f63dcf0a0 1370 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1371 reg_cnfg_wdt_t reg_cnfg_wdt;
metin.ozkan@analog.com 0:788f63dcf0a0 1372
metin.ozkan@analog.com 0:788f63dcf0a0 1373 ret = read_register(CNFG_WDT, (uint8_t *)&(reg_cnfg_wdt));
metin.ozkan@analog.com 0:788f63dcf0a0 1374 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1375 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1376 }
metin.ozkan@analog.com 0:788f63dcf0a0 1377
metin.ozkan@analog.com 0:788f63dcf0a0 1378 *wdt_lock = (wdt_lock_t)reg_cnfg_wdt.bits.wdt_lock;
metin.ozkan@analog.com 0:788f63dcf0a0 1379
metin.ozkan@analog.com 0:788f63dcf0a0 1380 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1381 }
metin.ozkan@analog.com 0:788f63dcf0a0 1382
metin.ozkan@analog.com 0:788f63dcf0a0 1383 int MAX77654::GetMinimumVCHGINVoltageLoopStatus(stat_t *stat)
metin.ozkan@analog.com 0:788f63dcf0a0 1384 {
metin.ozkan@analog.com 0:788f63dcf0a0 1385 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1386 reg_stat_chg_a_t reg_stat_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1387
metin.ozkan@analog.com 0:788f63dcf0a0 1388 ret = read_register(STAT_CHG_A, (uint8_t *)&(reg_stat_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1389 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1390 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1391 }
metin.ozkan@analog.com 0:788f63dcf0a0 1392
metin.ozkan@analog.com 0:788f63dcf0a0 1393 *stat = (stat_t)reg_stat_chg_a.bits.vchgin_min_stat;
metin.ozkan@analog.com 0:788f63dcf0a0 1394
metin.ozkan@analog.com 0:788f63dcf0a0 1395 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1396 }
metin.ozkan@analog.com 0:788f63dcf0a0 1397
metin.ozkan@analog.com 0:788f63dcf0a0 1398 int MAX77654::GetCHGINCurrentLimitLoopStatus(stat_t *stat)
metin.ozkan@analog.com 0:788f63dcf0a0 1399 {
metin.ozkan@analog.com 0:788f63dcf0a0 1400 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1401 reg_stat_chg_a_t reg_stat_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1402
metin.ozkan@analog.com 0:788f63dcf0a0 1403 ret = read_register(STAT_CHG_A, (uint8_t *)&(reg_stat_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1404 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1405 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1406 }
metin.ozkan@analog.com 0:788f63dcf0a0 1407
metin.ozkan@analog.com 0:788f63dcf0a0 1408 *stat = (stat_t)reg_stat_chg_a.bits.ichgin_lim_stat;
metin.ozkan@analog.com 0:788f63dcf0a0 1409
metin.ozkan@analog.com 0:788f63dcf0a0 1410 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1411 }
metin.ozkan@analog.com 0:788f63dcf0a0 1412
metin.ozkan@analog.com 0:788f63dcf0a0 1413 int MAX77654::GetMinimumSYSVoltageLoopStatus(stat_t *stat)
metin.ozkan@analog.com 0:788f63dcf0a0 1414 {
metin.ozkan@analog.com 0:788f63dcf0a0 1415 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1416 reg_stat_chg_a_t reg_stat_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1417
metin.ozkan@analog.com 0:788f63dcf0a0 1418 ret = read_register(STAT_CHG_A, (uint8_t *)&(reg_stat_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1419 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1420 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1421 }
metin.ozkan@analog.com 0:788f63dcf0a0 1422
metin.ozkan@analog.com 0:788f63dcf0a0 1423 *stat = (stat_t)reg_stat_chg_a.bits.vsys_min_stat;
metin.ozkan@analog.com 0:788f63dcf0a0 1424
metin.ozkan@analog.com 0:788f63dcf0a0 1425 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1426 }
metin.ozkan@analog.com 0:788f63dcf0a0 1427
metin.ozkan@analog.com 0:788f63dcf0a0 1428 int MAX77654::GetMaximumJunctionTempLoopStatus(stat_t *stat)
metin.ozkan@analog.com 0:788f63dcf0a0 1429 {
metin.ozkan@analog.com 0:788f63dcf0a0 1430 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1431 reg_stat_chg_a_t reg_stat_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1432
metin.ozkan@analog.com 0:788f63dcf0a0 1433 ret = read_register(STAT_CHG_A, (uint8_t *)&(reg_stat_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1434 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1435 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1436 }
metin.ozkan@analog.com 0:788f63dcf0a0 1437
metin.ozkan@analog.com 0:788f63dcf0a0 1438 *stat = (stat_t)reg_stat_chg_a.bits.tj_reg_stat;
metin.ozkan@analog.com 0:788f63dcf0a0 1439
metin.ozkan@analog.com 0:788f63dcf0a0 1440 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1441 }
metin.ozkan@analog.com 0:788f63dcf0a0 1442
metin.ozkan@analog.com 0:788f63dcf0a0 1443 int MAX77654::GetBatteryTemperatureDetails(thm_dtls_t *thm_dtls)
metin.ozkan@analog.com 0:788f63dcf0a0 1444 {
metin.ozkan@analog.com 0:788f63dcf0a0 1445 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1446 reg_stat_chg_a_t reg_stat_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1447
metin.ozkan@analog.com 0:788f63dcf0a0 1448 ret = read_register(STAT_CHG_A, (uint8_t *)&(reg_stat_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1449 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1450 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1451 }
metin.ozkan@analog.com 0:788f63dcf0a0 1452
metin.ozkan@analog.com 0:788f63dcf0a0 1453 *thm_dtls = (thm_dtls_t)reg_stat_chg_a.bits.thm_dtls;
metin.ozkan@analog.com 0:788f63dcf0a0 1454
metin.ozkan@analog.com 0:788f63dcf0a0 1455 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1456 }
metin.ozkan@analog.com 0:788f63dcf0a0 1457
metin.ozkan@analog.com 0:788f63dcf0a0 1458 int MAX77654::GetChargerDetails(chg_dtls_t *chg_dtls)
metin.ozkan@analog.com 0:788f63dcf0a0 1459 {
metin.ozkan@analog.com 0:788f63dcf0a0 1460 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1461 reg_stat_chg_b_t reg_stat_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1462
metin.ozkan@analog.com 0:788f63dcf0a0 1463 ret = read_register(STAT_CHG_B, (uint8_t *)&(reg_stat_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1464 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1465 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1466 }
metin.ozkan@analog.com 0:788f63dcf0a0 1467
metin.ozkan@analog.com 0:788f63dcf0a0 1468 *chg_dtls = (chg_dtls_t)reg_stat_chg_b.bits.chg_dtls;
metin.ozkan@analog.com 0:788f63dcf0a0 1469
metin.ozkan@analog.com 0:788f63dcf0a0 1470 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1471 }
metin.ozkan@analog.com 0:788f63dcf0a0 1472
metin.ozkan@analog.com 0:788f63dcf0a0 1473 int MAX77654::GetCHGINStatusDetails(chgin_dtls_t *chgin_dtls)
metin.ozkan@analog.com 0:788f63dcf0a0 1474 {
metin.ozkan@analog.com 0:788f63dcf0a0 1475 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1476 reg_stat_chg_b_t reg_stat_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1477
metin.ozkan@analog.com 0:788f63dcf0a0 1478 ret = read_register(STAT_CHG_B, (uint8_t *)&(reg_stat_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1479 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1480 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1481 }
metin.ozkan@analog.com 0:788f63dcf0a0 1482
metin.ozkan@analog.com 0:788f63dcf0a0 1483 *chgin_dtls = (chgin_dtls_t)reg_stat_chg_b.bits.chgin_dtls;
metin.ozkan@analog.com 0:788f63dcf0a0 1484
metin.ozkan@analog.com 0:788f63dcf0a0 1485 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1486 }
metin.ozkan@analog.com 0:788f63dcf0a0 1487
metin.ozkan@analog.com 0:788f63dcf0a0 1488 int MAX77654::GetQuickChargerStatus(chg_t *chg)
metin.ozkan@analog.com 0:788f63dcf0a0 1489 {
metin.ozkan@analog.com 0:788f63dcf0a0 1490 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1491 reg_stat_chg_b_t reg_stat_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1492
metin.ozkan@analog.com 0:788f63dcf0a0 1493 ret = read_register(STAT_CHG_B, (uint8_t *)&(reg_stat_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1494 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1495 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1496 }
metin.ozkan@analog.com 0:788f63dcf0a0 1497
metin.ozkan@analog.com 0:788f63dcf0a0 1498 *chg = (chg_t)reg_stat_chg_b.bits.chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1499
metin.ozkan@analog.com 0:788f63dcf0a0 1500 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1501 }
metin.ozkan@analog.com 0:788f63dcf0a0 1502
metin.ozkan@analog.com 0:788f63dcf0a0 1503 int MAX77654::GetTimeSuspendedIndicator(time_sus_t *time_sus)
metin.ozkan@analog.com 0:788f63dcf0a0 1504 {
metin.ozkan@analog.com 0:788f63dcf0a0 1505 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1506 reg_stat_chg_b_t reg_stat_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1507
metin.ozkan@analog.com 0:788f63dcf0a0 1508 ret = read_register(STAT_CHG_B, (uint8_t *)&(reg_stat_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1509 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1510 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1511 }
metin.ozkan@analog.com 0:788f63dcf0a0 1512
metin.ozkan@analog.com 0:788f63dcf0a0 1513 *time_sus = (time_sus_t)reg_stat_chg_b.bits.time_sus;
metin.ozkan@analog.com 0:788f63dcf0a0 1514
metin.ozkan@analog.com 0:788f63dcf0a0 1515 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1516 }
metin.ozkan@analog.com 0:788f63dcf0a0 1517
metin.ozkan@analog.com 0:788f63dcf0a0 1518 int MAX77654::SetSYSCONFIGMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1519 {
metin.ozkan@analog.com 0:788f63dcf0a0 1520 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1521
metin.ozkan@analog.com 0:788f63dcf0a0 1522 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.sys_cnfg_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1523
metin.ozkan@analog.com 0:788f63dcf0a0 1524 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1525 }
metin.ozkan@analog.com 0:788f63dcf0a0 1526
metin.ozkan@analog.com 0:788f63dcf0a0 1527 int MAX77654::GetSYSCONFIGMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1528 {
metin.ozkan@analog.com 0:788f63dcf0a0 1529 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1530 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1531
metin.ozkan@analog.com 0:788f63dcf0a0 1532 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1533 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1534 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1535 }
metin.ozkan@analog.com 0:788f63dcf0a0 1536
metin.ozkan@analog.com 0:788f63dcf0a0 1537 *intm = (intm_t)reg_int_m_chg.bits.sys_cnfg_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1538
metin.ozkan@analog.com 0:788f63dcf0a0 1539 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1540 }
metin.ozkan@analog.com 0:788f63dcf0a0 1541
metin.ozkan@analog.com 0:788f63dcf0a0 1542 int MAX77654::SetSYSCTRLMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1543 {
metin.ozkan@analog.com 0:788f63dcf0a0 1544 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1545
metin.ozkan@analog.com 0:788f63dcf0a0 1546 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.sys_ctrl_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1547
metin.ozkan@analog.com 0:788f63dcf0a0 1548 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1549 }
metin.ozkan@analog.com 0:788f63dcf0a0 1550
metin.ozkan@analog.com 0:788f63dcf0a0 1551 int MAX77654::GetSYSCTRLMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1552 {
metin.ozkan@analog.com 0:788f63dcf0a0 1553 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1554 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1555
metin.ozkan@analog.com 0:788f63dcf0a0 1556 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1557 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1558 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1559 }
metin.ozkan@analog.com 0:788f63dcf0a0 1560
metin.ozkan@analog.com 0:788f63dcf0a0 1561 *intm = (intm_t)reg_int_m_chg.bits.sys_ctrl_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1562
metin.ozkan@analog.com 0:788f63dcf0a0 1563 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1564 }
metin.ozkan@analog.com 0:788f63dcf0a0 1565
metin.ozkan@analog.com 0:788f63dcf0a0 1566 int MAX77654::SetCHGINCTRLMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1567 {
metin.ozkan@analog.com 0:788f63dcf0a0 1568 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1569
metin.ozkan@analog.com 0:788f63dcf0a0 1570 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.chgin_ctrl_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1571
metin.ozkan@analog.com 0:788f63dcf0a0 1572 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1573 }
metin.ozkan@analog.com 0:788f63dcf0a0 1574
metin.ozkan@analog.com 0:788f63dcf0a0 1575 int MAX77654::GetCHGINCTRLMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1576 {
metin.ozkan@analog.com 0:788f63dcf0a0 1577 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1578 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1579
metin.ozkan@analog.com 0:788f63dcf0a0 1580 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1581 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1582 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1583 }
metin.ozkan@analog.com 0:788f63dcf0a0 1584
metin.ozkan@analog.com 0:788f63dcf0a0 1585 *intm = (intm_t)reg_int_m_chg.bits.chgin_ctrl_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1586
metin.ozkan@analog.com 0:788f63dcf0a0 1587 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1588 }
metin.ozkan@analog.com 0:788f63dcf0a0 1589
metin.ozkan@analog.com 0:788f63dcf0a0 1590 int MAX77654::SetTJREGMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1591 {
metin.ozkan@analog.com 0:788f63dcf0a0 1592 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1593
metin.ozkan@analog.com 0:788f63dcf0a0 1594 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.tj_reg_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1595
metin.ozkan@analog.com 0:788f63dcf0a0 1596 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1597 }
metin.ozkan@analog.com 0:788f63dcf0a0 1598
metin.ozkan@analog.com 0:788f63dcf0a0 1599 int MAX77654::GetTJREGMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1600 {
metin.ozkan@analog.com 0:788f63dcf0a0 1601 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1602 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1603
metin.ozkan@analog.com 0:788f63dcf0a0 1604 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1605 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1606 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1607 }
metin.ozkan@analog.com 0:788f63dcf0a0 1608
metin.ozkan@analog.com 0:788f63dcf0a0 1609 *intm = (intm_t)reg_int_m_chg.bits.tj_reg_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1610
metin.ozkan@analog.com 0:788f63dcf0a0 1611 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1612 }
metin.ozkan@analog.com 0:788f63dcf0a0 1613
metin.ozkan@analog.com 0:788f63dcf0a0 1614 int MAX77654::SetCHGINMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1615 {
metin.ozkan@analog.com 0:788f63dcf0a0 1616 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1617
metin.ozkan@analog.com 0:788f63dcf0a0 1618 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.chgin_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1619
metin.ozkan@analog.com 0:788f63dcf0a0 1620 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1621 }
metin.ozkan@analog.com 0:788f63dcf0a0 1622
metin.ozkan@analog.com 0:788f63dcf0a0 1623 int MAX77654::GetCHGINMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1624 {
metin.ozkan@analog.com 0:788f63dcf0a0 1625 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1626 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1627
metin.ozkan@analog.com 0:788f63dcf0a0 1628 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1629 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1630 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1631 }
metin.ozkan@analog.com 0:788f63dcf0a0 1632
metin.ozkan@analog.com 0:788f63dcf0a0 1633 *intm = (intm_t)reg_int_m_chg.bits.chgin_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1634
metin.ozkan@analog.com 0:788f63dcf0a0 1635 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1636 }
metin.ozkan@analog.com 0:788f63dcf0a0 1637
metin.ozkan@analog.com 0:788f63dcf0a0 1638 int MAX77654::SetCHGMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1639 {
metin.ozkan@analog.com 0:788f63dcf0a0 1640 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1641
metin.ozkan@analog.com 0:788f63dcf0a0 1642 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.chg_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1643
metin.ozkan@analog.com 0:788f63dcf0a0 1644 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1645 }
metin.ozkan@analog.com 0:788f63dcf0a0 1646
metin.ozkan@analog.com 0:788f63dcf0a0 1647 int MAX77654::GetCHGMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1648 {
metin.ozkan@analog.com 0:788f63dcf0a0 1649 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1650 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1651
metin.ozkan@analog.com 0:788f63dcf0a0 1652 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1653 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1654 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1655 }
metin.ozkan@analog.com 0:788f63dcf0a0 1656
metin.ozkan@analog.com 0:788f63dcf0a0 1657 *intm = (intm_t)reg_int_m_chg.bits.chg_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1658
metin.ozkan@analog.com 0:788f63dcf0a0 1659 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1660 }
metin.ozkan@analog.com 0:788f63dcf0a0 1661
metin.ozkan@analog.com 0:788f63dcf0a0 1662 int MAX77654::SetTHMMBit(intm_t intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1663 {
metin.ozkan@analog.com 0:788f63dcf0a0 1664 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1665
metin.ozkan@analog.com 0:788f63dcf0a0 1666 SET_BIT_FIELD(INT_M_CHG, reg_int_m_chg, reg_int_m_chg.bits.thm_m, intm);
metin.ozkan@analog.com 0:788f63dcf0a0 1667
metin.ozkan@analog.com 0:788f63dcf0a0 1668 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1669 }
metin.ozkan@analog.com 0:788f63dcf0a0 1670
metin.ozkan@analog.com 0:788f63dcf0a0 1671 int MAX77654::GetTHMMBit(intm_t *intm)
metin.ozkan@analog.com 0:788f63dcf0a0 1672 {
metin.ozkan@analog.com 0:788f63dcf0a0 1673 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1674 reg_int_m_chg_t reg_int_m_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 1675
metin.ozkan@analog.com 0:788f63dcf0a0 1676 ret = read_register(INT_M_CHG, (uint8_t *)&(reg_int_m_chg));
metin.ozkan@analog.com 0:788f63dcf0a0 1677 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1678 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1679 }
metin.ozkan@analog.com 0:788f63dcf0a0 1680
metin.ozkan@analog.com 0:788f63dcf0a0 1681 *intm = (intm_t)reg_int_m_chg.bits.thm_m;
metin.ozkan@analog.com 0:788f63dcf0a0 1682
metin.ozkan@analog.com 0:788f63dcf0a0 1683 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1684 }
metin.ozkan@analog.com 0:788f63dcf0a0 1685
metin.ozkan@analog.com 0:788f63dcf0a0 1686 int MAX77654::SetHOTJEITATemperature(thm_hot_t thm_hot)
metin.ozkan@analog.com 0:788f63dcf0a0 1687 {
metin.ozkan@analog.com 0:788f63dcf0a0 1688 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1689
metin.ozkan@analog.com 0:788f63dcf0a0 1690 SET_BIT_FIELD(CNFG_CHG_A, reg_cnfg_chg_a, reg_cnfg_chg_a.bits.thm_hot, thm_hot);
metin.ozkan@analog.com 0:788f63dcf0a0 1691
metin.ozkan@analog.com 0:788f63dcf0a0 1692 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1693 }
metin.ozkan@analog.com 0:788f63dcf0a0 1694
metin.ozkan@analog.com 0:788f63dcf0a0 1695 int MAX77654::GetHOTJEITATemperature(thm_hot_t *thm_hot)
metin.ozkan@analog.com 0:788f63dcf0a0 1696 {
metin.ozkan@analog.com 0:788f63dcf0a0 1697 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1698 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1699
metin.ozkan@analog.com 0:788f63dcf0a0 1700 ret = read_register(CNFG_CHG_A, (uint8_t *)&(reg_cnfg_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1701 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1702 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1703 }
metin.ozkan@analog.com 0:788f63dcf0a0 1704
metin.ozkan@analog.com 0:788f63dcf0a0 1705 *thm_hot = (thm_hot_t)reg_cnfg_chg_a.bits.thm_hot;
metin.ozkan@analog.com 0:788f63dcf0a0 1706
metin.ozkan@analog.com 0:788f63dcf0a0 1707 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1708 }
metin.ozkan@analog.com 0:788f63dcf0a0 1709
metin.ozkan@analog.com 0:788f63dcf0a0 1710 int MAX77654::SetWARMJEITATemperature(thm_warm_t thm_warm)
metin.ozkan@analog.com 0:788f63dcf0a0 1711 {
metin.ozkan@analog.com 0:788f63dcf0a0 1712 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1713
metin.ozkan@analog.com 0:788f63dcf0a0 1714 SET_BIT_FIELD(CNFG_CHG_A, reg_cnfg_chg_a, reg_cnfg_chg_a.bits.thm_warm, thm_warm);
metin.ozkan@analog.com 0:788f63dcf0a0 1715
metin.ozkan@analog.com 0:788f63dcf0a0 1716 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1717 }
metin.ozkan@analog.com 0:788f63dcf0a0 1718
metin.ozkan@analog.com 0:788f63dcf0a0 1719 int MAX77654::GetWARMJEITATemperature(thm_warm_t *thm_warm)
metin.ozkan@analog.com 0:788f63dcf0a0 1720 {
metin.ozkan@analog.com 0:788f63dcf0a0 1721 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1722 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1723
metin.ozkan@analog.com 0:788f63dcf0a0 1724 ret = read_register(CNFG_CHG_A, (uint8_t *)&(reg_cnfg_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1725 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1726 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1727 }
metin.ozkan@analog.com 0:788f63dcf0a0 1728
metin.ozkan@analog.com 0:788f63dcf0a0 1729 *thm_warm = (thm_warm_t)reg_cnfg_chg_a.bits.thm_warm;
metin.ozkan@analog.com 0:788f63dcf0a0 1730
metin.ozkan@analog.com 0:788f63dcf0a0 1731 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1732 }
metin.ozkan@analog.com 0:788f63dcf0a0 1733
metin.ozkan@analog.com 0:788f63dcf0a0 1734 int MAX77654::SetCOOLJEITATemperature(thm_cool_t thm_cool)
metin.ozkan@analog.com 0:788f63dcf0a0 1735 {
metin.ozkan@analog.com 0:788f63dcf0a0 1736 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1737
metin.ozkan@analog.com 0:788f63dcf0a0 1738 SET_BIT_FIELD(CNFG_CHG_A, reg_cnfg_chg_a, reg_cnfg_chg_a.bits.thm_cool, thm_cool);
metin.ozkan@analog.com 0:788f63dcf0a0 1739
metin.ozkan@analog.com 0:788f63dcf0a0 1740 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1741 }
metin.ozkan@analog.com 0:788f63dcf0a0 1742
metin.ozkan@analog.com 0:788f63dcf0a0 1743 int MAX77654::GetCOOLJEITATemperature(thm_cool_t *thm_cool)
metin.ozkan@analog.com 0:788f63dcf0a0 1744 {
metin.ozkan@analog.com 0:788f63dcf0a0 1745 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1746 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1747
metin.ozkan@analog.com 0:788f63dcf0a0 1748 ret = read_register(CNFG_CHG_A, (uint8_t *)&(reg_cnfg_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1749 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1750 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1751 }
metin.ozkan@analog.com 0:788f63dcf0a0 1752
metin.ozkan@analog.com 0:788f63dcf0a0 1753 *thm_cool = (thm_cool_t)reg_cnfg_chg_a.bits.thm_cool;
metin.ozkan@analog.com 0:788f63dcf0a0 1754
metin.ozkan@analog.com 0:788f63dcf0a0 1755 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1756 }
metin.ozkan@analog.com 0:788f63dcf0a0 1757
metin.ozkan@analog.com 0:788f63dcf0a0 1758 int MAX77654::SetCOLDJEITATemperature(thm_cold_t thm_cold)
metin.ozkan@analog.com 0:788f63dcf0a0 1759 {
metin.ozkan@analog.com 0:788f63dcf0a0 1760 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1761
metin.ozkan@analog.com 0:788f63dcf0a0 1762 SET_BIT_FIELD(CNFG_CHG_A, reg_cnfg_chg_a, reg_cnfg_chg_a.bits.thm_cold, thm_cold);
metin.ozkan@analog.com 0:788f63dcf0a0 1763
metin.ozkan@analog.com 0:788f63dcf0a0 1764 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1765 }
metin.ozkan@analog.com 0:788f63dcf0a0 1766
metin.ozkan@analog.com 0:788f63dcf0a0 1767 int MAX77654::GetCOLDJEITATemperature(thm_cold_t *thm_cold)
metin.ozkan@analog.com 0:788f63dcf0a0 1768 {
metin.ozkan@analog.com 0:788f63dcf0a0 1769 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1770 reg_cnfg_chg_a_t reg_cnfg_chg_a;
metin.ozkan@analog.com 0:788f63dcf0a0 1771
metin.ozkan@analog.com 0:788f63dcf0a0 1772 ret = read_register(CNFG_CHG_A, (uint8_t *)&(reg_cnfg_chg_a));
metin.ozkan@analog.com 0:788f63dcf0a0 1773 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1774 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1775 }
metin.ozkan@analog.com 0:788f63dcf0a0 1776
metin.ozkan@analog.com 0:788f63dcf0a0 1777 *thm_cold = (thm_cold_t)reg_cnfg_chg_a.bits.thm_cold;
metin.ozkan@analog.com 0:788f63dcf0a0 1778
metin.ozkan@analog.com 0:788f63dcf0a0 1779 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1780 }
metin.ozkan@analog.com 0:788f63dcf0a0 1781
metin.ozkan@analog.com 0:788f63dcf0a0 1782 int MAX77654::SetMinimumCHGINVoltage(vchgin_min_t vchgin_min)
metin.ozkan@analog.com 0:788f63dcf0a0 1783 {
metin.ozkan@analog.com 0:788f63dcf0a0 1784 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1785
metin.ozkan@analog.com 0:788f63dcf0a0 1786 SET_BIT_FIELD(CNFG_CHG_B, reg_cnfg_chg_b, reg_cnfg_chg_b.bits.vchgin_min, vchgin_min);
metin.ozkan@analog.com 0:788f63dcf0a0 1787
metin.ozkan@analog.com 0:788f63dcf0a0 1788 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1789 }
metin.ozkan@analog.com 0:788f63dcf0a0 1790
metin.ozkan@analog.com 0:788f63dcf0a0 1791 int MAX77654::GetMinimumCHGINVoltage(vchgin_min_t *vchgin_min)
metin.ozkan@analog.com 0:788f63dcf0a0 1792 {
metin.ozkan@analog.com 0:788f63dcf0a0 1793 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1794 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1795
metin.ozkan@analog.com 0:788f63dcf0a0 1796 ret = read_register(CNFG_CHG_B, (uint8_t *)&(reg_cnfg_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1797 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1798 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1799 }
metin.ozkan@analog.com 0:788f63dcf0a0 1800
metin.ozkan@analog.com 0:788f63dcf0a0 1801 *vchgin_min = (vchgin_min_t)reg_cnfg_chg_b.bits.vchgin_min;
metin.ozkan@analog.com 0:788f63dcf0a0 1802
metin.ozkan@analog.com 0:788f63dcf0a0 1803 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1804 }
metin.ozkan@analog.com 0:788f63dcf0a0 1805
metin.ozkan@analog.com 0:788f63dcf0a0 1806 int MAX77654::SetCHGINInputCurrentLimit(ichgin_lim_t ichgin_lim)
metin.ozkan@analog.com 0:788f63dcf0a0 1807 {
metin.ozkan@analog.com 0:788f63dcf0a0 1808 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1809
metin.ozkan@analog.com 0:788f63dcf0a0 1810 SET_BIT_FIELD(CNFG_CHG_B, reg_cnfg_chg_b, reg_cnfg_chg_b.bits.ichgin_lim, ichgin_lim);
metin.ozkan@analog.com 0:788f63dcf0a0 1811
metin.ozkan@analog.com 0:788f63dcf0a0 1812 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1813 }
metin.ozkan@analog.com 0:788f63dcf0a0 1814
metin.ozkan@analog.com 0:788f63dcf0a0 1815 int MAX77654::GetCHGINInputCurrentLimit(ichgin_lim_t *ichgin_lim)
metin.ozkan@analog.com 0:788f63dcf0a0 1816 {
metin.ozkan@analog.com 0:788f63dcf0a0 1817 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1818 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1819
metin.ozkan@analog.com 0:788f63dcf0a0 1820 ret = read_register(CNFG_CHG_B, (uint8_t *)&(reg_cnfg_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1821 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1822 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1823 }
metin.ozkan@analog.com 0:788f63dcf0a0 1824
metin.ozkan@analog.com 0:788f63dcf0a0 1825 *ichgin_lim = (ichgin_lim_t)reg_cnfg_chg_b.bits.ichgin_lim;
metin.ozkan@analog.com 0:788f63dcf0a0 1826
metin.ozkan@analog.com 0:788f63dcf0a0 1827 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1828 }
metin.ozkan@analog.com 0:788f63dcf0a0 1829
metin.ozkan@analog.com 0:788f63dcf0a0 1830 int MAX77654::SetPrequalificationChargeCurrent(i_pq_t i_pq)
metin.ozkan@analog.com 0:788f63dcf0a0 1831 {
metin.ozkan@analog.com 0:788f63dcf0a0 1832 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1833
metin.ozkan@analog.com 0:788f63dcf0a0 1834 SET_BIT_FIELD(CNFG_CHG_B, reg_cnfg_chg_b, reg_cnfg_chg_b.bits.i_pq, i_pq);
metin.ozkan@analog.com 0:788f63dcf0a0 1835
metin.ozkan@analog.com 0:788f63dcf0a0 1836 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1837 }
metin.ozkan@analog.com 0:788f63dcf0a0 1838
metin.ozkan@analog.com 0:788f63dcf0a0 1839 int MAX77654::GetPrequalificationChargeCurrent(i_pq_t *i_pq)
metin.ozkan@analog.com 0:788f63dcf0a0 1840 {
metin.ozkan@analog.com 0:788f63dcf0a0 1841 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1842 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1843
metin.ozkan@analog.com 0:788f63dcf0a0 1844 ret = read_register(CNFG_CHG_B, (uint8_t *)&(reg_cnfg_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1845 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1846 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1847 }
metin.ozkan@analog.com 0:788f63dcf0a0 1848
metin.ozkan@analog.com 0:788f63dcf0a0 1849 *i_pq = (i_pq_t)reg_cnfg_chg_b.bits.i_pq;
metin.ozkan@analog.com 0:788f63dcf0a0 1850
metin.ozkan@analog.com 0:788f63dcf0a0 1851 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1852 }
metin.ozkan@analog.com 0:788f63dcf0a0 1853
metin.ozkan@analog.com 0:788f63dcf0a0 1854 int MAX77654::SetBatteryChargerEnable(chg_en_t chg_en)
metin.ozkan@analog.com 0:788f63dcf0a0 1855 {
metin.ozkan@analog.com 0:788f63dcf0a0 1856 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1857
metin.ozkan@analog.com 0:788f63dcf0a0 1858 SET_BIT_FIELD(CNFG_CHG_B, reg_cnfg_chg_b, reg_cnfg_chg_b.bits.chg_en, chg_en);
metin.ozkan@analog.com 0:788f63dcf0a0 1859
metin.ozkan@analog.com 0:788f63dcf0a0 1860 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1861 }
metin.ozkan@analog.com 0:788f63dcf0a0 1862
metin.ozkan@analog.com 0:788f63dcf0a0 1863 int MAX77654::GetBatteryChargerEnable(chg_en_t *chg_en)
metin.ozkan@analog.com 0:788f63dcf0a0 1864 {
metin.ozkan@analog.com 0:788f63dcf0a0 1865 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1866 reg_cnfg_chg_b_t reg_cnfg_chg_b;
metin.ozkan@analog.com 0:788f63dcf0a0 1867
metin.ozkan@analog.com 0:788f63dcf0a0 1868 ret = read_register(CNFG_CHG_B, (uint8_t *)&(reg_cnfg_chg_b));
metin.ozkan@analog.com 0:788f63dcf0a0 1869 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1870 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1871 }
metin.ozkan@analog.com 0:788f63dcf0a0 1872
metin.ozkan@analog.com 0:788f63dcf0a0 1873 *chg_en = (chg_en_t)reg_cnfg_chg_b.bits.chg_en;
metin.ozkan@analog.com 0:788f63dcf0a0 1874
metin.ozkan@analog.com 0:788f63dcf0a0 1875 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1876 }
metin.ozkan@analog.com 0:788f63dcf0a0 1877
metin.ozkan@analog.com 0:788f63dcf0a0 1878 int MAX77654::SetBatteryPQVoltageThreshold(chg_pq_t chg_pq)
metin.ozkan@analog.com 0:788f63dcf0a0 1879 {
metin.ozkan@analog.com 0:788f63dcf0a0 1880 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1881
metin.ozkan@analog.com 0:788f63dcf0a0 1882 SET_BIT_FIELD(CNFG_CHG_C, reg_cnfg_chg_c, reg_cnfg_chg_c.bits.chg_pq, chg_pq);
metin.ozkan@analog.com 0:788f63dcf0a0 1883
metin.ozkan@analog.com 0:788f63dcf0a0 1884 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1885 }
metin.ozkan@analog.com 0:788f63dcf0a0 1886
metin.ozkan@analog.com 0:788f63dcf0a0 1887 int MAX77654::GetBatteryPQVoltageThreshold(chg_pq_t *chg_pq)
metin.ozkan@analog.com 0:788f63dcf0a0 1888 {
metin.ozkan@analog.com 0:788f63dcf0a0 1889 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1890 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1891
metin.ozkan@analog.com 0:788f63dcf0a0 1892 ret = read_register(CNFG_CHG_C, (uint8_t *)&(reg_cnfg_chg_c));
metin.ozkan@analog.com 0:788f63dcf0a0 1893 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1894 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1895 }
metin.ozkan@analog.com 0:788f63dcf0a0 1896
metin.ozkan@analog.com 0:788f63dcf0a0 1897 *chg_pq = (chg_pq_t)reg_cnfg_chg_c.bits.chg_pq;
metin.ozkan@analog.com 0:788f63dcf0a0 1898
metin.ozkan@analog.com 0:788f63dcf0a0 1899 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1900 }
metin.ozkan@analog.com 0:788f63dcf0a0 1901
metin.ozkan@analog.com 0:788f63dcf0a0 1902 int MAX77654::SetChargerTerminationCurrent(i_term_t i_term)
metin.ozkan@analog.com 0:788f63dcf0a0 1903 {
metin.ozkan@analog.com 0:788f63dcf0a0 1904 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1905
metin.ozkan@analog.com 0:788f63dcf0a0 1906 SET_BIT_FIELD(CNFG_CHG_C, reg_cnfg_chg_c, reg_cnfg_chg_c.bits.i_term, i_term);
metin.ozkan@analog.com 0:788f63dcf0a0 1907
metin.ozkan@analog.com 0:788f63dcf0a0 1908 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1909 }
metin.ozkan@analog.com 0:788f63dcf0a0 1910
metin.ozkan@analog.com 0:788f63dcf0a0 1911 int MAX77654::GetChargerTerminationCurrent(i_term_t *i_term)
metin.ozkan@analog.com 0:788f63dcf0a0 1912 {
metin.ozkan@analog.com 0:788f63dcf0a0 1913 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1914 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1915
metin.ozkan@analog.com 0:788f63dcf0a0 1916 ret = read_register(CNFG_CHG_C, (uint8_t *)&(reg_cnfg_chg_c));
metin.ozkan@analog.com 0:788f63dcf0a0 1917 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1918 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1919 }
metin.ozkan@analog.com 0:788f63dcf0a0 1920
metin.ozkan@analog.com 0:788f63dcf0a0 1921 *i_term = (i_term_t)reg_cnfg_chg_c.bits.i_term;
metin.ozkan@analog.com 0:788f63dcf0a0 1922
metin.ozkan@analog.com 0:788f63dcf0a0 1923 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1924 }
metin.ozkan@analog.com 0:788f63dcf0a0 1925
metin.ozkan@analog.com 0:788f63dcf0a0 1926 int MAX77654::SetTopOffTimerValue(t_topoff_t t_topoff)
metin.ozkan@analog.com 0:788f63dcf0a0 1927 {
metin.ozkan@analog.com 0:788f63dcf0a0 1928 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1929
metin.ozkan@analog.com 0:788f63dcf0a0 1930 SET_BIT_FIELD(CNFG_CHG_C, reg_cnfg_chg_c, reg_cnfg_chg_c.bits.t_topoff, t_topoff);
metin.ozkan@analog.com 0:788f63dcf0a0 1931
metin.ozkan@analog.com 0:788f63dcf0a0 1932 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1933 }
metin.ozkan@analog.com 0:788f63dcf0a0 1934
metin.ozkan@analog.com 0:788f63dcf0a0 1935 int MAX77654::GetTopOffTimerValue(t_topoff_t *t_topoff)
metin.ozkan@analog.com 0:788f63dcf0a0 1936 {
metin.ozkan@analog.com 0:788f63dcf0a0 1937 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1938 reg_cnfg_chg_c_t reg_cnfg_chg_c;
metin.ozkan@analog.com 0:788f63dcf0a0 1939
metin.ozkan@analog.com 0:788f63dcf0a0 1940 ret = read_register(CNFG_CHG_C, (uint8_t *)&(reg_cnfg_chg_c));
metin.ozkan@analog.com 0:788f63dcf0a0 1941 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1942 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1943 }
metin.ozkan@analog.com 0:788f63dcf0a0 1944
metin.ozkan@analog.com 0:788f63dcf0a0 1945 *t_topoff = (t_topoff_t)reg_cnfg_chg_c.bits.t_topoff;
metin.ozkan@analog.com 0:788f63dcf0a0 1946
metin.ozkan@analog.com 0:788f63dcf0a0 1947 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1948 }
metin.ozkan@analog.com 0:788f63dcf0a0 1949
metin.ozkan@analog.com 0:788f63dcf0a0 1950 int MAX77654::SetDieJunctionTemperature(tj_reg_t tj_reg)
metin.ozkan@analog.com 0:788f63dcf0a0 1951 {
metin.ozkan@analog.com 0:788f63dcf0a0 1952 reg_cnfg_chg_d_t reg_cnfg_chg_d;
metin.ozkan@analog.com 0:788f63dcf0a0 1953
metin.ozkan@analog.com 0:788f63dcf0a0 1954 SET_BIT_FIELD(CNFG_CHG_D, reg_cnfg_chg_d, reg_cnfg_chg_d.bits.tj_reg, tj_reg);
metin.ozkan@analog.com 0:788f63dcf0a0 1955
metin.ozkan@analog.com 0:788f63dcf0a0 1956 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1957 }
metin.ozkan@analog.com 0:788f63dcf0a0 1958
metin.ozkan@analog.com 0:788f63dcf0a0 1959 int MAX77654::GetDieJunctionTemperature(tj_reg_t *tj_reg)
metin.ozkan@analog.com 0:788f63dcf0a0 1960 {
metin.ozkan@analog.com 0:788f63dcf0a0 1961 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1962 reg_cnfg_chg_d_t reg_cnfg_chg_d;
metin.ozkan@analog.com 0:788f63dcf0a0 1963
metin.ozkan@analog.com 0:788f63dcf0a0 1964 ret = read_register(CNFG_CHG_D, (uint8_t *)&(reg_cnfg_chg_d));
metin.ozkan@analog.com 0:788f63dcf0a0 1965 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1966 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1967 }
metin.ozkan@analog.com 0:788f63dcf0a0 1968
metin.ozkan@analog.com 0:788f63dcf0a0 1969 *tj_reg = (tj_reg_t)reg_cnfg_chg_d.bits.tj_reg;
metin.ozkan@analog.com 0:788f63dcf0a0 1970
metin.ozkan@analog.com 0:788f63dcf0a0 1971 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1972 }
metin.ozkan@analog.com 0:788f63dcf0a0 1973
metin.ozkan@analog.com 0:788f63dcf0a0 1974 int MAX77654::SetSystemVoltageRegulation(vsys_reg_t vsys_reg)
metin.ozkan@analog.com 0:788f63dcf0a0 1975 {
metin.ozkan@analog.com 0:788f63dcf0a0 1976 reg_cnfg_chg_d_t reg_cnfg_chg_d;
metin.ozkan@analog.com 0:788f63dcf0a0 1977
metin.ozkan@analog.com 0:788f63dcf0a0 1978 SET_BIT_FIELD(CNFG_CHG_D, reg_cnfg_chg_d, reg_cnfg_chg_d.bits.vsys_reg, vsys_reg);
metin.ozkan@analog.com 0:788f63dcf0a0 1979
metin.ozkan@analog.com 0:788f63dcf0a0 1980 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1981 }
metin.ozkan@analog.com 0:788f63dcf0a0 1982
metin.ozkan@analog.com 0:788f63dcf0a0 1983 int MAX77654::GetSystemVoltageRegulation(vsys_reg_t *vsys_reg)
metin.ozkan@analog.com 0:788f63dcf0a0 1984 {
metin.ozkan@analog.com 0:788f63dcf0a0 1985 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1986 reg_cnfg_chg_d_t reg_cnfg_chg_d;
metin.ozkan@analog.com 0:788f63dcf0a0 1987
metin.ozkan@analog.com 0:788f63dcf0a0 1988 ret = read_register(CNFG_CHG_D, (uint8_t *)&(reg_cnfg_chg_d));
metin.ozkan@analog.com 0:788f63dcf0a0 1989 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 1990 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 1991 }
metin.ozkan@analog.com 0:788f63dcf0a0 1992
metin.ozkan@analog.com 0:788f63dcf0a0 1993 *vsys_reg = (vsys_reg_t)reg_cnfg_chg_d.bits.vsys_reg;
metin.ozkan@analog.com 0:788f63dcf0a0 1994
metin.ozkan@analog.com 0:788f63dcf0a0 1995 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 1996 }
metin.ozkan@analog.com 0:788f63dcf0a0 1997
metin.ozkan@analog.com 0:788f63dcf0a0 1998 int MAX77654::SetFastChargeCCValue(chg_cc_t chg_cc)
metin.ozkan@analog.com 0:788f63dcf0a0 1999 {
metin.ozkan@analog.com 0:788f63dcf0a0 2000 reg_cnfg_chg_e_t reg_cnfg_chg_e;
metin.ozkan@analog.com 0:788f63dcf0a0 2001
metin.ozkan@analog.com 0:788f63dcf0a0 2002 SET_BIT_FIELD(CNFG_CHG_E, reg_cnfg_chg_e, reg_cnfg_chg_e.bits.chg_cc, chg_cc);
metin.ozkan@analog.com 0:788f63dcf0a0 2003
metin.ozkan@analog.com 0:788f63dcf0a0 2004 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2005 }
metin.ozkan@analog.com 0:788f63dcf0a0 2006
metin.ozkan@analog.com 0:788f63dcf0a0 2007 int MAX77654::GetFastChargeCCValue(chg_cc_t *chg_cc)
metin.ozkan@analog.com 0:788f63dcf0a0 2008 {
metin.ozkan@analog.com 0:788f63dcf0a0 2009 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2010 reg_cnfg_chg_e_t reg_cnfg_chg_e;
metin.ozkan@analog.com 0:788f63dcf0a0 2011
metin.ozkan@analog.com 0:788f63dcf0a0 2012 ret = read_register(CNFG_CHG_E, (uint8_t *)&(reg_cnfg_chg_e));
metin.ozkan@analog.com 0:788f63dcf0a0 2013 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2014 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2015 }
metin.ozkan@analog.com 0:788f63dcf0a0 2016
metin.ozkan@analog.com 0:788f63dcf0a0 2017 *chg_cc = (chg_cc_t)reg_cnfg_chg_e.bits.chg_cc;
metin.ozkan@analog.com 0:788f63dcf0a0 2018
metin.ozkan@analog.com 0:788f63dcf0a0 2019 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2020 }
metin.ozkan@analog.com 0:788f63dcf0a0 2021
metin.ozkan@analog.com 0:788f63dcf0a0 2022 int MAX77654::SetFastChargSafetyTimer(t_fast_chg_t t_fast_chg)
metin.ozkan@analog.com 0:788f63dcf0a0 2023 {
metin.ozkan@analog.com 0:788f63dcf0a0 2024 reg_cnfg_chg_e_t reg_cnfg_chg_e;
metin.ozkan@analog.com 0:788f63dcf0a0 2025
metin.ozkan@analog.com 0:788f63dcf0a0 2026 SET_BIT_FIELD(CNFG_CHG_E, reg_cnfg_chg_e, reg_cnfg_chg_e.bits.t_fast_chg, t_fast_chg);
metin.ozkan@analog.com 0:788f63dcf0a0 2027
metin.ozkan@analog.com 0:788f63dcf0a0 2028 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2029 }
metin.ozkan@analog.com 0:788f63dcf0a0 2030
metin.ozkan@analog.com 0:788f63dcf0a0 2031 int MAX77654::GetFastChargSafetyTimer(t_fast_chg_t *t_fast_chg)
metin.ozkan@analog.com 0:788f63dcf0a0 2032 {
metin.ozkan@analog.com 0:788f63dcf0a0 2033 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2034 reg_cnfg_chg_e_t reg_cnfg_chg_e;
metin.ozkan@analog.com 0:788f63dcf0a0 2035
metin.ozkan@analog.com 0:788f63dcf0a0 2036 ret = read_register(CNFG_CHG_E, (uint8_t *)&(reg_cnfg_chg_e));
metin.ozkan@analog.com 0:788f63dcf0a0 2037 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2038 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2039 }
metin.ozkan@analog.com 0:788f63dcf0a0 2040
metin.ozkan@analog.com 0:788f63dcf0a0 2041 *t_fast_chg = (t_fast_chg_t)reg_cnfg_chg_e.bits.t_fast_chg;
metin.ozkan@analog.com 0:788f63dcf0a0 2042
metin.ozkan@analog.com 0:788f63dcf0a0 2043 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2044 }
metin.ozkan@analog.com 0:788f63dcf0a0 2045
metin.ozkan@analog.com 0:788f63dcf0a0 2046 int MAX77654::SetFastChargeCCJEITA(chg_cc_t chg_cc_jeita)
metin.ozkan@analog.com 0:788f63dcf0a0 2047 {
metin.ozkan@analog.com 0:788f63dcf0a0 2048 reg_cnfg_chg_f_t reg_cnfg_chg_f;
metin.ozkan@analog.com 0:788f63dcf0a0 2049
metin.ozkan@analog.com 0:788f63dcf0a0 2050 SET_BIT_FIELD(CNFG_CHG_F, reg_cnfg_chg_f, reg_cnfg_chg_f.bits.chg_cc_jeita, chg_cc_jeita);
metin.ozkan@analog.com 0:788f63dcf0a0 2051
metin.ozkan@analog.com 0:788f63dcf0a0 2052 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2053 }
metin.ozkan@analog.com 0:788f63dcf0a0 2054
metin.ozkan@analog.com 0:788f63dcf0a0 2055 int MAX77654::GetFastChargeCCJEITA(chg_cc_t *chg_cc_jeita)
metin.ozkan@analog.com 0:788f63dcf0a0 2056 {
metin.ozkan@analog.com 0:788f63dcf0a0 2057 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2058 reg_cnfg_chg_f_t reg_cnfg_chg_f;
metin.ozkan@analog.com 0:788f63dcf0a0 2059
metin.ozkan@analog.com 0:788f63dcf0a0 2060 ret = read_register(CNFG_CHG_F, (uint8_t *)&(reg_cnfg_chg_f));
metin.ozkan@analog.com 0:788f63dcf0a0 2061 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2062 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2063 }
metin.ozkan@analog.com 0:788f63dcf0a0 2064
metin.ozkan@analog.com 0:788f63dcf0a0 2065 *chg_cc_jeita = (chg_cc_t)reg_cnfg_chg_f.bits.chg_cc_jeita;
metin.ozkan@analog.com 0:788f63dcf0a0 2066
metin.ozkan@analog.com 0:788f63dcf0a0 2067 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2068 }
metin.ozkan@analog.com 0:788f63dcf0a0 2069
metin.ozkan@analog.com 0:788f63dcf0a0 2070 int MAX77654::SetThermistorEnable(thm_en_t thm_en)
metin.ozkan@analog.com 0:788f63dcf0a0 2071 {
metin.ozkan@analog.com 0:788f63dcf0a0 2072 reg_cnfg_chg_f_t reg_cnfg_chg_f;
metin.ozkan@analog.com 0:788f63dcf0a0 2073
metin.ozkan@analog.com 0:788f63dcf0a0 2074 SET_BIT_FIELD(CNFG_CHG_F, reg_cnfg_chg_f, reg_cnfg_chg_f.bits.thm_en, thm_en);
metin.ozkan@analog.com 0:788f63dcf0a0 2075
metin.ozkan@analog.com 0:788f63dcf0a0 2076 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2077 }
metin.ozkan@analog.com 0:788f63dcf0a0 2078
metin.ozkan@analog.com 0:788f63dcf0a0 2079 int MAX77654::GetThermistorEnable(thm_en_t *thm_en)
metin.ozkan@analog.com 0:788f63dcf0a0 2080 {
metin.ozkan@analog.com 0:788f63dcf0a0 2081 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2082 reg_cnfg_chg_f_t reg_cnfg_chg_f;
metin.ozkan@analog.com 0:788f63dcf0a0 2083
metin.ozkan@analog.com 0:788f63dcf0a0 2084 ret = read_register(CNFG_CHG_F, (uint8_t *)&(reg_cnfg_chg_f));
metin.ozkan@analog.com 0:788f63dcf0a0 2085 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2086 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2087 }
metin.ozkan@analog.com 0:788f63dcf0a0 2088
metin.ozkan@analog.com 0:788f63dcf0a0 2089 *thm_en = (thm_en_t)reg_cnfg_chg_f.bits.thm_en;
metin.ozkan@analog.com 0:788f63dcf0a0 2090
metin.ozkan@analog.com 0:788f63dcf0a0 2091 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2092 }
metin.ozkan@analog.com 0:788f63dcf0a0 2093
metin.ozkan@analog.com 0:788f63dcf0a0 2094 int MAX77654::SetFastChargeBatteryRegVolt(chg_cv_t chg_cv)
metin.ozkan@analog.com 0:788f63dcf0a0 2095 {
metin.ozkan@analog.com 0:788f63dcf0a0 2096 reg_cnfg_chg_g_t reg_cnfg_chg_g;
metin.ozkan@analog.com 0:788f63dcf0a0 2097
metin.ozkan@analog.com 0:788f63dcf0a0 2098 SET_BIT_FIELD(CNFG_CHG_G, reg_cnfg_chg_g, reg_cnfg_chg_g.bits.chg_cv, chg_cv);
metin.ozkan@analog.com 0:788f63dcf0a0 2099
metin.ozkan@analog.com 0:788f63dcf0a0 2100 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2101 }
metin.ozkan@analog.com 0:788f63dcf0a0 2102
metin.ozkan@analog.com 0:788f63dcf0a0 2103 int MAX77654::GetFastChargeBatteryRegVolt(chg_cv_t *chg_cv)
metin.ozkan@analog.com 0:788f63dcf0a0 2104 {
metin.ozkan@analog.com 0:788f63dcf0a0 2105 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2106 reg_cnfg_chg_g_t reg_cnfg_chg_g;
metin.ozkan@analog.com 0:788f63dcf0a0 2107
metin.ozkan@analog.com 0:788f63dcf0a0 2108 ret = read_register(CNFG_CHG_G, (uint8_t *)&(reg_cnfg_chg_g));
metin.ozkan@analog.com 0:788f63dcf0a0 2109 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2110 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2111 }
metin.ozkan@analog.com 0:788f63dcf0a0 2112
metin.ozkan@analog.com 0:788f63dcf0a0 2113 *chg_cv = (chg_cv_t)reg_cnfg_chg_g.bits.chg_cv;
metin.ozkan@analog.com 0:788f63dcf0a0 2114
metin.ozkan@analog.com 0:788f63dcf0a0 2115 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2116 }
metin.ozkan@analog.com 0:788f63dcf0a0 2117
metin.ozkan@analog.com 0:788f63dcf0a0 2118 int MAX77654::SetCHGINUSBSuspendMode(usbs_t usbs)
metin.ozkan@analog.com 0:788f63dcf0a0 2119 {
metin.ozkan@analog.com 0:788f63dcf0a0 2120 reg_cnfg_chg_g_t reg_cnfg_chg_g;
metin.ozkan@analog.com 0:788f63dcf0a0 2121
metin.ozkan@analog.com 0:788f63dcf0a0 2122 SET_BIT_FIELD(CNFG_CHG_G, reg_cnfg_chg_g, reg_cnfg_chg_g.bits.usbs, usbs);
metin.ozkan@analog.com 0:788f63dcf0a0 2123
metin.ozkan@analog.com 0:788f63dcf0a0 2124 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2125 }
metin.ozkan@analog.com 0:788f63dcf0a0 2126
metin.ozkan@analog.com 0:788f63dcf0a0 2127 int MAX77654::GetCHGINUSBSuspendMode(usbs_t *usbs)
metin.ozkan@analog.com 0:788f63dcf0a0 2128 {
metin.ozkan@analog.com 0:788f63dcf0a0 2129 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2130 reg_cnfg_chg_g_t reg_cnfg_chg_g;
metin.ozkan@analog.com 0:788f63dcf0a0 2131
metin.ozkan@analog.com 0:788f63dcf0a0 2132 ret = read_register(CNFG_CHG_G, (uint8_t *)&(reg_cnfg_chg_g));
metin.ozkan@analog.com 0:788f63dcf0a0 2133 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2134 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2135 }
metin.ozkan@analog.com 0:788f63dcf0a0 2136
metin.ozkan@analog.com 0:788f63dcf0a0 2137 *usbs = (usbs_t)reg_cnfg_chg_g.bits.usbs;
metin.ozkan@analog.com 0:788f63dcf0a0 2138
metin.ozkan@analog.com 0:788f63dcf0a0 2139 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2140 }
metin.ozkan@analog.com 0:788f63dcf0a0 2141
metin.ozkan@analog.com 0:788f63dcf0a0 2142 int MAX77654::SetFastChargeVoltageJEITA(chg_cv_t chg_cv_jeita)
metin.ozkan@analog.com 0:788f63dcf0a0 2143 {
metin.ozkan@analog.com 0:788f63dcf0a0 2144 reg_cnfg_chg_h_t reg_cnfg_chg_h;
metin.ozkan@analog.com 0:788f63dcf0a0 2145
metin.ozkan@analog.com 0:788f63dcf0a0 2146 SET_BIT_FIELD(CNFG_CHG_H, reg_cnfg_chg_h, reg_cnfg_chg_h.bits.chg_cv_jeita, chg_cv_jeita);
metin.ozkan@analog.com 0:788f63dcf0a0 2147
metin.ozkan@analog.com 0:788f63dcf0a0 2148 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2149 }
metin.ozkan@analog.com 0:788f63dcf0a0 2150
metin.ozkan@analog.com 0:788f63dcf0a0 2151 int MAX77654::GetFastChargeVoltageJEITA(chg_cv_t *chg_cv_jeita)
metin.ozkan@analog.com 0:788f63dcf0a0 2152 {
metin.ozkan@analog.com 0:788f63dcf0a0 2153 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2154 reg_cnfg_chg_h_t reg_cnfg_chg_h;
metin.ozkan@analog.com 0:788f63dcf0a0 2155
metin.ozkan@analog.com 0:788f63dcf0a0 2156 ret = read_register(CNFG_CHG_H, (uint8_t *)&(reg_cnfg_chg_h));
metin.ozkan@analog.com 0:788f63dcf0a0 2157 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2158 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2159 }
metin.ozkan@analog.com 0:788f63dcf0a0 2160
metin.ozkan@analog.com 0:788f63dcf0a0 2161 *chg_cv_jeita = (chg_cv_t)reg_cnfg_chg_h.bits.chg_cv_jeita;
metin.ozkan@analog.com 0:788f63dcf0a0 2162
metin.ozkan@analog.com 0:788f63dcf0a0 2163 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2164 }
metin.ozkan@analog.com 0:788f63dcf0a0 2165
metin.ozkan@analog.com 0:788f63dcf0a0 2166 int MAX77654::SetDischargeCurrentFullScale(imon_dischg_scale_t imon_dischg_scale)
metin.ozkan@analog.com 0:788f63dcf0a0 2167 {
metin.ozkan@analog.com 0:788f63dcf0a0 2168 reg_cnfg_chg_i_t reg_cnfg_chg_i;
metin.ozkan@analog.com 0:788f63dcf0a0 2169
metin.ozkan@analog.com 0:788f63dcf0a0 2170 SET_BIT_FIELD(CNFG_CHG_I, reg_cnfg_chg_i, reg_cnfg_chg_i.bits.imon_dischg_scale, imon_dischg_scale);
metin.ozkan@analog.com 0:788f63dcf0a0 2171
metin.ozkan@analog.com 0:788f63dcf0a0 2172 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2173 }
metin.ozkan@analog.com 0:788f63dcf0a0 2174
metin.ozkan@analog.com 0:788f63dcf0a0 2175 int MAX77654::GetDischargeCurrentFullScale(imon_dischg_scale_t *imon_dischg_scale)
metin.ozkan@analog.com 0:788f63dcf0a0 2176 {
metin.ozkan@analog.com 0:788f63dcf0a0 2177 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2178 reg_cnfg_chg_i_t reg_cnfg_chg_i;
metin.ozkan@analog.com 0:788f63dcf0a0 2179
metin.ozkan@analog.com 0:788f63dcf0a0 2180 ret = read_register(CNFG_CHG_I, (uint8_t *)&(reg_cnfg_chg_i));
metin.ozkan@analog.com 0:788f63dcf0a0 2181 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2182 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2183 }
metin.ozkan@analog.com 0:788f63dcf0a0 2184
metin.ozkan@analog.com 0:788f63dcf0a0 2185 *imon_dischg_scale = (imon_dischg_scale_t)reg_cnfg_chg_i.bits.imon_dischg_scale;
metin.ozkan@analog.com 0:788f63dcf0a0 2186
metin.ozkan@analog.com 0:788f63dcf0a0 2187 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2188 }
metin.ozkan@analog.com 0:788f63dcf0a0 2189
metin.ozkan@analog.com 0:788f63dcf0a0 2190 int MAX77654::SetAMUX(mux_sel_t mux_sel)
metin.ozkan@analog.com 0:788f63dcf0a0 2191 {
metin.ozkan@analog.com 0:788f63dcf0a0 2192 reg_cnfg_chg_i_t reg_cnfg_chg_i;
metin.ozkan@analog.com 0:788f63dcf0a0 2193
metin.ozkan@analog.com 0:788f63dcf0a0 2194 SET_BIT_FIELD(CNFG_CHG_I, reg_cnfg_chg_i, reg_cnfg_chg_i.bits.mux_sel, mux_sel);
metin.ozkan@analog.com 0:788f63dcf0a0 2195
metin.ozkan@analog.com 0:788f63dcf0a0 2196 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2197 }
metin.ozkan@analog.com 0:788f63dcf0a0 2198
metin.ozkan@analog.com 0:788f63dcf0a0 2199 int MAX77654::GetAMUX(mux_sel_t *mux_sel)
metin.ozkan@analog.com 0:788f63dcf0a0 2200 {
metin.ozkan@analog.com 0:788f63dcf0a0 2201 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2202 reg_cnfg_chg_i_t reg_cnfg_chg_i;
metin.ozkan@analog.com 0:788f63dcf0a0 2203
metin.ozkan@analog.com 0:788f63dcf0a0 2204 ret = read_register(CNFG_CHG_I, (uint8_t *)&(reg_cnfg_chg_i));
metin.ozkan@analog.com 0:788f63dcf0a0 2205 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2206 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2207 }
metin.ozkan@analog.com 0:788f63dcf0a0 2208
metin.ozkan@analog.com 0:788f63dcf0a0 2209 *mux_sel = (mux_sel_t)reg_cnfg_chg_i.bits.mux_sel;
metin.ozkan@analog.com 0:788f63dcf0a0 2210
metin.ozkan@analog.com 0:788f63dcf0a0 2211 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2212 }
metin.ozkan@analog.com 0:788f63dcf0a0 2213
metin.ozkan@analog.com 0:788f63dcf0a0 2214 int MAX77654::SetSBBTargetOutVoltage(uint8_t channel, tv_sbb_t tv_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2215 {
metin.ozkan@analog.com 0:788f63dcf0a0 2216 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2217 reg_cnfg_sbb0_a_t reg_cnfg_sbb0_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2218 SET_BIT_FIELD(CNFG_SBB0_A, reg_cnfg_sbb0_a, reg_cnfg_sbb0_a.bits.tv_sbb0, tv_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2219 }
metin.ozkan@analog.com 0:788f63dcf0a0 2220 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2221 reg_cnfg_sbb1_a_t reg_cnfg_sbb1_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2222 SET_BIT_FIELD(CNFG_SBB1_A, reg_cnfg_sbb1_a, reg_cnfg_sbb1_a.bits.tv_sbb1, tv_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2223 }
metin.ozkan@analog.com 0:788f63dcf0a0 2224 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2225 reg_cnfg_sbb2_a_t reg_cnfg_sbb2_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2226 SET_BIT_FIELD(CNFG_SBB2_A, reg_cnfg_sbb2_a, reg_cnfg_sbb2_a.bits.tv_sbb2, tv_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2227 }
metin.ozkan@analog.com 0:788f63dcf0a0 2228 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2229 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2230 }
metin.ozkan@analog.com 0:788f63dcf0a0 2231
metin.ozkan@analog.com 0:788f63dcf0a0 2232 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2233 }
metin.ozkan@analog.com 0:788f63dcf0a0 2234
metin.ozkan@analog.com 0:788f63dcf0a0 2235 int MAX77654::GetSBBTargetOutVoltage(uint8_t channel, tv_sbb_t *tv_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2236 {
metin.ozkan@analog.com 0:788f63dcf0a0 2237 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2238
metin.ozkan@analog.com 0:788f63dcf0a0 2239 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2240 reg_cnfg_sbb0_a_t reg_cnfg_sbb0_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2241 ret = read_register(CNFG_SBB0_A, (uint8_t *)&(reg_cnfg_sbb0_a));
metin.ozkan@analog.com 0:788f63dcf0a0 2242 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2243 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2244 }
metin.ozkan@analog.com 0:788f63dcf0a0 2245 *tv_sbb = (tv_sbb_t)reg_cnfg_sbb0_a.bits.tv_sbb0;
metin.ozkan@analog.com 0:788f63dcf0a0 2246 }
metin.ozkan@analog.com 0:788f63dcf0a0 2247 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2248 reg_cnfg_sbb1_a_t reg_cnfg_sbb1_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2249 ret = read_register(CNFG_SBB1_A, (uint8_t *)&(reg_cnfg_sbb1_a));
metin.ozkan@analog.com 0:788f63dcf0a0 2250 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2251 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2252 }
metin.ozkan@analog.com 0:788f63dcf0a0 2253 *tv_sbb = (tv_sbb_t)reg_cnfg_sbb1_a.bits.tv_sbb1;
metin.ozkan@analog.com 0:788f63dcf0a0 2254 }
metin.ozkan@analog.com 0:788f63dcf0a0 2255 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2256 reg_cnfg_sbb2_a_t reg_cnfg_sbb2_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2257 ret = read_register(CNFG_SBB2_A, (uint8_t *)&(reg_cnfg_sbb2_a));
metin.ozkan@analog.com 0:788f63dcf0a0 2258 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2259 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2260 }
metin.ozkan@analog.com 0:788f63dcf0a0 2261 *tv_sbb = (tv_sbb_t)reg_cnfg_sbb2_a.bits.tv_sbb2;
metin.ozkan@analog.com 0:788f63dcf0a0 2262 }
metin.ozkan@analog.com 0:788f63dcf0a0 2263 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2264 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2265 }
metin.ozkan@analog.com 0:788f63dcf0a0 2266
metin.ozkan@analog.com 0:788f63dcf0a0 2267 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2268 }
metin.ozkan@analog.com 0:788f63dcf0a0 2269
metin.ozkan@analog.com 0:788f63dcf0a0 2270 int MAX77654::SetSIMOOperationMode(uint8_t channel, op_mode_t op_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 2271 {
metin.ozkan@analog.com 0:788f63dcf0a0 2272 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2273 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2274 SET_BIT_FIELD(CNFG_SBB0_B, reg_cnfg_sbb0_b, reg_cnfg_sbb0_b.bits.op_mode, op_mode);
metin.ozkan@analog.com 0:788f63dcf0a0 2275 }
metin.ozkan@analog.com 0:788f63dcf0a0 2276 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2277 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2278 SET_BIT_FIELD(CNFG_SBB1_B, reg_cnfg_sbb1_b, reg_cnfg_sbb1_b.bits.op_mode, op_mode);
metin.ozkan@analog.com 0:788f63dcf0a0 2279 }
metin.ozkan@analog.com 0:788f63dcf0a0 2280 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2281 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2282 SET_BIT_FIELD(CNFG_SBB2_B, reg_cnfg_sbb2_b, reg_cnfg_sbb2_b.bits.op_mode, op_mode);
metin.ozkan@analog.com 0:788f63dcf0a0 2283 }
metin.ozkan@analog.com 0:788f63dcf0a0 2284 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2285 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2286 }
metin.ozkan@analog.com 0:788f63dcf0a0 2287
metin.ozkan@analog.com 0:788f63dcf0a0 2288 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2289 }
metin.ozkan@analog.com 0:788f63dcf0a0 2290
metin.ozkan@analog.com 0:788f63dcf0a0 2291 int MAX77654::GetSIMOOperationMode(uint8_t channel, op_mode_t *op_mode)
metin.ozkan@analog.com 0:788f63dcf0a0 2292 {
metin.ozkan@analog.com 0:788f63dcf0a0 2293 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2294
metin.ozkan@analog.com 0:788f63dcf0a0 2295 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2296 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2297 ret = read_register(CNFG_SBB0_B, (uint8_t *)&(reg_cnfg_sbb0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2298 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2299 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2300 }
metin.ozkan@analog.com 0:788f63dcf0a0 2301 *op_mode = (op_mode_t)reg_cnfg_sbb0_b.bits.op_mode;
metin.ozkan@analog.com 0:788f63dcf0a0 2302 }
metin.ozkan@analog.com 0:788f63dcf0a0 2303 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2304 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2305 ret = read_register(CNFG_SBB1_B, (uint8_t *)&(reg_cnfg_sbb1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2306 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2307 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2308 }
metin.ozkan@analog.com 0:788f63dcf0a0 2309 *op_mode = (op_mode_t)reg_cnfg_sbb1_b.bits.op_mode;
metin.ozkan@analog.com 0:788f63dcf0a0 2310 }
metin.ozkan@analog.com 0:788f63dcf0a0 2311 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2312 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2313 ret = read_register(CNFG_SBB2_B, (uint8_t *)&(reg_cnfg_sbb2_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2314 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2315 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2316 }
metin.ozkan@analog.com 0:788f63dcf0a0 2317 *op_mode = (op_mode_t)reg_cnfg_sbb2_b.bits.op_mode;
metin.ozkan@analog.com 0:788f63dcf0a0 2318 }
metin.ozkan@analog.com 0:788f63dcf0a0 2319 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2320 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2321 }
metin.ozkan@analog.com 0:788f63dcf0a0 2322
metin.ozkan@analog.com 0:788f63dcf0a0 2323 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2324 }
metin.ozkan@analog.com 0:788f63dcf0a0 2325
metin.ozkan@analog.com 0:788f63dcf0a0 2326 int MAX77654::SetSBBPeakCurrentLimit(uint8_t channel, ip_sbb_t ip_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2327 {
metin.ozkan@analog.com 0:788f63dcf0a0 2328 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2329 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2330 SET_BIT_FIELD(CNFG_SBB0_B, reg_cnfg_sbb0_b, reg_cnfg_sbb0_b.bits.ip_sbb0, ip_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2331 }
metin.ozkan@analog.com 0:788f63dcf0a0 2332 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2333 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2334 SET_BIT_FIELD(CNFG_SBB1_B, reg_cnfg_sbb1_b, reg_cnfg_sbb1_b.bits.ip_sbb1, ip_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2335 }
metin.ozkan@analog.com 0:788f63dcf0a0 2336 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2337 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2338 SET_BIT_FIELD(CNFG_SBB2_B, reg_cnfg_sbb2_b, reg_cnfg_sbb2_b.bits.ip_sbb2, ip_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2339 }
metin.ozkan@analog.com 0:788f63dcf0a0 2340 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2341 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2342 }
metin.ozkan@analog.com 0:788f63dcf0a0 2343
metin.ozkan@analog.com 0:788f63dcf0a0 2344 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2345 }
metin.ozkan@analog.com 0:788f63dcf0a0 2346
metin.ozkan@analog.com 0:788f63dcf0a0 2347 int MAX77654::GetSBBPeakCurrentLimit(uint8_t channel, ip_sbb_t *ip_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2348 {
metin.ozkan@analog.com 0:788f63dcf0a0 2349 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2350
metin.ozkan@analog.com 0:788f63dcf0a0 2351 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2352 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2353 ret = read_register(CNFG_SBB0_B, (uint8_t *)&(reg_cnfg_sbb0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2354 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2355 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2356 }
metin.ozkan@analog.com 0:788f63dcf0a0 2357 *ip_sbb = (ip_sbb_t)reg_cnfg_sbb0_b.bits.ip_sbb0;
metin.ozkan@analog.com 0:788f63dcf0a0 2358 }
metin.ozkan@analog.com 0:788f63dcf0a0 2359 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2360 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2361 ret = read_register(CNFG_SBB1_B, (uint8_t *)&(reg_cnfg_sbb1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2362 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2363 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2364 }
metin.ozkan@analog.com 0:788f63dcf0a0 2365 *ip_sbb = (ip_sbb_t)reg_cnfg_sbb1_b.bits.ip_sbb1;
metin.ozkan@analog.com 0:788f63dcf0a0 2366 }
metin.ozkan@analog.com 0:788f63dcf0a0 2367 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2368 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2369 ret = read_register(CNFG_SBB2_B, (uint8_t *)&(reg_cnfg_sbb2_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2370 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2371 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2372 }
metin.ozkan@analog.com 0:788f63dcf0a0 2373 *ip_sbb = (ip_sbb_t)reg_cnfg_sbb2_b.bits.ip_sbb2;
metin.ozkan@analog.com 0:788f63dcf0a0 2374 }
metin.ozkan@analog.com 0:788f63dcf0a0 2375 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2376 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2377 }
metin.ozkan@analog.com 0:788f63dcf0a0 2378
metin.ozkan@analog.com 0:788f63dcf0a0 2379 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2380 }
metin.ozkan@analog.com 0:788f63dcf0a0 2381
metin.ozkan@analog.com 0:788f63dcf0a0 2382 int MAX77654::SetSBBActiveDischargeEnable(uint8_t channel, ade_sbb_t ade_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2383 {
metin.ozkan@analog.com 0:788f63dcf0a0 2384 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2385 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2386 SET_BIT_FIELD(CNFG_SBB0_B, reg_cnfg_sbb0_b, reg_cnfg_sbb0_b.bits.ade_sbb0, ade_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2387 }
metin.ozkan@analog.com 0:788f63dcf0a0 2388 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2389 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2390 SET_BIT_FIELD(CNFG_SBB1_B, reg_cnfg_sbb1_b, reg_cnfg_sbb1_b.bits.ade_sbb1, ade_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2391 }
metin.ozkan@analog.com 0:788f63dcf0a0 2392 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2393 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2394 SET_BIT_FIELD(CNFG_SBB2_B, reg_cnfg_sbb2_b, reg_cnfg_sbb2_b.bits.ade_sbb2, ade_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2395 }
metin.ozkan@analog.com 0:788f63dcf0a0 2396 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2397 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2398 }
metin.ozkan@analog.com 0:788f63dcf0a0 2399
metin.ozkan@analog.com 0:788f63dcf0a0 2400 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2401 }
metin.ozkan@analog.com 0:788f63dcf0a0 2402
metin.ozkan@analog.com 0:788f63dcf0a0 2403 int MAX77654::GetSBBActiveDischargeEnable(uint8_t channel, ade_sbb_t *ade_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2404 {
metin.ozkan@analog.com 0:788f63dcf0a0 2405 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2406
metin.ozkan@analog.com 0:788f63dcf0a0 2407 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2408 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2409 ret = read_register(CNFG_SBB0_B, (uint8_t *)&(reg_cnfg_sbb0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2410 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2411 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2412 }
metin.ozkan@analog.com 0:788f63dcf0a0 2413 *ade_sbb = (ade_sbb_t)reg_cnfg_sbb0_b.bits.ade_sbb0;
metin.ozkan@analog.com 0:788f63dcf0a0 2414 }
metin.ozkan@analog.com 0:788f63dcf0a0 2415 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2416 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2417 ret = read_register(CNFG_SBB1_B, (uint8_t *)&(reg_cnfg_sbb1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2418 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2419 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2420 }
metin.ozkan@analog.com 0:788f63dcf0a0 2421 *ade_sbb = (ade_sbb_t)reg_cnfg_sbb1_b.bits.ade_sbb1;
metin.ozkan@analog.com 0:788f63dcf0a0 2422 }
metin.ozkan@analog.com 0:788f63dcf0a0 2423 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2424 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2425 ret = read_register(CNFG_SBB2_B, (uint8_t *)&(reg_cnfg_sbb2_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2426 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2427 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2428 }
metin.ozkan@analog.com 0:788f63dcf0a0 2429 *ade_sbb = (ade_sbb_t)reg_cnfg_sbb2_b.bits.ade_sbb2;
metin.ozkan@analog.com 0:788f63dcf0a0 2430 }
metin.ozkan@analog.com 0:788f63dcf0a0 2431 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2432 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2433 }
metin.ozkan@analog.com 0:788f63dcf0a0 2434
metin.ozkan@analog.com 0:788f63dcf0a0 2435 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2436 }
metin.ozkan@analog.com 0:788f63dcf0a0 2437
metin.ozkan@analog.com 0:788f63dcf0a0 2438 int MAX77654::SetSBBEnableControl(uint8_t channel, en_sbb_t en_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2439 {
metin.ozkan@analog.com 0:788f63dcf0a0 2440 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2441 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2442 SET_BIT_FIELD(CNFG_SBB0_B, reg_cnfg_sbb0_b, reg_cnfg_sbb0_b.bits.en_sbb0, en_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2443 }
metin.ozkan@analog.com 0:788f63dcf0a0 2444 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2445 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2446 SET_BIT_FIELD(CNFG_SBB1_B, reg_cnfg_sbb1_b, reg_cnfg_sbb1_b.bits.en_sbb1, en_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2447 }
metin.ozkan@analog.com 0:788f63dcf0a0 2448 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2449 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2450 SET_BIT_FIELD(CNFG_SBB2_B, reg_cnfg_sbb2_b, reg_cnfg_sbb2_b.bits.en_sbb2, en_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2451 }
metin.ozkan@analog.com 0:788f63dcf0a0 2452 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2453 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2454 }
metin.ozkan@analog.com 0:788f63dcf0a0 2455
metin.ozkan@analog.com 0:788f63dcf0a0 2456 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2457 }
metin.ozkan@analog.com 0:788f63dcf0a0 2458
metin.ozkan@analog.com 0:788f63dcf0a0 2459 int MAX77654::GetSBBEnableControl(uint8_t channel, en_sbb_t *en_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2460 {
metin.ozkan@analog.com 0:788f63dcf0a0 2461 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2462
metin.ozkan@analog.com 0:788f63dcf0a0 2463 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2464 reg_cnfg_sbb0_b_t reg_cnfg_sbb0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2465 ret = read_register(CNFG_SBB0_B, (uint8_t *)&(reg_cnfg_sbb0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2466 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2467 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2468 }
metin.ozkan@analog.com 0:788f63dcf0a0 2469 *en_sbb = (en_sbb_t)reg_cnfg_sbb0_b.bits.en_sbb0;
metin.ozkan@analog.com 0:788f63dcf0a0 2470 }
metin.ozkan@analog.com 0:788f63dcf0a0 2471 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2472 reg_cnfg_sbb1_b_t reg_cnfg_sbb1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2473 ret = read_register(CNFG_SBB1_B, (uint8_t *)&(reg_cnfg_sbb1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2474 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2475 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2476 }
metin.ozkan@analog.com 0:788f63dcf0a0 2477 *en_sbb = (en_sbb_t)reg_cnfg_sbb1_b.bits.en_sbb1;
metin.ozkan@analog.com 0:788f63dcf0a0 2478 }
metin.ozkan@analog.com 0:788f63dcf0a0 2479 else if (channel == 2) {
metin.ozkan@analog.com 0:788f63dcf0a0 2480 reg_cnfg_sbb2_b_t reg_cnfg_sbb2_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2481 ret = read_register(CNFG_SBB2_B, (uint8_t *)&(reg_cnfg_sbb2_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2482 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2483 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2484 }
metin.ozkan@analog.com 0:788f63dcf0a0 2485 *en_sbb = (en_sbb_t)reg_cnfg_sbb2_b.bits.en_sbb2;
metin.ozkan@analog.com 0:788f63dcf0a0 2486 }
metin.ozkan@analog.com 0:788f63dcf0a0 2487 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2488 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2489 }
metin.ozkan@analog.com 0:788f63dcf0a0 2490
metin.ozkan@analog.com 0:788f63dcf0a0 2491 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2492 }
metin.ozkan@analog.com 0:788f63dcf0a0 2493
metin.ozkan@analog.com 0:788f63dcf0a0 2494 int MAX77654::SetCHGINInputCurrentLimit(ichgin_lim_def_t ichgin_lim_def)
metin.ozkan@analog.com 0:788f63dcf0a0 2495 {
metin.ozkan@analog.com 0:788f63dcf0a0 2496 reg_cnfg_sbb_top_t reg_cnfg_sbb_top;
metin.ozkan@analog.com 0:788f63dcf0a0 2497
metin.ozkan@analog.com 0:788f63dcf0a0 2498 SET_BIT_FIELD(CNFG_SBB_TOP, reg_cnfg_sbb_top, reg_cnfg_sbb_top.bits.ichgin_lim_def, ichgin_lim_def);
metin.ozkan@analog.com 0:788f63dcf0a0 2499
metin.ozkan@analog.com 0:788f63dcf0a0 2500 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2501 }
metin.ozkan@analog.com 0:788f63dcf0a0 2502
metin.ozkan@analog.com 0:788f63dcf0a0 2503 int MAX77654::GetCHGINInputCurrentLimit(ichgin_lim_def_t *ichgin_lim_def)
metin.ozkan@analog.com 0:788f63dcf0a0 2504 {
metin.ozkan@analog.com 0:788f63dcf0a0 2505 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2506 reg_cnfg_sbb_top_t reg_cnfg_sbb_top;
metin.ozkan@analog.com 0:788f63dcf0a0 2507
metin.ozkan@analog.com 0:788f63dcf0a0 2508 ret = read_register(CNFG_SBB_TOP, (uint8_t *)&(reg_cnfg_sbb_top));
metin.ozkan@analog.com 0:788f63dcf0a0 2509 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2510 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2511 }
metin.ozkan@analog.com 0:788f63dcf0a0 2512
metin.ozkan@analog.com 0:788f63dcf0a0 2513 *ichgin_lim_def = (ichgin_lim_def_t)reg_cnfg_sbb_top.bits.ichgin_lim_def;
metin.ozkan@analog.com 0:788f63dcf0a0 2514
metin.ozkan@analog.com 0:788f63dcf0a0 2515 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2516 }
metin.ozkan@analog.com 0:788f63dcf0a0 2517
metin.ozkan@analog.com 0:788f63dcf0a0 2518 int MAX77654::SetSBBDriveStrength(drv_sbb_t drv_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2519 {
metin.ozkan@analog.com 0:788f63dcf0a0 2520 reg_cnfg_sbb_top_t reg_cnfg_sbb_top;
metin.ozkan@analog.com 0:788f63dcf0a0 2521
metin.ozkan@analog.com 0:788f63dcf0a0 2522 SET_BIT_FIELD(CNFG_SBB_TOP, reg_cnfg_sbb_top, reg_cnfg_sbb_top.bits.drv_sbb, drv_sbb);
metin.ozkan@analog.com 0:788f63dcf0a0 2523
metin.ozkan@analog.com 0:788f63dcf0a0 2524 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2525 }
metin.ozkan@analog.com 0:788f63dcf0a0 2526
metin.ozkan@analog.com 0:788f63dcf0a0 2527 int MAX77654::GetSBBDriveStrength(drv_sbb_t *drv_sbb)
metin.ozkan@analog.com 0:788f63dcf0a0 2528 {
metin.ozkan@analog.com 0:788f63dcf0a0 2529 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2530 reg_cnfg_sbb_top_t reg_cnfg_sbb_top;
metin.ozkan@analog.com 0:788f63dcf0a0 2531
metin.ozkan@analog.com 0:788f63dcf0a0 2532 ret = read_register(CNFG_SBB_TOP, (uint8_t *)&(reg_cnfg_sbb_top));
metin.ozkan@analog.com 0:788f63dcf0a0 2533 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2534 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2535 }
metin.ozkan@analog.com 0:788f63dcf0a0 2536
metin.ozkan@analog.com 0:788f63dcf0a0 2537 *drv_sbb = (drv_sbb_t)reg_cnfg_sbb_top.bits.drv_sbb;
metin.ozkan@analog.com 0:788f63dcf0a0 2538
metin.ozkan@analog.com 0:788f63dcf0a0 2539 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2540 }
metin.ozkan@analog.com 0:788f63dcf0a0 2541
metin.ozkan@analog.com 0:788f63dcf0a0 2542 int MAX77654::SetLDOTargetOutVoltage(uint8_t channel, tv_ldo_t tv_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2543 {
metin.ozkan@analog.com 0:788f63dcf0a0 2544 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2545 reg_cnfg_ldo0_a_t reg_cnfg_ldo0_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2546 SET_BIT_FIELD(CNFG_LDO0_A, reg_cnfg_ldo0_a, reg_cnfg_ldo0_a.bits.tv_ldo0, tv_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2547 }
metin.ozkan@analog.com 0:788f63dcf0a0 2548 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2549 reg_cnfg_ldo1_a_t reg_cnfg_ldo1_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2550 SET_BIT_FIELD(CNFG_LDO1_A, reg_cnfg_ldo1_a, reg_cnfg_ldo1_a.bits.tv_ldo1, tv_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2551 }
metin.ozkan@analog.com 0:788f63dcf0a0 2552 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2553 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2554 }
metin.ozkan@analog.com 0:788f63dcf0a0 2555
metin.ozkan@analog.com 0:788f63dcf0a0 2556 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2557 }
metin.ozkan@analog.com 0:788f63dcf0a0 2558
metin.ozkan@analog.com 0:788f63dcf0a0 2559 int MAX77654::GetLDOTargetOutVoltage(uint8_t channel, tv_ldo_t *tv_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2560 {
metin.ozkan@analog.com 0:788f63dcf0a0 2561 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2562
metin.ozkan@analog.com 0:788f63dcf0a0 2563 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2564 reg_cnfg_ldo0_a_t reg_cnfg_ldo0_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2565 ret = read_register(CNFG_LDO0_A, (uint8_t *)&(reg_cnfg_ldo0_a));
metin.ozkan@analog.com 0:788f63dcf0a0 2566 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2567 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2568 }
metin.ozkan@analog.com 0:788f63dcf0a0 2569 *tv_ldo = (tv_ldo_t)reg_cnfg_ldo0_a.bits.tv_ldo0;
metin.ozkan@analog.com 0:788f63dcf0a0 2570 }
metin.ozkan@analog.com 0:788f63dcf0a0 2571 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2572 reg_cnfg_ldo1_a_t reg_cnfg_ldo1_a;
metin.ozkan@analog.com 0:788f63dcf0a0 2573 ret = read_register(CNFG_LDO1_A, (uint8_t *)&(reg_cnfg_ldo1_a));
metin.ozkan@analog.com 0:788f63dcf0a0 2574 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2575 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2576 }
metin.ozkan@analog.com 0:788f63dcf0a0 2577 *tv_ldo = (tv_ldo_t)reg_cnfg_ldo1_a.bits.tv_ldo1;
metin.ozkan@analog.com 0:788f63dcf0a0 2578 }
metin.ozkan@analog.com 0:788f63dcf0a0 2579 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2580 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2581 }
metin.ozkan@analog.com 0:788f63dcf0a0 2582
metin.ozkan@analog.com 0:788f63dcf0a0 2583 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2584 }
metin.ozkan@analog.com 0:788f63dcf0a0 2585
metin.ozkan@analog.com 0:788f63dcf0a0 2586 int MAX77654::SetLDOMode(uint8_t channel, ldo_md_t ldo_md)
metin.ozkan@analog.com 0:788f63dcf0a0 2587 {
metin.ozkan@analog.com 0:788f63dcf0a0 2588 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2589 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2590 SET_BIT_FIELD(CNFG_LDO0_B, reg_cnfg_ldo0_b, reg_cnfg_ldo0_b.bits.ldo0_md, ldo_md);
metin.ozkan@analog.com 0:788f63dcf0a0 2591 }
metin.ozkan@analog.com 0:788f63dcf0a0 2592 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2593 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2594 SET_BIT_FIELD(CNFG_LDO1_B, reg_cnfg_ldo1_b, reg_cnfg_ldo1_b.bits.ldo1_md, ldo_md);
metin.ozkan@analog.com 0:788f63dcf0a0 2595 }
metin.ozkan@analog.com 0:788f63dcf0a0 2596 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2597 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2598 }
metin.ozkan@analog.com 0:788f63dcf0a0 2599
metin.ozkan@analog.com 0:788f63dcf0a0 2600 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2601 }
metin.ozkan@analog.com 0:788f63dcf0a0 2602
metin.ozkan@analog.com 0:788f63dcf0a0 2603 int MAX77654::GetLDOMode(uint8_t channel, ldo_md_t *ldo_md)
metin.ozkan@analog.com 0:788f63dcf0a0 2604 {
metin.ozkan@analog.com 0:788f63dcf0a0 2605 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2606
metin.ozkan@analog.com 0:788f63dcf0a0 2607 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2608 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2609 ret = read_register(CNFG_LDO0_B, (uint8_t *)&(reg_cnfg_ldo0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2610 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2611 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2612 }
metin.ozkan@analog.com 0:788f63dcf0a0 2613 *ldo_md = (ldo_md_t)reg_cnfg_ldo0_b.bits.ldo0_md;
metin.ozkan@analog.com 0:788f63dcf0a0 2614 }
metin.ozkan@analog.com 0:788f63dcf0a0 2615 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2616 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2617 ret = read_register(CNFG_LDO1_B, (uint8_t *)&(reg_cnfg_ldo1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2618 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2619 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2620 }
metin.ozkan@analog.com 0:788f63dcf0a0 2621 *ldo_md = (ldo_md_t)reg_cnfg_ldo1_b.bits.ldo1_md;
metin.ozkan@analog.com 0:788f63dcf0a0 2622 }
metin.ozkan@analog.com 0:788f63dcf0a0 2623 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2624 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2625 }
metin.ozkan@analog.com 0:788f63dcf0a0 2626
metin.ozkan@analog.com 0:788f63dcf0a0 2627 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2628 }
metin.ozkan@analog.com 0:788f63dcf0a0 2629
metin.ozkan@analog.com 0:788f63dcf0a0 2630 int MAX77654::SetLDOActiveDischargeEnable(uint8_t channel, ade_ldo_t ade_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2631 {
metin.ozkan@analog.com 0:788f63dcf0a0 2632 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2633 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2634 SET_BIT_FIELD(CNFG_LDO0_B, reg_cnfg_ldo0_b, reg_cnfg_ldo0_b.bits.ade_ldo0, ade_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2635 }
metin.ozkan@analog.com 0:788f63dcf0a0 2636 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2637 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2638 SET_BIT_FIELD(CNFG_LDO1_B, reg_cnfg_ldo1_b, reg_cnfg_ldo1_b.bits.ade_ldo1, ade_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2639 }
metin.ozkan@analog.com 0:788f63dcf0a0 2640 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2641 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2642 }
metin.ozkan@analog.com 0:788f63dcf0a0 2643
metin.ozkan@analog.com 0:788f63dcf0a0 2644 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2645 }
metin.ozkan@analog.com 0:788f63dcf0a0 2646
metin.ozkan@analog.com 0:788f63dcf0a0 2647 int MAX77654::GetLDOActiveDischargeEnable(uint8_t channel, ade_ldo_t *ade_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2648 {
metin.ozkan@analog.com 0:788f63dcf0a0 2649 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2650
metin.ozkan@analog.com 0:788f63dcf0a0 2651 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2652 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2653 ret = read_register(CNFG_LDO0_B, (uint8_t *)&(reg_cnfg_ldo0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2654 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2655 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2656 }
metin.ozkan@analog.com 0:788f63dcf0a0 2657 *ade_ldo = (ade_ldo_t)reg_cnfg_ldo0_b.bits.ade_ldo0;
metin.ozkan@analog.com 0:788f63dcf0a0 2658 }
metin.ozkan@analog.com 0:788f63dcf0a0 2659 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2660 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2661 ret = read_register(CNFG_LDO1_B, (uint8_t *)&(reg_cnfg_ldo1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2662 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2663 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2664 }
metin.ozkan@analog.com 0:788f63dcf0a0 2665 *ade_ldo = (ade_ldo_t)reg_cnfg_ldo1_b.bits.ade_ldo1;
metin.ozkan@analog.com 0:788f63dcf0a0 2666 }
metin.ozkan@analog.com 0:788f63dcf0a0 2667 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2668 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2669 }
metin.ozkan@analog.com 0:788f63dcf0a0 2670
metin.ozkan@analog.com 0:788f63dcf0a0 2671 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2672 }
metin.ozkan@analog.com 0:788f63dcf0a0 2673
metin.ozkan@analog.com 0:788f63dcf0a0 2674 int MAX77654::SetLDOEnableControl(uint8_t channel, en_ldo_t en_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2675 {
metin.ozkan@analog.com 0:788f63dcf0a0 2676 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2677 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2678 SET_BIT_FIELD(CNFG_LDO0_B, reg_cnfg_ldo0_b, reg_cnfg_ldo0_b.bits.en_ldo0, en_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2679 }
metin.ozkan@analog.com 0:788f63dcf0a0 2680 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2681 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2682 SET_BIT_FIELD(CNFG_LDO1_B, reg_cnfg_ldo1_b, reg_cnfg_ldo1_b.bits.en_ldo1, en_ldo);
metin.ozkan@analog.com 0:788f63dcf0a0 2683 }
metin.ozkan@analog.com 0:788f63dcf0a0 2684 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2685 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2686 }
metin.ozkan@analog.com 0:788f63dcf0a0 2687
metin.ozkan@analog.com 0:788f63dcf0a0 2688 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2689 }
metin.ozkan@analog.com 0:788f63dcf0a0 2690
metin.ozkan@analog.com 0:788f63dcf0a0 2691 int MAX77654::GetLDOEnableControl(uint8_t channel, en_ldo_t *en_ldo)
metin.ozkan@analog.com 0:788f63dcf0a0 2692 {
metin.ozkan@analog.com 0:788f63dcf0a0 2693 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2694
metin.ozkan@analog.com 0:788f63dcf0a0 2695 if (channel == 0) {
metin.ozkan@analog.com 0:788f63dcf0a0 2696 reg_cnfg_ldo0_b_t reg_cnfg_ldo0_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2697 ret = read_register(CNFG_LDO0_B, (uint8_t *)&(reg_cnfg_ldo0_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2698 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2699 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2700 }
metin.ozkan@analog.com 0:788f63dcf0a0 2701 *en_ldo = (en_ldo_t)reg_cnfg_ldo0_b.bits.en_ldo0;
metin.ozkan@analog.com 0:788f63dcf0a0 2702 }
metin.ozkan@analog.com 0:788f63dcf0a0 2703 else if (channel == 1) {
metin.ozkan@analog.com 0:788f63dcf0a0 2704 reg_cnfg_ldo1_b_t reg_cnfg_ldo1_b;
metin.ozkan@analog.com 0:788f63dcf0a0 2705 ret = read_register(CNFG_LDO1_B, (uint8_t *)&(reg_cnfg_ldo1_b));
metin.ozkan@analog.com 0:788f63dcf0a0 2706 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2707 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2708 }
metin.ozkan@analog.com 0:788f63dcf0a0 2709 *en_ldo = (en_ldo_t)reg_cnfg_ldo1_b.bits.en_ldo1;
metin.ozkan@analog.com 0:788f63dcf0a0 2710 }
metin.ozkan@analog.com 0:788f63dcf0a0 2711 else {
metin.ozkan@analog.com 0:788f63dcf0a0 2712 return MAX77654_INVALID_CHANNEL_NUMBER;
metin.ozkan@analog.com 0:788f63dcf0a0 2713 }
metin.ozkan@analog.com 0:788f63dcf0a0 2714
metin.ozkan@analog.com 0:788f63dcf0a0 2715 return MAX77654_NO_ERROR;
metin.ozkan@analog.com 0:788f63dcf0a0 2716 }
metin.ozkan@analog.com 0:788f63dcf0a0 2717
metin.ozkan@analog.com 0:788f63dcf0a0 2718 int MAX77654::IRQDisableAll()
metin.ozkan@analog.com 0:788f63dcf0a0 2719 {
metin.ozkan@analog.com 0:788f63dcf0a0 2720 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2721 uint8_t reg = 0;
metin.ozkan@analog.com 0:788f63dcf0a0 2722 uint8_t status = 0;
metin.ozkan@analog.com 0:788f63dcf0a0 2723
metin.ozkan@analog.com 0:788f63dcf0a0 2724 //Disable Masks in INTM_GLBL1
metin.ozkan@analog.com 0:788f63dcf0a0 2725 ret = write_register(INTM_GLBL1, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2726 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2727 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2728 }
metin.ozkan@analog.com 0:788f63dcf0a0 2729 //Disable Masks in INTM_GLBL0
metin.ozkan@analog.com 0:788f63dcf0a0 2730 ret = write_register(INTM_GLBL0, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2731 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2732 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2733 }
metin.ozkan@analog.com 0:788f63dcf0a0 2734 //Disable Masks in INT_M_CHG
metin.ozkan@analog.com 0:788f63dcf0a0 2735 ret = write_register(INT_M_CHG, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2736 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2737 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2738 }
metin.ozkan@analog.com 0:788f63dcf0a0 2739
metin.ozkan@analog.com 0:788f63dcf0a0 2740 // Clear Interrupt Flags in INT_GLBL1
metin.ozkan@analog.com 0:788f63dcf0a0 2741 ret = read_register(INT_GLBL1, &status);
metin.ozkan@analog.com 0:788f63dcf0a0 2742 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2743 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2744 }
metin.ozkan@analog.com 0:788f63dcf0a0 2745 // Clear Interrupt Flags in INT_GLBL0
metin.ozkan@analog.com 0:788f63dcf0a0 2746 ret = read_register(INT_GLBL0, &status);
metin.ozkan@analog.com 0:788f63dcf0a0 2747 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2748 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2749 }
metin.ozkan@analog.com 0:788f63dcf0a0 2750 // Clear Interrupt Flags in INT_CHG
metin.ozkan@analog.com 0:788f63dcf0a0 2751 ret = read_register(INT_CHG, &status);
metin.ozkan@analog.com 0:788f63dcf0a0 2752 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2753 return ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2754 }
metin.ozkan@analog.com 0:788f63dcf0a0 2755
metin.ozkan@analog.com 0:788f63dcf0a0 2756 return 0;
metin.ozkan@analog.com 0:788f63dcf0a0 2757 }
metin.ozkan@analog.com 0:788f63dcf0a0 2758
metin.ozkan@analog.com 0:788f63dcf0a0 2759 void MAX77654::SetInterruptHandler(int_glbl_t id, interrupt_handler_function func, void *cb)
metin.ozkan@analog.com 0:788f63dcf0a0 2760 {
metin.ozkan@analog.com 0:788f63dcf0a0 2761 interrupt_handler_list[id].func = func;
metin.ozkan@analog.com 0:788f63dcf0a0 2762 interrupt_handler_list[id].cb = cb;
metin.ozkan@analog.com 0:788f63dcf0a0 2763 }
metin.ozkan@analog.com 0:788f63dcf0a0 2764
metin.ozkan@analog.com 0:788f63dcf0a0 2765 void MAX77654::PostInterruptWork()
metin.ozkan@analog.com 0:788f63dcf0a0 2766 {
metin.ozkan@analog.com 0:788f63dcf0a0 2767 int ret;
metin.ozkan@analog.com 0:788f63dcf0a0 2768 uint8_t reg, inten, not_inten, mask;
metin.ozkan@analog.com 0:788f63dcf0a0 2769
metin.ozkan@analog.com 0:788f63dcf0a0 2770
metin.ozkan@analog.com 0:788f63dcf0a0 2771 while (true) {
metin.ozkan@analog.com 0:788f63dcf0a0 2772
metin.ozkan@analog.com 0:788f63dcf0a0 2773 ThisThread::flags_wait_any(POST_INTR_WORK_SIGNAL_ID);
metin.ozkan@analog.com 0:788f63dcf0a0 2774
metin.ozkan@analog.com 0:788f63dcf0a0 2775 // Check Interrupt Flags in INT_GLBL0
metin.ozkan@analog.com 0:788f63dcf0a0 2776 ret = read_register(INT_GLBL0, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2777 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2778 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2779 }
metin.ozkan@analog.com 0:788f63dcf0a0 2780
metin.ozkan@analog.com 0:788f63dcf0a0 2781 ret = read_register(INTM_GLBL0, &inten);
metin.ozkan@analog.com 0:788f63dcf0a0 2782 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2783 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2784 }
metin.ozkan@analog.com 0:788f63dcf0a0 2785
metin.ozkan@analog.com 0:788f63dcf0a0 2786 not_inten = ~inten; // 0 means unmasked.
metin.ozkan@analog.com 0:788f63dcf0a0 2787
metin.ozkan@analog.com 0:788f63dcf0a0 2788 for (int i = 0; i < INT_GLBL1_GPI1_F; i++) {
metin.ozkan@analog.com 0:788f63dcf0a0 2789 mask = (1 << i);
metin.ozkan@analog.com 0:788f63dcf0a0 2790 if ((reg & mask) && (not_inten & mask)) {
metin.ozkan@analog.com 0:788f63dcf0a0 2791 if (interrupt_handler_list[i].func != NULL) {
metin.ozkan@analog.com 0:788f63dcf0a0 2792 interrupt_handler_list[i]
metin.ozkan@analog.com 0:788f63dcf0a0 2793 .func(interrupt_handler_list[i].cb);
metin.ozkan@analog.com 0:788f63dcf0a0 2794 }
metin.ozkan@analog.com 0:788f63dcf0a0 2795 }
metin.ozkan@analog.com 0:788f63dcf0a0 2796 }
metin.ozkan@analog.com 0:788f63dcf0a0 2797
metin.ozkan@analog.com 0:788f63dcf0a0 2798 // Check Interrupt Flags in INT_GLBL1
metin.ozkan@analog.com 0:788f63dcf0a0 2799 ret = read_register(INT_GLBL1, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2800 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2801 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2802 }
metin.ozkan@analog.com 0:788f63dcf0a0 2803
metin.ozkan@analog.com 0:788f63dcf0a0 2804 ret = read_register(INTM_GLBL1, &inten);
metin.ozkan@analog.com 0:788f63dcf0a0 2805 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2806 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2807 }
metin.ozkan@analog.com 0:788f63dcf0a0 2808
metin.ozkan@analog.com 0:788f63dcf0a0 2809 not_inten = ~inten; // 0 means unmasked.
metin.ozkan@analog.com 0:788f63dcf0a0 2810
metin.ozkan@analog.com 0:788f63dcf0a0 2811 for (int i = INT_GLBL1_GPI1_F; i < INT_CHG_THM_I; i++) {
metin.ozkan@analog.com 0:788f63dcf0a0 2812 mask = (1 << (i - INT_GLBL1_GPI1_F));
metin.ozkan@analog.com 0:788f63dcf0a0 2813 if ((reg & mask) && (not_inten & mask)) {
metin.ozkan@analog.com 0:788f63dcf0a0 2814 if (interrupt_handler_list[i].func != NULL) {
metin.ozkan@analog.com 0:788f63dcf0a0 2815 interrupt_handler_list[i]
metin.ozkan@analog.com 0:788f63dcf0a0 2816 .func(interrupt_handler_list[i].cb);
metin.ozkan@analog.com 0:788f63dcf0a0 2817 }
metin.ozkan@analog.com 0:788f63dcf0a0 2818 }
metin.ozkan@analog.com 0:788f63dcf0a0 2819 }
metin.ozkan@analog.com 0:788f63dcf0a0 2820
metin.ozkan@analog.com 0:788f63dcf0a0 2821 // Check Interrupt Flags in INT_CHG
metin.ozkan@analog.com 0:788f63dcf0a0 2822 ret = read_register(INT_CHG, &reg);
metin.ozkan@analog.com 0:788f63dcf0a0 2823 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2824 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2825 }
metin.ozkan@analog.com 0:788f63dcf0a0 2826
metin.ozkan@analog.com 0:788f63dcf0a0 2827 ret = read_register(INT_M_CHG, &inten);
metin.ozkan@analog.com 0:788f63dcf0a0 2828 if (ret != MAX77654_NO_ERROR) {
metin.ozkan@analog.com 0:788f63dcf0a0 2829 return;
metin.ozkan@analog.com 0:788f63dcf0a0 2830 }
metin.ozkan@analog.com 0:788f63dcf0a0 2831
metin.ozkan@analog.com 0:788f63dcf0a0 2832 not_inten = ~inten; // 0 means unmasked.
metin.ozkan@analog.com 0:788f63dcf0a0 2833
metin.ozkan@analog.com 0:788f63dcf0a0 2834 for (int i = INT_CHG_THM_I; i < INT_CHG_END; i++) {
metin.ozkan@analog.com 0:788f63dcf0a0 2835 mask = (1 << (i - INT_CHG_THM_I));
metin.ozkan@analog.com 0:788f63dcf0a0 2836 if ((reg & mask) && (not_inten & mask)) {
metin.ozkan@analog.com 0:788f63dcf0a0 2837 if (interrupt_handler_list[i].func != NULL) {
metin.ozkan@analog.com 0:788f63dcf0a0 2838 interrupt_handler_list[i]
metin.ozkan@analog.com 0:788f63dcf0a0 2839 .func(interrupt_handler_list[i].cb);
metin.ozkan@analog.com 0:788f63dcf0a0 2840 }
metin.ozkan@analog.com 0:788f63dcf0a0 2841 }
metin.ozkan@analog.com 0:788f63dcf0a0 2842 }
metin.ozkan@analog.com 0:788f63dcf0a0 2843 }
metin.ozkan@analog.com 0:788f63dcf0a0 2844 }
metin.ozkan@analog.com 0:788f63dcf0a0 2845 void MAX77654::InterruptHandler()
metin.ozkan@analog.com 0:788f63dcf0a0 2846 {
metin.ozkan@analog.com 0:788f63dcf0a0 2847 post_intr_work_thread->flags_set(POST_INTR_WORK_SIGNAL_ID);
metin.ozkan@analog.com 0:788f63dcf0a0 2848 }