Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

OneWire_Bridge/DS28E17/ds28e17.cpp

Committer:
j3
Date:
2016-02-02
Revision:
4:ca27db159b10
Parent:
3:644fc630f958
Child:
7:78a8857b3810

File content as of revision 4:ca27db159b10:

/******************************************************************//**
* @file ds28e17.cpp
*
* @author Justin Jordan
*
* @version 0.0.0
*
* Started: 31JAN16
*
* Updated: 
*
* @brief Source file for DS28E17 1-wire to I2C bridge
***********************************************************************
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Maxim Integrated
* Products, Inc. shall not be used except as stated in the Maxim Integrated
* Products, Inc. Branding Policy.
*
* The mere transfer of this software does not imply any licenses
* of trade secrets, proprietary technology, copyrights, patents,
* trademarks, maskwork rights, or any other form of intellectual
* property whatsoever. Maxim Integrated Products, Inc. retains all
* ownership rights.
**********************************************************************/


#include "ds28e17.h"


#define OW_ENABLE_DELAY             3  
#define CMD_I2C_WRITE_W_STOP        0x4B
#define CMD_I2C_WRITE_NO_STOP       0x5A
#define CMD_I2C_WRITE_ONLY          0x69
#define CMD_I2C_WRITE_ONLY_W_STOP   0x78
#define CMD_I2C_READ_W_STOP         0x87
#define CMD_I2C_WRITE_READ_W_STOP   0x2D
#define CMD_WRITE_CONFIG_REG        0xD2
#define CMD_READ_CONFIG_REG         0xE1
#define CMD_DISABLE_OW_MODE         0x96
#define CMD_ENABLE_SLEEP_MODE       0x1E
#define CMD_READ_DEVICE_REV         0xC3
#define POLL_LIMIT                  10000


uint16_t Ds28e17::_oddparity[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; 


//*********************************************************************
Ds28e17::Ds28e17(OneWireInterface *p_owm)
{
    _p_owm = p_owm;
    _owm_owner = false;
}


//*********************************************************************
Ds28e17::~Ds28e17()
{
    if(_owm_owner)
    {
        delete _p_owm;
    }
}


//*********************************************************************
bool Ds28e17::I2C_WriteDataWithStop(uint8_t I2C_addr, uint8_t length, 
                                    uint8_t *data, uint8_t status, 
                                    uint8_t wr_status)
{
    bool rtn_val = false;
    
    /*uint8_t send_cnt = 0; 
    uint8_t i;
    uint16_t poll_count = 0;
    uint8_t send_block[0xFF];*/
    
    return(rtn_val);
}


//*********************************************************************
bool Ds28e17::I2C_WriteDataNoStop(uint8_t I2C_addr, uint8_t length, 
                                  uint8_t *data, uint8_t status, 
                                  uint8_t wr_status)
{
    bool rtn_val = false;
    
    return(rtn_val);
}


//*********************************************************************
bool Ds28e17::I2C_WriteDataOnly(uint8_t length, uint8_t *data, 
                                uint8_t status, uint8_t wr_status)
{
    bool rtn_val = false;
    
    return(rtn_val);
}


//*********************************************************************
bool Ds28e17::I2C_WriteDataOnlyWithStop(uint8_t length, uint8_t *data, 
                                        uint8_t status, uint8_t wr_status)
{
    bool rtn_val = false;
    
    return(rtn_val);
}


//*********************************************************************
bool Ds28e17::I2C_WriteReadDataWithStop(uint8_t I2C_addr, uint8_t length, 
                                        uint8_t *data, uint8_t nu_bytes_read, 
                                        uint8_t status, uint8_t wr_status, 
                                        uint8_t *read_data)
{
    bool rtn_val = false;
    
    return(rtn_val);
}


//*********************************************************************
bool Ds28e17::I2C_ReadDataWithStop(uint8_t I2C_addr, uint8_t nu_bytes_read, 
                                   uint8_t status, uint8_t *read_data)
{
    bool rtn_val = false;
    
    return(rtn_val);
}


//*********************************************************************