Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: OneWire_Masters/DS248x/ds248x.cpp
- Revision:
- 1:91e52f8ab8bf
- Child:
- 2:02d228c25fd4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OneWire_Masters/DS248x/ds248x.cpp Sat Jan 30 23:00:57 2016 +0000 @@ -0,0 +1,249 @@ +/******************************************************************//** +* @file ds248x.cpp +* +* @author Justin Jordan +* +* @version 0.0.0 +* +* Started: 30JAN16 +* +* Updated: +* +* @brief Source file for Ds248x I2C to 1-wire master +*********************************************************************** +* 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 "ds248x.h" + + +//********************************************************************* +Ds248x::Ds248x(I2C *p_i2c_bus, ds248x_i2c_adrs_t adrs) +{ + _p_i2c_bus = p_i2c_bus; + _w_adrs = (adrs << 1); + _r_adrs = (_w_adrs | 1); + i2c_owner = false; +} + + +//********************************************************************* +Ds248x::Ds248x(PinName sda, PinName scl, ds248x_i2c_adrs_t adrs) +{ + _p_i2c_bus = new I2C(sda, scl); + _w_adrs = (adrs << 1); + _r_adrs = (_w_adrs | 1); + i2c_owner = true; +} + + +//********************************************************************* +Ds248x::~Ds248x() +{ + if(i2c_owner) + { + delete _p_i2c_bus; + } +} + + +//********************************************************************* +uint8_t Ds248x::detect(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::reset(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::write_config(uint8_t config) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* + + +//********************************************************************* +uint8_t Ds248x::OWReset() +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +void Ds248x::OWWriteBit(uint8_t sendbit) +{ + +} + + +//********************************************************************* +uint8_t Ds248x::OWReadBit() +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWTouchBit(uint8_t sendbit) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +void Ds248x::OWWRiteByte(uint8_t sendbyte) +{ + +} + + +//********************************************************************* +uint8_t Ds248x::OWReadByte(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWTouchByte(uint8_t sendbyte) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +void Ds248x::OWBlock(uint8_t *tran_buf, uint8_t tran_len) +{ + +} + + +//********************************************************************* +void Ds248x::OWFirst(void) +{ + +} + + +//********************************************************************* +uint8_t Ds248x::OWNext(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWVerify(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +void Ds248x::OWTargetSetup(uint8_t family_code) +{ + +} + + +//********************************************************************* +void Ds248x::OWFamilySkipSetup(void) +{ + +} + + +//********************************************************************* +uint8_t Ds248x::OWSearch(void) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWSpeed(uint8_t new_speed) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWLevel(uint8_t new_level) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWWriteBytePower(uint8_t sendbyte) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::OWReadBitPower(uint8_t applyPowerResponse) +{ + uint8_t rtn_val; + return(rtn_val); +} + + +//********************************************************************* +uint8_t Ds248x::calc_crc8(uint8_t data) +{ + uint8_t rtn_val; + return(rtn_val); +} \ No newline at end of file