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