Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
OneWire_Masters/DS2480B/ds2480b.cpp@14:7b2886a50321, 2016-03-15 (annotated)
- Committer:
- j3
- Date:
- Tue Mar 15 01:38:17 2016 +0000
- Revision:
- 14:7b2886a50321
- Parent:
- 13:d1bdb03703de
- Child:
- 16:883becbd85f8
added OWInitMaster() to interface in order to encapsulate master specific functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 3:644fc630f958 | 1 | /******************************************************************//** |
j3 | 3:644fc630f958 | 2 | * @file ds2480b.cpp |
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 Source 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 | #include "ds2480b.h" |
j3 | 3:644fc630f958 | 47 | |
j3 | 3:644fc630f958 | 48 | |
j3 | 3:644fc630f958 | 49 | //********************************************************************* |
j3 | 3:644fc630f958 | 50 | Ds2480b::Ds2480b(Serial *p_serial) |
j3 | 3:644fc630f958 | 51 | { |
j3 | 3:644fc630f958 | 52 | _p_serial = p_serial; |
j3 | 3:644fc630f958 | 53 | _serial_owner = false; |
j3 | 3:644fc630f958 | 54 | } |
j3 | 3:644fc630f958 | 55 | |
j3 | 3:644fc630f958 | 56 | |
j3 | 3:644fc630f958 | 57 | //********************************************************************* |
j3 | 3:644fc630f958 | 58 | Ds2480b::Ds2480b(PinName tx, PinName rx, uint32_t baud) |
j3 | 3:644fc630f958 | 59 | { |
j3 | 3:644fc630f958 | 60 | _p_serial = new Serial(tx, rx); |
j3 | 3:644fc630f958 | 61 | _p_serial->baud(baud); |
j3 | 3:644fc630f958 | 62 | _serial_owner = true; |
j3 | 3:644fc630f958 | 63 | } |
j3 | 3:644fc630f958 | 64 | |
j3 | 3:644fc630f958 | 65 | |
j3 | 3:644fc630f958 | 66 | //********************************************************************* |
j3 | 3:644fc630f958 | 67 | Ds2480b::~Ds2480b() |
j3 | 3:644fc630f958 | 68 | { |
j3 | 3:644fc630f958 | 69 | if(_serial_owner) |
j3 | 3:644fc630f958 | 70 | { |
j3 | 3:644fc630f958 | 71 | delete _p_serial; |
j3 | 3:644fc630f958 | 72 | } |
j3 | 3:644fc630f958 | 73 | } |
j3 | 3:644fc630f958 | 74 | |
j3 | 3:644fc630f958 | 75 | |
j3 | 3:644fc630f958 | 76 | //********************************************************************* |
j3 | 14:7b2886a50321 | 77 | bool Ds2480b::OWInitMaster() |
j3 | 14:7b2886a50321 | 78 | { |
j3 | 14:7b2886a50321 | 79 | bool rtn_val = false; |
j3 | 14:7b2886a50321 | 80 | |
j3 | 14:7b2886a50321 | 81 | return(rtn_val); |
j3 | 14:7b2886a50321 | 82 | } |
j3 | 14:7b2886a50321 | 83 | |
j3 | 14:7b2886a50321 | 84 | |
j3 | 14:7b2886a50321 | 85 | //********************************************************************* |
j3 | 3:644fc630f958 | 86 | bool Ds2480b::OWReset() |
j3 | 3:644fc630f958 | 87 | { |
j3 | 13:d1bdb03703de | 88 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 89 | |
j3 | 3:644fc630f958 | 90 | //TODO |
j3 | 3:644fc630f958 | 91 | |
j3 | 3:644fc630f958 | 92 | return rtn_val; |
j3 | 3:644fc630f958 | 93 | } |
j3 | 3:644fc630f958 | 94 | |
j3 | 3:644fc630f958 | 95 | |
j3 | 3:644fc630f958 | 96 | //********************************************************************* |
j3 | 3:644fc630f958 | 97 | void Ds2480b::OWWriteBit(uint8_t sendbit) |
j3 | 3:644fc630f958 | 98 | { |
j3 | 3:644fc630f958 | 99 | //TODO |
j3 | 3:644fc630f958 | 100 | } |
j3 | 3:644fc630f958 | 101 | |
j3 | 3:644fc630f958 | 102 | |
j3 | 3:644fc630f958 | 103 | //********************************************************************* |
j3 | 3:644fc630f958 | 104 | uint8_t Ds2480b::OWReadBit() |
j3 | 3:644fc630f958 | 105 | { |
j3 | 13:d1bdb03703de | 106 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 107 | |
j3 | 3:644fc630f958 | 108 | //TODO |
j3 | 3:644fc630f958 | 109 | |
j3 | 3:644fc630f958 | 110 | return(rtn_val); |
j3 | 3:644fc630f958 | 111 | } |
j3 | 3:644fc630f958 | 112 | |
j3 | 3:644fc630f958 | 113 | |
j3 | 3:644fc630f958 | 114 | //********************************************************************* |
j3 | 3:644fc630f958 | 115 | uint8_t Ds2480b::OWTouchBit(uint8_t sendbit) |
j3 | 3:644fc630f958 | 116 | { |
j3 | 13:d1bdb03703de | 117 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 118 | |
j3 | 3:644fc630f958 | 119 | //TODO |
j3 | 3:644fc630f958 | 120 | |
j3 | 3:644fc630f958 | 121 | return(rtn_val); |
j3 | 3:644fc630f958 | 122 | } |
j3 | 3:644fc630f958 | 123 | |
j3 | 3:644fc630f958 | 124 | |
j3 | 3:644fc630f958 | 125 | |
j3 | 3:644fc630f958 | 126 | //********************************************************************* |
j3 | 3:644fc630f958 | 127 | bool Ds2480b::OWWriteByte(uint8_t sendbyte) |
j3 | 3:644fc630f958 | 128 | { |
j3 | 13:d1bdb03703de | 129 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 130 | |
j3 | 3:644fc630f958 | 131 | //TODO |
j3 | 3:644fc630f958 | 132 | |
j3 | 3:644fc630f958 | 133 | return rtn_val; |
j3 | 3:644fc630f958 | 134 | } |
j3 | 3:644fc630f958 | 135 | |
j3 | 3:644fc630f958 | 136 | |
j3 | 3:644fc630f958 | 137 | //********************************************************************* |
j3 | 3:644fc630f958 | 138 | uint8_t Ds2480b::OWReadByte(void) |
j3 | 3:644fc630f958 | 139 | { |
j3 | 13:d1bdb03703de | 140 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 141 | |
j3 | 3:644fc630f958 | 142 | //TODO |
j3 | 3:644fc630f958 | 143 | |
j3 | 3:644fc630f958 | 144 | return(rtn_val); |
j3 | 3:644fc630f958 | 145 | } |
j3 | 3:644fc630f958 | 146 | |
j3 | 3:644fc630f958 | 147 | |
j3 | 3:644fc630f958 | 148 | //********************************************************************* |
j3 | 3:644fc630f958 | 149 | uint8_t Ds2480b::OWTouchByte(uint8_t sendbyte) |
j3 | 3:644fc630f958 | 150 | { |
j3 | 13:d1bdb03703de | 151 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 152 | |
j3 | 3:644fc630f958 | 153 | //TODO |
j3 | 3:644fc630f958 | 154 | |
j3 | 3:644fc630f958 | 155 | return(rtn_val); |
j3 | 3:644fc630f958 | 156 | } |
j3 | 3:644fc630f958 | 157 | |
j3 | 3:644fc630f958 | 158 | |
j3 | 3:644fc630f958 | 159 | //********************************************************************* |
j3 | 3:644fc630f958 | 160 | void Ds2480b::OWBlock(uint8_t *tran_buf, uint8_t tran_len) |
j3 | 3:644fc630f958 | 161 | { |
j3 | 3:644fc630f958 | 162 | //TODO |
j3 | 3:644fc630f958 | 163 | } |
j3 | 3:644fc630f958 | 164 | |
j3 | 3:644fc630f958 | 165 | |
j3 | 3:644fc630f958 | 166 | //********************************************************************* |
j3 | 5:ce108eeb878d | 167 | void Ds2480b::OWWriteBlock(const uint8_t *tran_buf, uint8_t tran_len) |
j3 | 5:ce108eeb878d | 168 | { |
j3 | 5:ce108eeb878d | 169 | //TODO |
j3 | 5:ce108eeb878d | 170 | } |
j3 | 5:ce108eeb878d | 171 | |
j3 | 5:ce108eeb878d | 172 | |
j3 | 5:ce108eeb878d | 173 | //********************************************************************* |
j3 | 5:ce108eeb878d | 174 | void Ds2480b::OWReadBlock(uint8_t *recv_buf, uint8_t recv_len) |
j3 | 5:ce108eeb878d | 175 | { |
j3 | 5:ce108eeb878d | 176 | //TODO |
j3 | 5:ce108eeb878d | 177 | } |
j3 | 5:ce108eeb878d | 178 | |
j3 | 5:ce108eeb878d | 179 | |
j3 | 5:ce108eeb878d | 180 | //********************************************************************* |
j3 | 3:644fc630f958 | 181 | bool Ds2480b::OWFirst(void) |
j3 | 3:644fc630f958 | 182 | { |
j3 | 13:d1bdb03703de | 183 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 184 | |
j3 | 3:644fc630f958 | 185 | //TODO |
j3 | 3:644fc630f958 | 186 | |
j3 | 3:644fc630f958 | 187 | return rtn_val; |
j3 | 3:644fc630f958 | 188 | } |
j3 | 3:644fc630f958 | 189 | |
j3 | 3:644fc630f958 | 190 | |
j3 | 3:644fc630f958 | 191 | //********************************************************************* |
j3 | 3:644fc630f958 | 192 | bool Ds2480b::OWNext(void) |
j3 | 3:644fc630f958 | 193 | { |
j3 | 13:d1bdb03703de | 194 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 195 | |
j3 | 3:644fc630f958 | 196 | //TODO |
j3 | 3:644fc630f958 | 197 | |
j3 | 3:644fc630f958 | 198 | return rtn_val; |
j3 | 3:644fc630f958 | 199 | } |
j3 | 3:644fc630f958 | 200 | |
j3 | 3:644fc630f958 | 201 | |
j3 | 3:644fc630f958 | 202 | //********************************************************************* |
j3 | 3:644fc630f958 | 203 | bool Ds2480b::OWVerify(void) |
j3 | 3:644fc630f958 | 204 | { |
j3 | 13:d1bdb03703de | 205 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 206 | |
j3 | 3:644fc630f958 | 207 | //TODO |
j3 | 3:644fc630f958 | 208 | |
j3 | 3:644fc630f958 | 209 | return rtn_val; |
j3 | 3:644fc630f958 | 210 | } |
j3 | 3:644fc630f958 | 211 | |
j3 | 3:644fc630f958 | 212 | |
j3 | 3:644fc630f958 | 213 | //********************************************************************* |
j3 | 3:644fc630f958 | 214 | void Ds2480b::OWTargetSetup(uint8_t family_code) |
j3 | 3:644fc630f958 | 215 | { |
j3 | 3:644fc630f958 | 216 | //TODO |
j3 | 3:644fc630f958 | 217 | } |
j3 | 3:644fc630f958 | 218 | |
j3 | 3:644fc630f958 | 219 | |
j3 | 3:644fc630f958 | 220 | //********************************************************************* |
j3 | 3:644fc630f958 | 221 | void Ds2480b::OWFamilySkipSetup(void) |
j3 | 3:644fc630f958 | 222 | { |
j3 | 3:644fc630f958 | 223 | //TODO |
j3 | 3:644fc630f958 | 224 | } |
j3 | 3:644fc630f958 | 225 | |
j3 | 3:644fc630f958 | 226 | |
j3 | 3:644fc630f958 | 227 | //********************************************************************* |
j3 | 3:644fc630f958 | 228 | bool Ds2480b::OWSearch(void) |
j3 | 3:644fc630f958 | 229 | { |
j3 | 13:d1bdb03703de | 230 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 231 | |
j3 | 3:644fc630f958 | 232 | //TODO |
j3 | 3:644fc630f958 | 233 | |
j3 | 3:644fc630f958 | 234 | return rtn_val; |
j3 | 3:644fc630f958 | 235 | } |
j3 | 3:644fc630f958 | 236 | |
j3 | 3:644fc630f958 | 237 | |
j3 | 3:644fc630f958 | 238 | //********************************************************************* |
j3 | 5:ce108eeb878d | 239 | bool Ds2480b::OWReadROM(void) |
j3 | 5:ce108eeb878d | 240 | { |
j3 | 13:d1bdb03703de | 241 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 242 | |
j3 | 5:ce108eeb878d | 243 | //TODO |
j3 | 5:ce108eeb878d | 244 | |
j3 | 5:ce108eeb878d | 245 | return rtn_val; |
j3 | 5:ce108eeb878d | 246 | } |
j3 | 5:ce108eeb878d | 247 | |
j3 | 5:ce108eeb878d | 248 | |
j3 | 5:ce108eeb878d | 249 | //********************************************************************* |
j3 | 5:ce108eeb878d | 250 | bool Ds2480b::OWSkipROM(void) |
j3 | 5:ce108eeb878d | 251 | { |
j3 | 13:d1bdb03703de | 252 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 253 | |
j3 | 5:ce108eeb878d | 254 | //TODO |
j3 | 5:ce108eeb878d | 255 | |
j3 | 5:ce108eeb878d | 256 | return rtn_val; |
j3 | 5:ce108eeb878d | 257 | } |
j3 | 5:ce108eeb878d | 258 | |
j3 | 5:ce108eeb878d | 259 | |
j3 | 5:ce108eeb878d | 260 | //********************************************************************* |
j3 | 5:ce108eeb878d | 261 | bool Ds2480b::OWMatchROM(void) |
j3 | 5:ce108eeb878d | 262 | { |
j3 | 13:d1bdb03703de | 263 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 264 | |
j3 | 5:ce108eeb878d | 265 | //TODO |
j3 | 5:ce108eeb878d | 266 | |
j3 | 5:ce108eeb878d | 267 | return rtn_val; |
j3 | 5:ce108eeb878d | 268 | } |
j3 | 5:ce108eeb878d | 269 | |
j3 | 5:ce108eeb878d | 270 | |
j3 | 5:ce108eeb878d | 271 | //********************************************************************* |
j3 | 5:ce108eeb878d | 272 | bool Ds2480b::OWOverdriveSkipROM(void) |
j3 | 5:ce108eeb878d | 273 | { |
j3 | 13:d1bdb03703de | 274 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 275 | |
j3 | 5:ce108eeb878d | 276 | //TODO |
j3 | 5:ce108eeb878d | 277 | |
j3 | 5:ce108eeb878d | 278 | return rtn_val; |
j3 | 5:ce108eeb878d | 279 | } |
j3 | 5:ce108eeb878d | 280 | |
j3 | 5:ce108eeb878d | 281 | |
j3 | 5:ce108eeb878d | 282 | //********************************************************************* |
j3 | 5:ce108eeb878d | 283 | bool Ds2480b::OWOverdriveMatchROM(void) |
j3 | 5:ce108eeb878d | 284 | { |
j3 | 13:d1bdb03703de | 285 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 286 | |
j3 | 5:ce108eeb878d | 287 | //TODO |
j3 | 5:ce108eeb878d | 288 | |
j3 | 5:ce108eeb878d | 289 | return rtn_val; |
j3 | 5:ce108eeb878d | 290 | } |
j3 | 5:ce108eeb878d | 291 | |
j3 | 5:ce108eeb878d | 292 | |
j3 | 5:ce108eeb878d | 293 | //********************************************************************* |
j3 | 5:ce108eeb878d | 294 | bool Ds2480b::OWResume(void) |
j3 | 5:ce108eeb878d | 295 | { |
j3 | 13:d1bdb03703de | 296 | bool rtn_val = false; |
j3 | 5:ce108eeb878d | 297 | |
j3 | 5:ce108eeb878d | 298 | //TODO |
j3 | 5:ce108eeb878d | 299 | |
j3 | 5:ce108eeb878d | 300 | return rtn_val; |
j3 | 5:ce108eeb878d | 301 | } |
j3 | 5:ce108eeb878d | 302 | |
j3 | 5:ce108eeb878d | 303 | |
j3 | 5:ce108eeb878d | 304 | //********************************************************************* |
j3 | 5:ce108eeb878d | 305 | uint8_t Ds2480b::OWSpeed(OW_SPEED new_speed) |
j3 | 3:644fc630f958 | 306 | { |
j3 | 13:d1bdb03703de | 307 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 308 | |
j3 | 3:644fc630f958 | 309 | //TODO |
j3 | 3:644fc630f958 | 310 | |
j3 | 3:644fc630f958 | 311 | return(rtn_val); |
j3 | 3:644fc630f958 | 312 | } |
j3 | 3:644fc630f958 | 313 | |
j3 | 3:644fc630f958 | 314 | |
j3 | 3:644fc630f958 | 315 | //********************************************************************* |
j3 | 5:ce108eeb878d | 316 | uint8_t Ds2480b::OWLevel(OW_LEVEL new_level) |
j3 | 3:644fc630f958 | 317 | { |
j3 | 13:d1bdb03703de | 318 | uint8_t rtn_val = 0; |
j3 | 3:644fc630f958 | 319 | |
j3 | 3:644fc630f958 | 320 | //TODO |
j3 | 3:644fc630f958 | 321 | |
j3 | 3:644fc630f958 | 322 | return(rtn_val); |
j3 | 3:644fc630f958 | 323 | } |
j3 | 3:644fc630f958 | 324 | |
j3 | 3:644fc630f958 | 325 | |
j3 | 3:644fc630f958 | 326 | //********************************************************************* |
j3 | 3:644fc630f958 | 327 | bool Ds2480b::OWWriteBytePower(uint8_t sendbyte) |
j3 | 3:644fc630f958 | 328 | { |
j3 | 13:d1bdb03703de | 329 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 330 | |
j3 | 3:644fc630f958 | 331 | //TODO |
j3 | 3:644fc630f958 | 332 | |
j3 | 3:644fc630f958 | 333 | return rtn_val; |
j3 | 3:644fc630f958 | 334 | } |
j3 | 3:644fc630f958 | 335 | |
j3 | 3:644fc630f958 | 336 | |
j3 | 3:644fc630f958 | 337 | //********************************************************************* |
j3 | 3:644fc630f958 | 338 | bool Ds2480b::OWReadBitPower(uint8_t applyPowerResponse) |
j3 | 3:644fc630f958 | 339 | { |
j3 | 13:d1bdb03703de | 340 | bool rtn_val = false; |
j3 | 3:644fc630f958 | 341 | |
j3 | 3:644fc630f958 | 342 | //TODO |
j3 | 3:644fc630f958 | 343 | |
j3 | 3:644fc630f958 | 344 | return rtn_val; |
j3 | 3:644fc630f958 | 345 | } |
j3 | 3:644fc630f958 | 346 | |
j3 | 3:644fc630f958 | 347 | |
j3 | 3:644fc630f958 | 348 | //********************************************************************* |
j3 | 5:ce108eeb878d | 349 | const uint8_t (&Ds2480b::OWgetROMnumber() const)[ROMnumberLen] |
j3 | 3:644fc630f958 | 350 | { |
j3 | 5:ce108eeb878d | 351 | return _rom_number; |
j3 | 3:644fc630f958 | 352 | } |