MAX77816 Library. The MAX77816 is a high-current, high-efficiency buck-boost regulator targeting single-cell Li-ion battery powered applications. Please find more detail things on the website: https://www.maximintegrated.com/en/products/power/switching-regulators/MAX77816.html
max77816.h@0:c39030c3a7cf, 2018-03-20 (annotated)
- Committer:
- daniel_gs_jeong
- Date:
- Tue Mar 20 12:29:51 2018 +0000
- Revision:
- 0:c39030c3a7cf
- Child:
- 1:7182e55f5f59
MAX77816 Library. The MAX77816 is a high-current, high-efficiency; buck-boost regulator targeting single-cell Li-ion battery powered; applications.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
daniel_gs_jeong | 0:c39030c3a7cf | 1 | /******************************************************************************* |
daniel_gs_jeong | 0:c39030c3a7cf | 2 | * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved. |
daniel_gs_jeong | 0:c39030c3a7cf | 3 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
daniel_gs_jeong | 0:c39030c3a7cf | 5 | * copy of this software and associated documentation files (the "Software"), |
daniel_gs_jeong | 0:c39030c3a7cf | 6 | * to deal in the Software without restriction, including without limitation |
daniel_gs_jeong | 0:c39030c3a7cf | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
daniel_gs_jeong | 0:c39030c3a7cf | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
daniel_gs_jeong | 0:c39030c3a7cf | 9 | * Software is furnished to do so, subject to the following conditions: |
daniel_gs_jeong | 0:c39030c3a7cf | 10 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 11 | * The above copyright notice and this permission notice shall be included |
daniel_gs_jeong | 0:c39030c3a7cf | 12 | * in all copies or substantial portions of the Software. |
daniel_gs_jeong | 0:c39030c3a7cf | 13 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
daniel_gs_jeong | 0:c39030c3a7cf | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
daniel_gs_jeong | 0:c39030c3a7cf | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
daniel_gs_jeong | 0:c39030c3a7cf | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
daniel_gs_jeong | 0:c39030c3a7cf | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
daniel_gs_jeong | 0:c39030c3a7cf | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
daniel_gs_jeong | 0:c39030c3a7cf | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
daniel_gs_jeong | 0:c39030c3a7cf | 21 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 22 | * Except as contained in this notice, the name of Maxim Integrated |
daniel_gs_jeong | 0:c39030c3a7cf | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
daniel_gs_jeong | 0:c39030c3a7cf | 24 | * Products, Inc. Branding Policy. |
daniel_gs_jeong | 0:c39030c3a7cf | 25 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 26 | * The mere transfer of this software does not imply any licenses |
daniel_gs_jeong | 0:c39030c3a7cf | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
daniel_gs_jeong | 0:c39030c3a7cf | 28 | * trademarks, maskwork rights, or any other form of intellectual |
daniel_gs_jeong | 0:c39030c3a7cf | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
daniel_gs_jeong | 0:c39030c3a7cf | 30 | * ownership rights. |
daniel_gs_jeong | 0:c39030c3a7cf | 31 | ******************************************************************************* |
daniel_gs_jeong | 0:c39030c3a7cf | 32 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 33 | |
daniel_gs_jeong | 0:c39030c3a7cf | 34 | #ifndef _MAX77816_H_ |
daniel_gs_jeong | 0:c39030c3a7cf | 35 | #define _MAX77816_H_ |
daniel_gs_jeong | 0:c39030c3a7cf | 36 | |
daniel_gs_jeong | 0:c39030c3a7cf | 37 | #include "mbed.h" |
daniel_gs_jeong | 0:c39030c3a7cf | 38 | |
daniel_gs_jeong | 0:c39030c3a7cf | 39 | class MAX77816 |
daniel_gs_jeong | 0:c39030c3a7cf | 40 | { |
daniel_gs_jeong | 0:c39030c3a7cf | 41 | |
daniel_gs_jeong | 0:c39030c3a7cf | 42 | public: |
daniel_gs_jeong | 0:c39030c3a7cf | 43 | |
daniel_gs_jeong | 0:c39030c3a7cf | 44 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 45 | * @brief Register Addresses |
daniel_gs_jeong | 0:c39030c3a7cf | 46 | * @details Enumerated MAX77816 register addresses |
daniel_gs_jeong | 0:c39030c3a7cf | 47 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 48 | typedef enum { |
daniel_gs_jeong | 0:c39030c3a7cf | 49 | REG_0, |
daniel_gs_jeong | 0:c39030c3a7cf | 50 | REG_1, |
daniel_gs_jeong | 0:c39030c3a7cf | 51 | REG_2, |
daniel_gs_jeong | 0:c39030c3a7cf | 52 | REG_3, |
daniel_gs_jeong | 0:c39030c3a7cf | 53 | REG_4, |
daniel_gs_jeong | 0:c39030c3a7cf | 54 | REG_5, |
daniel_gs_jeong | 0:c39030c3a7cf | 55 | REG_6, |
daniel_gs_jeong | 0:c39030c3a7cf | 56 | REG_7 |
daniel_gs_jeong | 0:c39030c3a7cf | 57 | } registers_t; |
daniel_gs_jeong | 0:c39030c3a7cf | 58 | |
daniel_gs_jeong | 0:c39030c3a7cf | 59 | |
daniel_gs_jeong | 0:c39030c3a7cf | 60 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 61 | * MAX77816 constructor. |
daniel_gs_jeong | 0:c39030c3a7cf | 62 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 63 | * @param sda mbed pin to use for SDA line of I2C interface. |
daniel_gs_jeong | 0:c39030c3a7cf | 64 | * @param scl mbed pin to use for SCL line of I2C interface. |
daniel_gs_jeong | 0:c39030c3a7cf | 65 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 66 | MAX77816(PinName sda, PinName scl); |
daniel_gs_jeong | 0:c39030c3a7cf | 67 | |
daniel_gs_jeong | 0:c39030c3a7cf | 68 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 69 | * MAX77816 constructor. |
daniel_gs_jeong | 0:c39030c3a7cf | 70 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 71 | * @param i2c I2C object to use. |
daniel_gs_jeong | 0:c39030c3a7cf | 72 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 73 | MAX77816(I2C *i2c); |
daniel_gs_jeong | 0:c39030c3a7cf | 74 | |
daniel_gs_jeong | 0:c39030c3a7cf | 75 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 76 | * MAX44000 destructor. |
daniel_gs_jeong | 0:c39030c3a7cf | 77 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 78 | ~MAX77816(); |
daniel_gs_jeong | 0:c39030c3a7cf | 79 | |
daniel_gs_jeong | 0:c39030c3a7cf | 80 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 81 | * @brief Initialize MAX77816 |
daniel_gs_jeong | 0:c39030c3a7cf | 82 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 83 | int32_t init(); |
daniel_gs_jeong | 0:c39030c3a7cf | 84 | |
daniel_gs_jeong | 0:c39030c3a7cf | 85 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 86 | * @brief Write Register |
daniel_gs_jeong | 0:c39030c3a7cf | 87 | * @details Writes data to MAX77816 register |
daniel_gs_jeong | 0:c39030c3a7cf | 88 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 89 | * @param reg_addr Register to write |
daniel_gs_jeong | 0:c39030c3a7cf | 90 | * @param reg_data Data to write |
daniel_gs_jeong | 0:c39030c3a7cf | 91 | * @returns 0 if no errors, -1 if error. |
daniel_gs_jeong | 0:c39030c3a7cf | 92 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 93 | int32_t writeReg(MAX77816::registers_t reg_addr, char reg_data); |
daniel_gs_jeong | 0:c39030c3a7cf | 94 | |
daniel_gs_jeong | 0:c39030c3a7cf | 95 | /** |
daniel_gs_jeong | 0:c39030c3a7cf | 96 | * @brief Read Register |
daniel_gs_jeong | 0:c39030c3a7cf | 97 | * @details Reads data from MAX77816 register |
daniel_gs_jeong | 0:c39030c3a7cf | 98 | * |
daniel_gs_jeong | 0:c39030c3a7cf | 99 | * @param reg_addr Register to read |
daniel_gs_jeong | 0:c39030c3a7cf | 100 | * @returns data if no errors, -1 if error. |
daniel_gs_jeong | 0:c39030c3a7cf | 101 | */ |
daniel_gs_jeong | 0:c39030c3a7cf | 102 | int32_t readReg(MAX77816::registers_t reg_addr); |
daniel_gs_jeong | 0:c39030c3a7cf | 103 | |
daniel_gs_jeong | 0:c39030c3a7cf | 104 | |
daniel_gs_jeong | 0:c39030c3a7cf | 105 | int32_t writeBlock(MAX77816::registers_t startReg, MAX77816::registers_t stopReg, const uint8_t *data); |
daniel_gs_jeong | 0:c39030c3a7cf | 106 | int32_t readBlock(MAX77816::registers_t startReg, MAX77816::registers_t stopReg, uint8_t *data); |
daniel_gs_jeong | 0:c39030c3a7cf | 107 | |
daniel_gs_jeong | 0:c39030c3a7cf | 108 | int32_t getVersion(); |
daniel_gs_jeong | 0:c39030c3a7cf | 109 | int32_t getChipRevision(); |
daniel_gs_jeong | 0:c39030c3a7cf | 110 | int32_t getStatus(); |
daniel_gs_jeong | 0:c39030c3a7cf | 111 | int32_t setVout(uint8_t reg_data); |
daniel_gs_jeong | 0:c39030c3a7cf | 112 | int32_t setVoutH(uint8_t reg_data); |
daniel_gs_jeong | 0:c39030c3a7cf | 113 | int32_t setIntMask(uint8_t reg_data); |
daniel_gs_jeong | 0:c39030c3a7cf | 114 | int32_t setIntMask(); |
daniel_gs_jeong | 0:c39030c3a7cf | 115 | int32_t getInt(); |
daniel_gs_jeong | 0:c39030c3a7cf | 116 | |
daniel_gs_jeong | 0:c39030c3a7cf | 117 | private: |
daniel_gs_jeong | 0:c39030c3a7cf | 118 | |
daniel_gs_jeong | 0:c39030c3a7cf | 119 | I2C *i2c_; |
daniel_gs_jeong | 0:c39030c3a7cf | 120 | bool i2c_owner; |
daniel_gs_jeong | 0:c39030c3a7cf | 121 | |
daniel_gs_jeong | 0:c39030c3a7cf | 122 | }; |
daniel_gs_jeong | 0:c39030c3a7cf | 123 | |
daniel_gs_jeong | 0:c39030c3a7cf | 124 | #endif /* _MAX77816_H_ */ |
daniel_gs_jeong | 0:c39030c3a7cf | 125 |