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/DS248x/ds248x.h@6:1faafa0b3cd7, 2016-02-09 (annotated)
- Committer:
- j3
- Date:
- Tue Feb 09 20:08:51 2016 +0000
- Revision:
- 6:1faafa0b3cd7
- Parent:
- 5:ce108eeb878d
- Child:
- 14:7b2886a50321
removed private constructor for setting i2c adrs from Ds248x class and added private fx which is used in body of other constructors.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 1:91e52f8ab8bf | 1 | /******************************************************************//** |
j3 | 1:91e52f8ab8bf | 2 | * @file ds248x.h |
j3 | 1:91e52f8ab8bf | 3 | * |
j3 | 1:91e52f8ab8bf | 4 | * @author Justin Jordan |
j3 | 1:91e52f8ab8bf | 5 | * |
j3 | 1:91e52f8ab8bf | 6 | * @version 0.0.0 |
j3 | 1:91e52f8ab8bf | 7 | * |
j3 | 1:91e52f8ab8bf | 8 | * Started: 30JAN16 |
j3 | 1:91e52f8ab8bf | 9 | * |
j3 | 1:91e52f8ab8bf | 10 | * Updated: |
j3 | 1:91e52f8ab8bf | 11 | * |
j3 | 1:91e52f8ab8bf | 12 | * @brief Header file for Ds248x I2C to 1-wire master |
j3 | 1:91e52f8ab8bf | 13 | *********************************************************************** |
j3 | 1:91e52f8ab8bf | 14 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
j3 | 1:91e52f8ab8bf | 15 | * |
j3 | 1:91e52f8ab8bf | 16 | * Permission is hereby granted, free of charge, to any person obtaining a |
j3 | 1:91e52f8ab8bf | 17 | * copy of this software and associated documentation files (the "Software"), |
j3 | 1:91e52f8ab8bf | 18 | * to deal in the Software without restriction, including without limitation |
j3 | 1:91e52f8ab8bf | 19 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
j3 | 1:91e52f8ab8bf | 20 | * and/or sell copies of the Software, and to permit persons to whom the |
j3 | 1:91e52f8ab8bf | 21 | * Software is furnished to do so, subject to the following conditions: |
j3 | 1:91e52f8ab8bf | 22 | * |
j3 | 1:91e52f8ab8bf | 23 | * The above copyright notice and this permission notice shall be included |
j3 | 1:91e52f8ab8bf | 24 | * in all copies or substantial portions of the Software. |
j3 | 1:91e52f8ab8bf | 25 | * |
j3 | 1:91e52f8ab8bf | 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
j3 | 1:91e52f8ab8bf | 27 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
j3 | 1:91e52f8ab8bf | 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
j3 | 1:91e52f8ab8bf | 29 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
j3 | 1:91e52f8ab8bf | 30 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
j3 | 1:91e52f8ab8bf | 31 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
j3 | 1:91e52f8ab8bf | 32 | * OTHER DEALINGS IN THE SOFTWARE. |
j3 | 1:91e52f8ab8bf | 33 | * |
j3 | 1:91e52f8ab8bf | 34 | * Except as contained in this notice, the name of Maxim Integrated |
j3 | 1:91e52f8ab8bf | 35 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
j3 | 1:91e52f8ab8bf | 36 | * Products, Inc. Branding Policy. |
j3 | 1:91e52f8ab8bf | 37 | * |
j3 | 1:91e52f8ab8bf | 38 | * The mere transfer of this software does not imply any licenses |
j3 | 1:91e52f8ab8bf | 39 | * of trade secrets, proprietary technology, copyrights, patents, |
j3 | 1:91e52f8ab8bf | 40 | * trademarks, maskwork rights, or any other form of intellectual |
j3 | 1:91e52f8ab8bf | 41 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
j3 | 1:91e52f8ab8bf | 42 | * ownership rights. |
j3 | 1:91e52f8ab8bf | 43 | **********************************************************************/ |
j3 | 1:91e52f8ab8bf | 44 | |
j3 | 1:91e52f8ab8bf | 45 | |
j3 | 1:91e52f8ab8bf | 46 | #ifndef DS248X_H |
j3 | 1:91e52f8ab8bf | 47 | #define DS248X_H |
j3 | 1:91e52f8ab8bf | 48 | |
j3 | 1:91e52f8ab8bf | 49 | |
j3 | 1:91e52f8ab8bf | 50 | #include "mbed.h" |
j3 | 1:91e52f8ab8bf | 51 | #include "OneWireInterface.h" |
j3 | 5:ce108eeb878d | 52 | #include "OneWireMastersShared.h" |
j3 | 1:91e52f8ab8bf | 53 | |
j3 | 1:91e52f8ab8bf | 54 | |
j3 | 1:91e52f8ab8bf | 55 | class Ds248x: public OneWireInterface |
j3 | 1:91e52f8ab8bf | 56 | { |
j3 | 1:91e52f8ab8bf | 57 | public: |
j3 | 1:91e52f8ab8bf | 58 | |
j3 | 5:ce108eeb878d | 59 | enum DS248X_I2C_ADRS |
j3 | 1:91e52f8ab8bf | 60 | { |
j3 | 1:91e52f8ab8bf | 61 | DS248X_I2C_ADRS0 = 0x18, |
j3 | 1:91e52f8ab8bf | 62 | DS248X_I2C_ADRS1, |
j3 | 1:91e52f8ab8bf | 63 | DS248X_I2C_ADRS2, |
j3 | 1:91e52f8ab8bf | 64 | DS248X_I2C_ADRS3, |
j3 | 1:91e52f8ab8bf | 65 | DS248X_I2C_ADRS4, |
j3 | 1:91e52f8ab8bf | 66 | DS248X_I2C_ADRS5, |
j3 | 1:91e52f8ab8bf | 67 | DS248X_I2C_ADRS6, |
j3 | 5:ce108eeb878d | 68 | DS248X_I2C_ADRS7 |
j3 | 5:ce108eeb878d | 69 | }; |
j3 | 5:ce108eeb878d | 70 | |
j3 | 5:ce108eeb878d | 71 | enum DS248X_CMDS |
j3 | 5:ce108eeb878d | 72 | { |
j3 | 5:ce108eeb878d | 73 | CMD_DRST = 0xF0, |
j3 | 5:ce108eeb878d | 74 | CMD_WCFG = 0xD2, |
j3 | 5:ce108eeb878d | 75 | CMD_A1WP = 0xC3, //DS2484 only |
j3 | 5:ce108eeb878d | 76 | CMD_CHSL = 0xC3, //DS2482-800 only |
j3 | 5:ce108eeb878d | 77 | CMD_SRP = 0xE1, |
j3 | 5:ce108eeb878d | 78 | CMD_1WRS = 0xB4, |
j3 | 5:ce108eeb878d | 79 | CMD_1WWB = 0xA5, |
j3 | 5:ce108eeb878d | 80 | CMD_1WRB = 0x96, |
j3 | 5:ce108eeb878d | 81 | CMD_1WSB = 0x87, |
j3 | 5:ce108eeb878d | 82 | CMD_1WT = 0x78 |
j3 | 5:ce108eeb878d | 83 | }; |
j3 | 5:ce108eeb878d | 84 | |
j3 | 5:ce108eeb878d | 85 | enum DS248X_CONFIG_BITS |
j3 | 5:ce108eeb878d | 86 | { |
j3 | 5:ce108eeb878d | 87 | CONFIG_APU = 0x01, |
j3 | 5:ce108eeb878d | 88 | CONFIG_PDN = 0x02, |
j3 | 5:ce108eeb878d | 89 | CONFIG_SPU = 0x04, |
j3 | 5:ce108eeb878d | 90 | CONFIG_1WS = 0x08 |
j3 | 5:ce108eeb878d | 91 | }; |
j3 | 5:ce108eeb878d | 92 | |
j3 | 5:ce108eeb878d | 93 | enum DS248X_STATUS_BITS |
j3 | 5:ce108eeb878d | 94 | { |
j3 | 5:ce108eeb878d | 95 | STATUS_1WB = 0x01, |
j3 | 5:ce108eeb878d | 96 | STATUS_PPD = 0x02, |
j3 | 5:ce108eeb878d | 97 | STATUS_SD = 0x04, |
j3 | 5:ce108eeb878d | 98 | STATUS_LL = 0x08, |
j3 | 5:ce108eeb878d | 99 | STATUS_RST = 0x10, |
j3 | 5:ce108eeb878d | 100 | STATUS_SBR = 0x20, |
j3 | 5:ce108eeb878d | 101 | STATUS_TSB = 0x40, |
j3 | 5:ce108eeb878d | 102 | STATUS_DIR = 0x80 |
j3 | 5:ce108eeb878d | 103 | }; |
j3 | 5:ce108eeb878d | 104 | |
j3 | 5:ce108eeb878d | 105 | enum DS2484_ADJST_PARAMS |
j3 | 5:ce108eeb878d | 106 | { |
j3 | 5:ce108eeb878d | 107 | TRSTL = 0, |
j3 | 5:ce108eeb878d | 108 | TRSTL_OD, |
j3 | 5:ce108eeb878d | 109 | TMSP, |
j3 | 5:ce108eeb878d | 110 | TMSP_OD, |
j3 | 5:ce108eeb878d | 111 | TW0L, |
j3 | 5:ce108eeb878d | 112 | TW0L_OD, |
j3 | 5:ce108eeb878d | 113 | TREC0, //OD NA |
j3 | 5:ce108eeb878d | 114 | RWPU = 8 //OD NA, see DS2484 datasheet page 13 |
j3 | 5:ce108eeb878d | 115 | }; |
j3 | 5:ce108eeb878d | 116 | |
j3 | 5:ce108eeb878d | 117 | static const size_t POLL_LIMIT = 200; |
j3 | 1:91e52f8ab8bf | 118 | |
j3 | 3:644fc630f958 | 119 | /** |
j3 | 3:644fc630f958 | 120 | * Member functions that directly support DS248x I2C to 1-wire |
j3 | 3:644fc630f958 | 121 | * masters are documented in this file. Virtual function |
j3 | 3:644fc630f958 | 122 | * inerited from the interface class 'OneWireInterface' |
j3 | 3:644fc630f958 | 123 | * are documented in 'OneWireInterface.h', trying to follow |
j3 | 3:644fc630f958 | 124 | * a 'DRY' methodology, Don't Repeat Yourself. |
j3 | 3:644fc630f958 | 125 | */ |
j3 | 3:644fc630f958 | 126 | |
j3 | 1:91e52f8ab8bf | 127 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 128 | * @brief Ds248x constructor |
j3 | 1:91e52f8ab8bf | 129 | * |
j3 | 1:91e52f8ab8bf | 130 | * @details allows user to use existing I2C object |
j3 | 1:91e52f8ab8bf | 131 | * |
j3 | 1:91e52f8ab8bf | 132 | * On Entry: |
j3 | 1:91e52f8ab8bf | 133 | * @param[in] p_i2c_bus - pointer to existing I2C object |
j3 | 1:91e52f8ab8bf | 134 | * |
j3 | 1:91e52f8ab8bf | 135 | * On Exit: |
j3 | 1:91e52f8ab8bf | 136 | * @return |
j3 | 1:91e52f8ab8bf | 137 | **************************************************************/ |
j3 | 5:ce108eeb878d | 138 | Ds248x(I2C &i2c_bus, DS248X_I2C_ADRS adrs); |
j3 | 1:91e52f8ab8bf | 139 | |
j3 | 1:91e52f8ab8bf | 140 | |
j3 | 1:91e52f8ab8bf | 141 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 142 | * @brief Ds248x constructor |
j3 | 1:91e52f8ab8bf | 143 | * |
j3 | 3:644fc630f958 | 144 | * @details Object instantiates a new I2C object with no |
j3 | 3:644fc630f958 | 145 | * public access |
j3 | 1:91e52f8ab8bf | 146 | * |
j3 | 1:91e52f8ab8bf | 147 | * On Entry: |
j3 | 1:91e52f8ab8bf | 148 | * @param[in] sda - sda pin of I2C bus |
j3 | 1:91e52f8ab8bf | 149 | * @param[in] scl - scl pin of I2C bus |
j3 | 1:91e52f8ab8bf | 150 | * |
j3 | 1:91e52f8ab8bf | 151 | * On Exit: |
j3 | 1:91e52f8ab8bf | 152 | * @return |
j3 | 1:91e52f8ab8bf | 153 | **************************************************************/ |
j3 | 5:ce108eeb878d | 154 | Ds248x(PinName sda, PinName scl, DS248X_I2C_ADRS adrs); |
j3 | 1:91e52f8ab8bf | 155 | |
j3 | 1:91e52f8ab8bf | 156 | |
j3 | 1:91e52f8ab8bf | 157 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 158 | * @brief Ds248x destructor |
j3 | 1:91e52f8ab8bf | 159 | * |
j3 | 1:91e52f8ab8bf | 160 | * @details deletes I2C object if owner |
j3 | 1:91e52f8ab8bf | 161 | * |
j3 | 1:91e52f8ab8bf | 162 | * On Entry: |
j3 | 1:91e52f8ab8bf | 163 | * |
j3 | 1:91e52f8ab8bf | 164 | * On Exit: |
j3 | 1:91e52f8ab8bf | 165 | * @return |
j3 | 1:91e52f8ab8bf | 166 | **************************************************************/ |
j3 | 5:ce108eeb878d | 167 | virtual ~Ds248x(); |
j3 | 1:91e52f8ab8bf | 168 | |
j3 | 1:91e52f8ab8bf | 169 | |
j3 | 1:91e52f8ab8bf | 170 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 171 | * @brief detect() |
j3 | 1:91e52f8ab8bf | 172 | * |
j3 | 1:91e52f8ab8bf | 173 | * @details Detect routine that performs a device reset |
j3 | 1:91e52f8ab8bf | 174 | * followed by writing the configuration byte to default |
j3 | 1:91e52f8ab8bf | 175 | * values: |
j3 | 1:91e52f8ab8bf | 176 | * 1-Wire speed (c1WS) = standard (0) |
j3 | 1:91e52f8ab8bf | 177 | * Strong pull-up (cSPU) = off (0) |
j3 | 1:91e52f8ab8bf | 178 | * Presence pulse masking (cPPM) = off (0) |
j3 | 1:91e52f8ab8bf | 179 | * Active pull-up (cAPU) = on (CONFIG_APU = 0x01) |
j3 | 1:91e52f8ab8bf | 180 | * |
j3 | 1:91e52f8ab8bf | 181 | * On Entry: |
j3 | 1:91e52f8ab8bf | 182 | * |
j3 | 1:91e52f8ab8bf | 183 | * On Exit: |
j3 | 1:91e52f8ab8bf | 184 | * @return TRUE if device was detected and written |
j3 | 1:91e52f8ab8bf | 185 | * FALSE device not detected or failure to write |
j3 | 1:91e52f8ab8bf | 186 | * configuration byte |
j3 | 1:91e52f8ab8bf | 187 | **************************************************************/ |
j3 | 2:02d228c25fd4 | 188 | bool detect(void); |
j3 | 1:91e52f8ab8bf | 189 | |
j3 | 1:91e52f8ab8bf | 190 | |
j3 | 1:91e52f8ab8bf | 191 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 192 | * @brief reset() |
j3 | 1:91e52f8ab8bf | 193 | * |
j3 | 1:91e52f8ab8bf | 194 | * @details Perform a device reset on the Ds248x |
j3 | 1:91e52f8ab8bf | 195 | * |
j3 | 1:91e52f8ab8bf | 196 | * On Entry: |
j3 | 1:91e52f8ab8bf | 197 | * |
j3 | 1:91e52f8ab8bf | 198 | * On Exit: |
j3 | 1:91e52f8ab8bf | 199 | * @return TRUE if device was reset |
j3 | 1:91e52f8ab8bf | 200 | * FALSE device not detected or failure to perform reset |
j3 | 1:91e52f8ab8bf | 201 | **************************************************************/ |
j3 | 2:02d228c25fd4 | 202 | bool reset(void); |
j3 | 1:91e52f8ab8bf | 203 | |
j3 | 1:91e52f8ab8bf | 204 | |
j3 | 1:91e52f8ab8bf | 205 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 206 | * @brief write_config() |
j3 | 1:91e52f8ab8bf | 207 | * |
j3 | 1:91e52f8ab8bf | 208 | * @details Write the configuration register in the Ds248x. The |
j3 | 1:91e52f8ab8bf | 209 | * configuration options are provided in the lower nibble |
j3 | 1:91e52f8ab8bf | 210 | * of the provided config byte. The uppper nibble is |
j3 | 1:91e52f8ab8bf | 211 | * bitwise inverted when written to the Ds248x. |
j3 | 1:91e52f8ab8bf | 212 | * |
j3 | 1:91e52f8ab8bf | 213 | * On Entry: |
j3 | 1:91e52f8ab8bf | 214 | * @param[in] config - lower nib of configuration register |
j3 | 1:91e52f8ab8bf | 215 | * |
j3 | 1:91e52f8ab8bf | 216 | * On Exit: |
j3 | 1:91e52f8ab8bf | 217 | * @return TRUE: config written and response correct |
j3 | 1:91e52f8ab8bf | 218 | * FALSE: response incorrect |
j3 | 1:91e52f8ab8bf | 219 | **************************************************************/ |
j3 | 2:02d228c25fd4 | 220 | bool write_config(uint8_t config); |
j3 | 2:02d228c25fd4 | 221 | |
j3 | 2:02d228c25fd4 | 222 | |
j3 | 2:02d228c25fd4 | 223 | /**********************************************************//** |
j3 | 2:02d228c25fd4 | 224 | * @brief channel_select() |
j3 | 2:02d228c25fd4 | 225 | * |
j3 | 2:02d228c25fd4 | 226 | * @details Select the 1-Wire channel on a DS2482-800. |
j3 | 2:02d228c25fd4 | 227 | * Min channel = 1 |
j3 | 2:02d228c25fd4 | 228 | * |
j3 | 2:02d228c25fd4 | 229 | * On Entry: |
j3 | 2:02d228c25fd4 | 230 | * @param[in] channel - desired channel of the DS2482 |
j3 | 2:02d228c25fd4 | 231 | * |
j3 | 2:02d228c25fd4 | 232 | * On Exit: |
j3 | 2:02d228c25fd4 | 233 | * @return TRUE if channel selected |
j3 | 2:02d228c25fd4 | 234 | * FALSE device not detected or failure to perform select |
j3 | 2:02d228c25fd4 | 235 | **************************************************************/ |
j3 | 2:02d228c25fd4 | 236 | bool channel_select(uint8_t channel); |
j3 | 1:91e52f8ab8bf | 237 | |
j3 | 1:91e52f8ab8bf | 238 | |
j3 | 1:91e52f8ab8bf | 239 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 240 | * @brief adjust_timing() |
j3 | 1:91e52f8ab8bf | 241 | * |
j3 | 2:02d228c25fd4 | 242 | * @details adjustable timming available in DS2484 only |
j3 | 1:91e52f8ab8bf | 243 | * |
j3 | 1:91e52f8ab8bf | 244 | * On Entry: |
j3 | 1:91e52f8ab8bf | 245 | * @param[in] param - 1 of 8 adjustable parameters |
j3 | 1:91e52f8ab8bf | 246 | * @param[in] val - new value for parameter, see datasheet |
j3 | 1:91e52f8ab8bf | 247 | * for codes |
j3 | 1:91e52f8ab8bf | 248 | * |
j3 | 1:91e52f8ab8bf | 249 | * On Exit: |
j3 | 1:91e52f8ab8bf | 250 | * @return TRUE: parameter successfully adjusted |
j3 | 1:91e52f8ab8bf | 251 | * FALSE: failed to adjust parameter |
j3 | 1:91e52f8ab8bf | 252 | **************************************************************/ |
j3 | 2:02d228c25fd4 | 253 | bool adjust_timing(uint8_t param, uint8_t val); |
j3 | 1:91e52f8ab8bf | 254 | |
j3 | 1:91e52f8ab8bf | 255 | |
j3 | 1:91e52f8ab8bf | 256 | /**********************************************************//** |
j3 | 1:91e52f8ab8bf | 257 | * @brief search_triplet() |
j3 | 1:91e52f8ab8bf | 258 | * |
j3 | 1:91e52f8ab8bf | 259 | * @details Use the Ds248x help command '1-Wire triplet' to perform |
j3 | 1:91e52f8ab8bf | 260 | * one bit of a 1-Wire search. This command does two read |
j3 | 1:91e52f8ab8bf | 261 | * bits and one write bit. The write bit is either the |
j3 | 1:91e52f8ab8bf | 262 | * default direction (all device have same bit) or in case |
j3 | 1:91e52f8ab8bf | 263 | * of a discrepancy, the 'search_direction' parameter is |
j3 | 1:91e52f8ab8bf | 264 | * used. |
j3 | 1:91e52f8ab8bf | 265 | * |
j3 | 1:91e52f8ab8bf | 266 | * On Entry: |
j3 | 1:91e52f8ab8bf | 267 | * @param[in] search_direction |
j3 | 1:91e52f8ab8bf | 268 | * |
j3 | 1:91e52f8ab8bf | 269 | * On Exit: |
j3 | 1:91e52f8ab8bf | 270 | * @return The Ds248x status byte result from the triplet command |
j3 | 1:91e52f8ab8bf | 271 | **************************************************************/ |
j3 | 1:91e52f8ab8bf | 272 | uint8_t search_triplet(uint8_t search_direction); |
j3 | 1:91e52f8ab8bf | 273 | |
j3 | 5:ce108eeb878d | 274 | |
j3 | 3:644fc630f958 | 275 | /***** OW API ****************************************************/ |
j3 | 2:02d228c25fd4 | 276 | virtual bool OWReset(); |
j3 | 1:91e52f8ab8bf | 277 | |
j3 | 1:91e52f8ab8bf | 278 | virtual void OWWriteBit(uint8_t sendbit); |
j3 | 1:91e52f8ab8bf | 279 | |
j3 | 1:91e52f8ab8bf | 280 | virtual uint8_t OWReadBit(); |
j3 | 1:91e52f8ab8bf | 281 | |
j3 | 1:91e52f8ab8bf | 282 | virtual uint8_t OWTouchBit(uint8_t sendbit); |
j3 | 3:644fc630f958 | 283 | |
j3 | 2:02d228c25fd4 | 284 | virtual bool OWWriteByte(uint8_t sendbyte); |
j3 | 3:644fc630f958 | 285 | |
j3 | 1:91e52f8ab8bf | 286 | virtual uint8_t OWReadByte(void); |
j3 | 3:644fc630f958 | 287 | |
j3 | 1:91e52f8ab8bf | 288 | virtual uint8_t OWTouchByte(uint8_t sendbyte); |
j3 | 3:644fc630f958 | 289 | |
j3 | 1:91e52f8ab8bf | 290 | virtual void OWBlock(uint8_t *tran_buf, uint8_t tran_len); |
j3 | 5:ce108eeb878d | 291 | |
j3 | 5:ce108eeb878d | 292 | virtual void OWWriteBlock(const uint8_t *tran_buf, uint8_t tran_len); |
j3 | 5:ce108eeb878d | 293 | |
j3 | 5:ce108eeb878d | 294 | virtual void OWReadBlock(uint8_t *recv_buf, uint8_t recv_len); |
j3 | 3:644fc630f958 | 295 | |
j3 | 2:02d228c25fd4 | 296 | virtual bool OWFirst(void); |
j3 | 3:644fc630f958 | 297 | |
j3 | 2:02d228c25fd4 | 298 | virtual bool OWNext(void); |
j3 | 3:644fc630f958 | 299 | |
j3 | 2:02d228c25fd4 | 300 | virtual bool OWVerify(void); |
j3 | 3:644fc630f958 | 301 | |
j3 | 1:91e52f8ab8bf | 302 | virtual void OWTargetSetup(uint8_t family_code); |
j3 | 3:644fc630f958 | 303 | |
j3 | 1:91e52f8ab8bf | 304 | virtual void OWFamilySkipSetup(void); |
j3 | 1:91e52f8ab8bf | 305 | |
j3 | 2:02d228c25fd4 | 306 | virtual bool OWSearch(void); |
j3 | 5:ce108eeb878d | 307 | |
j3 | 5:ce108eeb878d | 308 | virtual bool OWReadROM(void); |
j3 | 5:ce108eeb878d | 309 | |
j3 | 5:ce108eeb878d | 310 | virtual bool OWSkipROM(void); |
j3 | 5:ce108eeb878d | 311 | |
j3 | 5:ce108eeb878d | 312 | virtual bool OWMatchROM(void); |
j3 | 5:ce108eeb878d | 313 | |
j3 | 5:ce108eeb878d | 314 | virtual bool OWOverdriveSkipROM(void); |
j3 | 5:ce108eeb878d | 315 | |
j3 | 5:ce108eeb878d | 316 | virtual bool OWOverdriveMatchROM(void); |
j3 | 5:ce108eeb878d | 317 | |
j3 | 5:ce108eeb878d | 318 | virtual bool OWResume(void); |
j3 | 3:644fc630f958 | 319 | |
j3 | 5:ce108eeb878d | 320 | virtual uint8_t OWSpeed(OW_SPEED new_speed); |
j3 | 3:644fc630f958 | 321 | |
j3 | 5:ce108eeb878d | 322 | virtual uint8_t OWLevel(OW_LEVEL new_level); |
j3 | 3:644fc630f958 | 323 | |
j3 | 2:02d228c25fd4 | 324 | virtual bool OWWriteBytePower(uint8_t sendbyte); |
j3 | 3:644fc630f958 | 325 | |
j3 | 2:02d228c25fd4 | 326 | virtual bool OWReadBitPower(uint8_t applyPowerResponse); |
j3 | 3:644fc630f958 | 327 | |
j3 | 5:ce108eeb878d | 328 | virtual const uint8_t (&OWgetROMnumber() const)[ROMnumberLen]; |
j3 | 2:02d228c25fd4 | 329 | |
j3 | 1:91e52f8ab8bf | 330 | private: |
j3 | 1:91e52f8ab8bf | 331 | |
j3 | 6:1faafa0b3cd7 | 332 | //private fx for initializing _w_adrs and _r_adrs |
j3 | 6:1faafa0b3cd7 | 333 | void set_i2c_adrs(DS248X_I2C_ADRS adrs); |
j3 | 5:ce108eeb878d | 334 | |
j3 | 1:91e52f8ab8bf | 335 | I2C *_p_i2c_bus; |
j3 | 1:91e52f8ab8bf | 336 | uint8_t _w_adrs, _r_adrs; |
j3 | 5:ce108eeb878d | 337 | bool _i2c_owner; |
j3 | 2:02d228c25fd4 | 338 | |
j3 | 2:02d228c25fd4 | 339 | // ds248x state |
j3 | 2:02d228c25fd4 | 340 | uint8_t _short_detected; |
j3 | 2:02d228c25fd4 | 341 | uint8_t _c1WS, _cSPU, _cPDN, _cAPU; |
j3 | 2:02d228c25fd4 | 342 | |
j3 | 2:02d228c25fd4 | 343 | // Search state |
j3 | 5:ce108eeb878d | 344 | uint8_t _rom_number[ROMnumberLen]; |
j3 | 2:02d228c25fd4 | 345 | uint8_t _last_discrepancy; |
j3 | 2:02d228c25fd4 | 346 | uint8_t _last_family_discrepancy; |
j3 | 2:02d228c25fd4 | 347 | uint8_t _last_device_flag; |
j3 | 5:ce108eeb878d | 348 | uint8_t _crc8; |
j3 | 1:91e52f8ab8bf | 349 | }; |
j3 | 1:91e52f8ab8bf | 350 | |
j3 | 1:91e52f8ab8bf | 351 | #endif /*DS248X_H*/ |