1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.

Dependents:   MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more

Superseded by MaximInterface.

Committer:
j3
Date:
Tue Feb 09 03:30:22 2016 +0000
Revision:
5:ce108eeb878d
Parent:
3:644fc630f958
Child:
14:7b2886a50321
added additional rom command functions to interface and moved initialization of members to init list vs constructor body.  Made other modifications suggested by Ian

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j3 3:644fc630f958 1 /******************************************************************//**
j3 3:644fc630f958 2 * @file ds2480b.h
j3 3:644fc630f958 3 *
j3 3:644fc630f958 4 * @author Justin Jordan
j3 3:644fc630f958 5 *
j3 3:644fc630f958 6 * @version 0.0.0
j3 3:644fc630f958 7 *
j3 3:644fc630f958 8 * Started: 31JAN16
j3 3:644fc630f958 9 *
j3 3:644fc630f958 10 * Updated:
j3 3:644fc630f958 11 *
j3 3:644fc630f958 12 * @brief Header file for DS2480B Async Serial to 1-wire master
j3 3:644fc630f958 13 ***********************************************************************
j3 3:644fc630f958 14 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
j3 3:644fc630f958 15 *
j3 3:644fc630f958 16 * Permission is hereby granted, free of charge, to any person obtaining a
j3 3:644fc630f958 17 * copy of this software and associated documentation files (the "Software"),
j3 3:644fc630f958 18 * to deal in the Software without restriction, including without limitation
j3 3:644fc630f958 19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
j3 3:644fc630f958 20 * and/or sell copies of the Software, and to permit persons to whom the
j3 3:644fc630f958 21 * Software is furnished to do so, subject to the following conditions:
j3 3:644fc630f958 22 *
j3 3:644fc630f958 23 * The above copyright notice and this permission notice shall be included
j3 3:644fc630f958 24 * in all copies or substantial portions of the Software.
j3 3:644fc630f958 25 *
j3 3:644fc630f958 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
j3 3:644fc630f958 27 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
j3 3:644fc630f958 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
j3 3:644fc630f958 29 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
j3 3:644fc630f958 30 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
j3 3:644fc630f958 31 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
j3 3:644fc630f958 32 * OTHER DEALINGS IN THE SOFTWARE.
j3 3:644fc630f958 33 *
j3 3:644fc630f958 34 * Except as contained in this notice, the name of Maxim Integrated
j3 3:644fc630f958 35 * Products, Inc. shall not be used except as stated in the Maxim Integrated
j3 3:644fc630f958 36 * Products, Inc. Branding Policy.
j3 3:644fc630f958 37 *
j3 3:644fc630f958 38 * The mere transfer of this software does not imply any licenses
j3 3:644fc630f958 39 * of trade secrets, proprietary technology, copyrights, patents,
j3 3:644fc630f958 40 * trademarks, maskwork rights, or any other form of intellectual
j3 3:644fc630f958 41 * property whatsoever. Maxim Integrated Products, Inc. retains all
j3 3:644fc630f958 42 * ownership rights.
j3 3:644fc630f958 43 **********************************************************************/
j3 3:644fc630f958 44
j3 3:644fc630f958 45
j3 3:644fc630f958 46 #ifndef DS2480B_H
j3 3:644fc630f958 47 #define DS2480B_H
j3 3:644fc630f958 48
j3 3:644fc630f958 49
j3 3:644fc630f958 50 #include "mbed.h"
j3 3:644fc630f958 51 #include "OneWireInterface.h"
j3 5:ce108eeb878d 52 #include "OneWireMastersShared.h"
j3 3:644fc630f958 53
j3 3:644fc630f958 54
j3 3:644fc630f958 55 class Ds2480b: public OneWireInterface
j3 3:644fc630f958 56 {
j3 3:644fc630f958 57 public:
j3 3:644fc630f958 58
j3 3:644fc630f958 59 /**********************************************************//**
j3 3:644fc630f958 60 * @brief Ds2480b constructor
j3 3:644fc630f958 61 *
j3 3:644fc630f958 62 * @details allows user to use existing Serial object
j3 3:644fc630f958 63 *
j3 3:644fc630f958 64 * On Entry:
j3 3:644fc630f958 65 * @param[in] p_serial - pointer to existing serial object
j3 3:644fc630f958 66 *
j3 3:644fc630f958 67 * On Exit:
j3 3:644fc630f958 68 * @return
j3 3:644fc630f958 69 **************************************************************/
j3 3:644fc630f958 70 Ds2480b(Serial *p_serial);
j3 3:644fc630f958 71
j3 3:644fc630f958 72
j3 3:644fc630f958 73 /**********************************************************//**
j3 3:644fc630f958 74 * @brief Ds2480b constructor
j3 3:644fc630f958 75 *
j3 3:644fc630f958 76 * @details Object instantiates a new serial object with no
j3 3:644fc630f958 77 * public access
j3 3:644fc630f958 78 *
j3 3:644fc630f958 79 * On Entry:
j3 3:644fc630f958 80 * @param[in] tx - tx pin of uart to be used
j3 3:644fc630f958 81 * @param[in] rx - rx pin of uart to be used
j3 3:644fc630f958 82 * @param[in] baud - baudrate for uart
j3 3:644fc630f958 83 *
j3 3:644fc630f958 84 * On Exit:
j3 3:644fc630f958 85 * @return
j3 3:644fc630f958 86 **************************************************************/
j3 3:644fc630f958 87 Ds2480b(PinName tx, PinName rx, uint32_t baud);
j3 3:644fc630f958 88
j3 3:644fc630f958 89
j3 3:644fc630f958 90 /**********************************************************//**
j3 3:644fc630f958 91 * @brief Ds2480b destructor
j3 3:644fc630f958 92 *
j3 3:644fc630f958 93 * @details deletes serial object if owner
j3 3:644fc630f958 94 *
j3 3:644fc630f958 95 * On Entry:
j3 3:644fc630f958 96 *
j3 3:644fc630f958 97 * On Exit:
j3 3:644fc630f958 98 * @return
j3 3:644fc630f958 99 **************************************************************/
j3 3:644fc630f958 100 ~Ds2480b();
j3 3:644fc630f958 101
j3 3:644fc630f958 102
j3 3:644fc630f958 103 /***** OW API ****************************************************/
j3 3:644fc630f958 104 virtual bool OWReset();
j3 3:644fc630f958 105
j3 3:644fc630f958 106 virtual void OWWriteBit(uint8_t sendbit);
j3 3:644fc630f958 107
j3 3:644fc630f958 108 virtual uint8_t OWReadBit();
j3 3:644fc630f958 109
j3 3:644fc630f958 110 virtual uint8_t OWTouchBit(uint8_t sendbit);
j3 3:644fc630f958 111
j3 3:644fc630f958 112 virtual bool OWWriteByte(uint8_t sendbyte);
j3 3:644fc630f958 113
j3 3:644fc630f958 114 virtual uint8_t OWReadByte(void);
j3 3:644fc630f958 115
j3 3:644fc630f958 116 virtual uint8_t OWTouchByte(uint8_t sendbyte);
j3 3:644fc630f958 117
j3 3:644fc630f958 118 virtual void OWBlock(uint8_t *tran_buf, uint8_t tran_len);
j3 5:ce108eeb878d 119
j3 5:ce108eeb878d 120 virtual void OWWriteBlock(const uint8_t *tran_buf, uint8_t tran_len);
j3 5:ce108eeb878d 121
j3 5:ce108eeb878d 122 virtual void OWReadBlock(uint8_t *recv_buf, uint8_t recv_len);
j3 3:644fc630f958 123
j3 3:644fc630f958 124 virtual bool OWFirst(void);
j3 3:644fc630f958 125
j3 3:644fc630f958 126 virtual bool OWNext(void);
j3 3:644fc630f958 127
j3 3:644fc630f958 128 virtual bool OWVerify(void);
j3 3:644fc630f958 129
j3 3:644fc630f958 130 virtual void OWTargetSetup(uint8_t family_code);
j3 3:644fc630f958 131
j3 3:644fc630f958 132 virtual void OWFamilySkipSetup(void);
j3 3:644fc630f958 133
j3 3:644fc630f958 134 virtual bool OWSearch(void);
j3 5:ce108eeb878d 135
j3 5:ce108eeb878d 136 virtual bool OWReadROM(void);
j3 5:ce108eeb878d 137
j3 5:ce108eeb878d 138 virtual bool OWSkipROM(void);
j3 5:ce108eeb878d 139
j3 5:ce108eeb878d 140 virtual bool OWMatchROM(void);
j3 5:ce108eeb878d 141
j3 5:ce108eeb878d 142 virtual bool OWOverdriveSkipROM(void);
j3 5:ce108eeb878d 143
j3 5:ce108eeb878d 144 virtual bool OWOverdriveMatchROM(void);
j3 5:ce108eeb878d 145
j3 5:ce108eeb878d 146 virtual bool OWResume(void);
j3 3:644fc630f958 147
j3 5:ce108eeb878d 148 virtual uint8_t OWSpeed(OW_SPEED new_speed);
j3 3:644fc630f958 149
j3 5:ce108eeb878d 150 virtual uint8_t OWLevel(OW_LEVEL new_level);
j3 3:644fc630f958 151
j3 3:644fc630f958 152 virtual bool OWWriteBytePower(uint8_t sendbyte);
j3 3:644fc630f958 153
j3 3:644fc630f958 154 virtual bool OWReadBitPower(uint8_t applyPowerResponse);
j3 3:644fc630f958 155
j3 5:ce108eeb878d 156 virtual const uint8_t (&OWgetROMnumber() const)[ROMnumberLen];
j3 3:644fc630f958 157
j3 3:644fc630f958 158 private:
j3 3:644fc630f958 159
j3 3:644fc630f958 160 Serial *_p_serial;
j3 3:644fc630f958 161 bool _serial_owner;
j3 5:ce108eeb878d 162
j3 5:ce108eeb878d 163 uint8_t _rom_number[ROMnumberLen];
j3 3:644fc630f958 164 };
j3 3:644fc630f958 165
j3 3:644fc630f958 166 #endif /*DS2480B_H*/
j3 3:644fc630f958 167