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.
OneWire_Masters/DS2480B/ds2480b.cpp@27:d5aaefa252f1, 2016-03-25 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Fri Mar 25 11:11:59 2016 -0500
- Revision:
- 27:d5aaefa252f1
- Parent:
- 26:a361e3f42ba5
- Child:
- 32:bce180b544ed
Do not reconfigure DS2465 if requested speed or level is already set. Use forward declarations to speed up compilation.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 3:644fc630f958 | 1 | /******************************************************************//** |
j3 | 3:644fc630f958 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
j3 | 3:644fc630f958 | 3 | * |
j3 | 3:644fc630f958 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
j3 | 3:644fc630f958 | 5 | * copy of this software and associated documentation files (the "Software"), |
j3 | 3:644fc630f958 | 6 | * to deal in the Software without restriction, including without limitation |
j3 | 3:644fc630f958 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
j3 | 3:644fc630f958 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
j3 | 3:644fc630f958 | 9 | * Software is furnished to do so, subject to the following conditions: |
j3 | 3:644fc630f958 | 10 | * |
j3 | 3:644fc630f958 | 11 | * The above copyright notice and this permission notice shall be included |
j3 | 3:644fc630f958 | 12 | * in all copies or substantial portions of the Software. |
j3 | 3:644fc630f958 | 13 | * |
j3 | 3:644fc630f958 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
j3 | 3:644fc630f958 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
j3 | 3:644fc630f958 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
j3 | 3:644fc630f958 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
j3 | 3:644fc630f958 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
j3 | 3:644fc630f958 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
j3 | 3:644fc630f958 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
j3 | 3:644fc630f958 | 21 | * |
j3 | 3:644fc630f958 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
j3 | 3:644fc630f958 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
j3 | 3:644fc630f958 | 24 | * Products, Inc. Branding Policy. |
j3 | 3:644fc630f958 | 25 | * |
j3 | 3:644fc630f958 | 26 | * The mere transfer of this software does not imply any licenses |
j3 | 3:644fc630f958 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
j3 | 3:644fc630f958 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
j3 | 3:644fc630f958 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
j3 | 3:644fc630f958 | 30 | * ownership rights. |
j3 | 3:644fc630f958 | 31 | **********************************************************************/ |
j3 | 3:644fc630f958 | 32 | |
j3 | 3:644fc630f958 | 33 | |
j3 | 3:644fc630f958 | 34 | #include "ds2480b.h" |
IanBenzMaxim | 27:d5aaefa252f1 | 35 | #include "RomId.hpp" |
j3 | 3:644fc630f958 | 36 | |
j3 | 3:644fc630f958 | 37 | |
j3 | 3:644fc630f958 | 38 | //********************************************************************* |
j3 | 16:883becbd85f8 | 39 | Ds2480b::Ds2480b(Serial &p_serial) |
j3 | 16:883becbd85f8 | 40 | :_p_serial(&p_serial), _serial_owner(false) |
j3 | 3:644fc630f958 | 41 | { |
j3 | 3:644fc630f958 | 42 | } |
j3 | 3:644fc630f958 | 43 | |
j3 | 3:644fc630f958 | 44 | |
j3 | 3:644fc630f958 | 45 | //********************************************************************* |
j3 | 3:644fc630f958 | 46 | Ds2480b::Ds2480b(PinName tx, PinName rx, uint32_t baud) |
j3 | 16:883becbd85f8 | 47 | :_p_serial(new Serial(tx, rx)), _serial_owner(true) |
j3 | 3:644fc630f958 | 48 | { |
j3 | 3:644fc630f958 | 49 | _p_serial->baud(baud); |
j3 | 3:644fc630f958 | 50 | } |
j3 | 3:644fc630f958 | 51 | |
j3 | 3:644fc630f958 | 52 | |
j3 | 3:644fc630f958 | 53 | //********************************************************************* |
j3 | 3:644fc630f958 | 54 | Ds2480b::~Ds2480b() |
j3 | 3:644fc630f958 | 55 | { |
j3 | 3:644fc630f958 | 56 | if(_serial_owner) |
j3 | 3:644fc630f958 | 57 | { |
j3 | 3:644fc630f958 | 58 | delete _p_serial; |
j3 | 3:644fc630f958 | 59 | } |
j3 | 3:644fc630f958 | 60 | } |
j3 | 3:644fc630f958 | 61 | |
j3 | 3:644fc630f958 | 62 | |
j3 | 3:644fc630f958 | 63 | //********************************************************************* |
j3 | 23:e8e403d61359 | 64 | OneWireMaster::CmdResult Ds2480b::OWInitMaster(void) |
j3 | 14:7b2886a50321 | 65 | { |
IanBenzMaxim | 26:a361e3f42ba5 | 66 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 14:7b2886a50321 | 67 | |
j3 | 17:b646b1e3970b | 68 | //TODO |
j3 | 17:b646b1e3970b | 69 | |
j3 | 17:b646b1e3970b | 70 | return result; |
j3 | 14:7b2886a50321 | 71 | } |
j3 | 14:7b2886a50321 | 72 | |
j3 | 14:7b2886a50321 | 73 | |
j3 | 14:7b2886a50321 | 74 | //********************************************************************* |
j3 | 23:e8e403d61359 | 75 | OneWireMaster::CmdResult Ds2480b::OWReset(void) |
j3 | 3:644fc630f958 | 76 | { |
j3 | 23:e8e403d61359 | 77 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 78 | |
j3 | 3:644fc630f958 | 79 | //TODO |
j3 | 3:644fc630f958 | 80 | |
j3 | 17:b646b1e3970b | 81 | return result; |
j3 | 3:644fc630f958 | 82 | } |
j3 | 3:644fc630f958 | 83 | |
j3 | 3:644fc630f958 | 84 | |
IanBenzMaxim | 26:a361e3f42ba5 | 85 | OneWireMaster::CmdResult Ds2480b::OWTouchBit(uint8_t & sendrecvbit, OW_LEVEL after_level) |
j3 | 3:644fc630f958 | 86 | { |
j3 | 23:e8e403d61359 | 87 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 88 | |
j3 | 3:644fc630f958 | 89 | //TODO |
j3 | 3:644fc630f958 | 90 | |
j3 | 17:b646b1e3970b | 91 | return result; |
j3 | 3:644fc630f958 | 92 | } |
j3 | 3:644fc630f958 | 93 | |
j3 | 3:644fc630f958 | 94 | |
j3 | 3:644fc630f958 | 95 | //********************************************************************* |
IanBenzMaxim | 26:a361e3f42ba5 | 96 | OneWireMaster::CmdResult Ds2480b::OWWriteByte(uint8_t sendbyte, OW_LEVEL after_level) |
IanBenzMaxim | 26:a361e3f42ba5 | 97 | { |
IanBenzMaxim | 26:a361e3f42ba5 | 98 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
IanBenzMaxim | 26:a361e3f42ba5 | 99 | |
IanBenzMaxim | 26:a361e3f42ba5 | 100 | //TODO |
IanBenzMaxim | 26:a361e3f42ba5 | 101 | |
IanBenzMaxim | 26:a361e3f42ba5 | 102 | return result; |
IanBenzMaxim | 26:a361e3f42ba5 | 103 | } |
IanBenzMaxim | 26:a361e3f42ba5 | 104 | |
IanBenzMaxim | 26:a361e3f42ba5 | 105 | |
IanBenzMaxim | 26:a361e3f42ba5 | 106 | //********************************************************************* |
IanBenzMaxim | 26:a361e3f42ba5 | 107 | OneWireMaster::CmdResult Ds2480b::OWReadByte(uint8_t & recvbyte, OW_LEVEL after_level) |
j3 | 3:644fc630f958 | 108 | { |
j3 | 23:e8e403d61359 | 109 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 110 | |
j3 | 3:644fc630f958 | 111 | //TODO |
j3 | 3:644fc630f958 | 112 | |
j3 | 17:b646b1e3970b | 113 | return result; |
j3 | 3:644fc630f958 | 114 | } |
j3 | 3:644fc630f958 | 115 | |
j3 | 3:644fc630f958 | 116 | |
j3 | 3:644fc630f958 | 117 | //********************************************************************* |
j3 | 23:e8e403d61359 | 118 | OneWireMaster::CmdResult Ds2480b::OWWriteBlock(const uint8_t *tran_buf, uint8_t tran_len) |
j3 | 3:644fc630f958 | 119 | { |
j3 | 23:e8e403d61359 | 120 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 121 | |
j3 | 3:644fc630f958 | 122 | //TODO |
j3 | 3:644fc630f958 | 123 | |
j3 | 17:b646b1e3970b | 124 | return result; |
j3 | 17:b646b1e3970b | 125 | } |
j3 | 17:b646b1e3970b | 126 | |
j3 | 17:b646b1e3970b | 127 | |
j3 | 17:b646b1e3970b | 128 | //********************************************************************* |
j3 | 23:e8e403d61359 | 129 | OneWireMaster::CmdResult Ds2480b::OWReadBlock(uint8_t *rx_buf, uint8_t rx_len) |
j3 | 17:b646b1e3970b | 130 | { |
j3 | 23:e8e403d61359 | 131 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 17:b646b1e3970b | 132 | |
j3 | 17:b646b1e3970b | 133 | //TODO |
j3 | 17:b646b1e3970b | 134 | |
j3 | 17:b646b1e3970b | 135 | return result; |
j3 | 3:644fc630f958 | 136 | } |
j3 | 3:644fc630f958 | 137 | |
j3 | 3:644fc630f958 | 138 | |
j3 | 3:644fc630f958 | 139 | //********************************************************************* |
j3 | 23:e8e403d61359 | 140 | OneWireMaster::CmdResult Ds2480b::OWSearch(RomId & romId) |
j3 | 3:644fc630f958 | 141 | { |
j3 | 23:e8e403d61359 | 142 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 143 | |
j3 | 3:644fc630f958 | 144 | //TODO |
j3 | 3:644fc630f958 | 145 | |
j3 | 17:b646b1e3970b | 146 | return result; |
j3 | 17:b646b1e3970b | 147 | } |
j3 | 17:b646b1e3970b | 148 | |
j3 | 17:b646b1e3970b | 149 | |
j3 | 17:b646b1e3970b | 150 | //********************************************************************* |
j3 | 23:e8e403d61359 | 151 | OneWireMaster::CmdResult Ds2480b::OWSpeed(OW_SPEED new_speed) |
j3 | 17:b646b1e3970b | 152 | { |
j3 | 23:e8e403d61359 | 153 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 17:b646b1e3970b | 154 | |
j3 | 17:b646b1e3970b | 155 | //TODO |
j3 | 17:b646b1e3970b | 156 | |
j3 | 17:b646b1e3970b | 157 | return result; |
j3 | 3:644fc630f958 | 158 | } |
j3 | 3:644fc630f958 | 159 | |
j3 | 3:644fc630f958 | 160 | |
j3 | 3:644fc630f958 | 161 | //********************************************************************* |
j3 | 23:e8e403d61359 | 162 | OneWireMaster::CmdResult Ds2480b::OWLevel(OW_LEVEL new_level) |
j3 | 3:644fc630f958 | 163 | { |
j3 | 23:e8e403d61359 | 164 | OneWireMaster::CmdResult result = OneWireMaster::OperationFailure; |
j3 | 3:644fc630f958 | 165 | |
j3 | 3:644fc630f958 | 166 | //TODO |
j3 | 3:644fc630f958 | 167 | |
j3 | 17:b646b1e3970b | 168 | return result; |
IanBenzMaxim | 26:a361e3f42ba5 | 169 | } |