max4146x_comp

Dependencies:   MAX14690

Committer:
sdivarci
Date:
Sun Oct 25 20:10:02 2020 +0000
Revision:
0:0061165683ee
sdivarci

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sdivarci 0:0061165683ee 1 /*******************************************************************************
sdivarci 0:0061165683ee 2 * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
sdivarci 0:0061165683ee 3 *
sdivarci 0:0061165683ee 4 * Permission is hereby granted, free of charge, to any person obtaining a
sdivarci 0:0061165683ee 5 * copy of this software and associated documentation files (the "Software"),
sdivarci 0:0061165683ee 6 * to deal in the Software without restriction, including without limitation
sdivarci 0:0061165683ee 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
sdivarci 0:0061165683ee 8 * and/or sell copies of the Software, and to permit persons to whom the
sdivarci 0:0061165683ee 9 * Software is furnished to do so, subject to the following conditions:
sdivarci 0:0061165683ee 10 *
sdivarci 0:0061165683ee 11 * The above copyright notice and this permission notice shall be included
sdivarci 0:0061165683ee 12 * in all copies or substantial portions of the Software.
sdivarci 0:0061165683ee 13 *
sdivarci 0:0061165683ee 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
sdivarci 0:0061165683ee 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
sdivarci 0:0061165683ee 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
sdivarci 0:0061165683ee 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
sdivarci 0:0061165683ee 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
sdivarci 0:0061165683ee 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
sdivarci 0:0061165683ee 20 * OTHER DEALINGS IN THE SOFTWARE.
sdivarci 0:0061165683ee 21 *
sdivarci 0:0061165683ee 22 * Except as contained in this notice, the name of Maxim Integrated
sdivarci 0:0061165683ee 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
sdivarci 0:0061165683ee 24 * Products, Inc. Branding Policy.
sdivarci 0:0061165683ee 25 *
sdivarci 0:0061165683ee 26 * The mere transfer of this software does not imply any licenses
sdivarci 0:0061165683ee 27 * of trade secrets, proprietary technology, copyrights, patents,
sdivarci 0:0061165683ee 28 * trademarks, maskwork rights, or any other form of intellectual
sdivarci 0:0061165683ee 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
sdivarci 0:0061165683ee 30 * ownership rights.
sdivarci 0:0061165683ee 31 *******************************************************************************
sdivarci 0:0061165683ee 32 */
sdivarci 0:0061165683ee 33 #include "mbed.h"
sdivarci 0:0061165683ee 34 #include "max32630fthr.h"
sdivarci 0:0061165683ee 35 #include "USBSerial.h"
sdivarci 0:0061165683ee 36 #include "Max4146x.h"
sdivarci 0:0061165683ee 37 #include "Max41460_regs.h"
sdivarci 0:0061165683ee 38 #include "Max41461_2_regs.h"
sdivarci 0:0061165683ee 39 #include "Max41463_4_regs.h"
sdivarci 0:0061165683ee 40
sdivarci 0:0061165683ee 41 //using namespace MAX4146X<max41461_2_reg_map_t>;
sdivarci 0:0061165683ee 42
sdivarci 0:0061165683ee 43 int main()
sdivarci 0:0061165683ee 44 {
sdivarci 0:0061165683ee 45 max41461_2_reg_map_t max41461_reg;
sdivarci 0:0061165683ee 46 I2C i2c(P5_7, P6_0);
sdivarci 0:0061165683ee 47 i2c.frequency(400000);
sdivarci 0:0061165683ee 48
sdivarci 0:0061165683ee 49 MAX4146X<max41461_2_reg_map_t> max41461(&max41461_reg, &i2c);
sdivarci 0:0061165683ee 50
sdivarci 0:0061165683ee 51 /*initial programming for MAX41462*/
sdivarci 0:0061165683ee 52 max41461.set_modmode(MAX4146X<max41461_2_reg_map_t>::MODMODE_ASK);
sdivarci 0:0061165683ee 53 max41461.set_i2c_txen1(MAX4146X<max41461_2_reg_map_t>::I2C_TXEN1_DISABLE);
sdivarci 0:0061165683ee 54 max41461.set_frequency(300000);
sdivarci 0:0061165683ee 55 max41461.set_i2c_txen2(MAX4146X<max41461_2_reg_map_t>::I2C_TXEN2_ENABLE);
sdivarci 0:0061165683ee 56 max41461.set_i2c_data(0);
sdivarci 0:0061165683ee 57
sdivarci 0:0061165683ee 58 while(1) {
sdivarci 0:0061165683ee 59 wait(2);
sdivarci 0:0061165683ee 60 }
sdivarci 0:0061165683ee 61 }
sdivarci 0:0061165683ee 62