Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAXREFDES131_Qt_Demo MAXREFDES130_131_Demo
OWGridEye.h
00001 /********************************************************************** 00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Maxim Integrated 00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00024 * Products, Inc. Branding Policy. 00025 * 00026 * The mere transfer of this software does not imply any licenses 00027 * of trade secrets, proprietary technology, copyrights, patents, 00028 * trademarks, maskwork rights, or any other form of intellectual 00029 * property whatsoever. Maxim Integrated Products, Inc. retains all 00030 * ownership rights. 00031 **********************************************************************/ 00032 00033 00034 #ifndef OWGRIDEYE_H 00035 #define OWGRIDEYE_H 00036 00037 00038 #include "mbed.h" 00039 #include "Slaves/Bridges/Bridges.h" 00040 #include "Slaves/Switches/Switches.h" 00041 00042 using namespace OneWire; 00043 00044 #include "API_Level_1/grideye_api_lv1.h" 00045 #include "API_Level_2/grideye_api_lv2.h" 00046 #include "API_Level_3/grideye_api_lv3.h" 00047 00048 00049 /** 00050 * @brief Object for interfacing to MAXREFDES131# 00051 * 00052 * @details MAXREFDES131# combines the DS28E17 1-wire to I2C bridge 00053 * with the Panasonic AMG8833 GridEye sensor. The reference design also 00054 * includes a DS2413 2ch open drain switch for controlling the MAX4717 00055 * dual SPDT analog switch. The DS28E17 and AMG8833 are connected to 00056 * the 1-wire bus via COM2 of the MAX4717 and COM1 is used for 00057 * daisy-chaining additional modules. Disconnecting the DS28E17/AMG8833 00058 * from the main 1-wire branch puts both devices to sleep and reduces current 00059 * consumption from 10mA to a couple hundred uA. 00060 */ 00061 class OWGridEye 00062 { 00063 private: 00064 DS2413 m_switch; 00065 DS28E17 m_i2c_bridge; 00066 00067 static const uint8_t I2C_ADRS = 0x68; 00068 00069 public: 00070 00071 /** 00072 * @brief OWGridEye command results 00073 */ 00074 enum CmdResult 00075 { 00076 Success, 00077 OpFailure 00078 }; 00079 00080 /** 00081 * @brief AMG8833 register map 00082 */ 00083 enum GridEyeRegister 00084 { 00085 POWER_CONTROL, 00086 RESET, 00087 FRAME_RATE, 00088 INT_CONTROL, 00089 STATUS, 00090 STATUS_CLEAR, 00091 AVERAGE = 7, 00092 INT_LEVEL_1, 00093 INT_LEVEL_2, 00094 INT_LEVEL_3, 00095 INT_LEVEL_4, 00096 INT_LEVEL_5, 00097 INT_LEVEL_6, 00098 THERMISTOR_LOW, 00099 THERMISTOR_HI, 00100 INT_1, 00101 INT_2, 00102 INT_3, 00103 INT_4, 00104 INT_5, 00105 INT_6, 00106 INT_7, 00107 INT_8, 00108 PIXEL_BASE_ADRS = 0x80 00109 }; 00110 00111 static const uint8_t DS2413_FAMILY_CODE = 0x3A; 00112 00113 static const uint8_t DS28E17_FAMILY_CODE = 0x19; 00114 00115 /** 00116 * @brief OWGridEye Constructor 00117 * 00118 * @details setOWSwitchRomId() and setI2CBridgeRomId() must be 00119 * called before any other member fxs. 00120 * 00121 * @param[in] selector - MultidropRomIterator object that 00122 * encapsulates ROM fxs of 1-wire protocol 00123 */ 00124 OWGridEye(RandomAccessRomIterator & selector); 00125 00126 00127 /** 00128 * @brief setOWSwitchRomId 00129 * 00130 * @details sets the RomId of the DS2413 00131 * 00132 * On Entry: 00133 * @param[in] romId - RomId of the DS2413 for this module 00134 * 00135 * @return none 00136 */ 00137 void setOWSwitchRomId(const RomId & romId) 00138 { 00139 m_switch.setRomId(romId); 00140 }; 00141 00142 00143 /** 00144 * @brief getOWSwitchRomId 00145 * 00146 * @details Gets the RomId of the DS2413 for this sensor. 00147 * The romId must have been set first. 00148 * 00149 * @return RomId of the DS2413 for this sensor 00150 */ 00151 RomId getOWSwitchRomId(void) 00152 { 00153 return m_switch.romId(); 00154 }; 00155 00156 00157 /** 00158 * @brief setI2CBridgeRomId 00159 * 00160 * @details sets the RomId of the DS28E17 00161 * 00162 * On Entry: 00163 * @param[in] romId - RomId of the DS28E17 for this module 00164 * 00165 * @return none 00166 */ 00167 void setI2CBridgeRomId(const RomId & romId) 00168 { 00169 m_i2c_bridge.setRomId(romId); 00170 }; 00171 00172 00173 /** 00174 * @brief getI2CBridgeRomId 00175 * 00176 * @details Gets the RomId of the DS28E17 for this sensor. 00177 * The romId must have been set first. 00178 * 00179 * @return RomId of the DS28E17 for this sensor 00180 */ 00181 RomId getI2CBridgeRomId(void) 00182 { 00183 return m_i2c_bridge.romId(); 00184 }; 00185 00186 00187 /** 00188 * @brief disconnectGridEye 00189 * 00190 * @details Disconnects the DS28E17 and AMG8833 sensor putting both 00191 * to sleep 00192 * 00193 * @return CmdResult - result of operation 00194 */ 00195 CmdResult disconnectGridEye(void); 00196 00197 00198 /** 00199 * @brief connectGridEye 00200 * 00201 * @details Connects the DS28E17 and AMG883 to 1-wire bus 00202 * 00203 * @return CmdResult - result of operation 00204 */ 00205 CmdResult connectGridEye(void); 00206 00207 00208 /** 00209 * @brief connectOWbus 00210 * 00211 * @details Connects down stream devices on 1-wire bus 00212 * 00213 * @return CmdResult - result of operation 00214 */ 00215 CmdResult connectOWbus(void); 00216 00217 00218 /** 00219 * @brief disconnectOWbus 00220 * 00221 * @details Disconnects down stream devices on 1-wire bus 00222 * 00223 * @return CmdResult - result of operation 00224 */ 00225 CmdResult disconnectOWbus(void); 00226 00227 00228 /** 00229 * @brief gridEyeAccess 00230 * 00231 * @details Provides read/write access to the AMG8833 00232 * 00233 * On Entry: 00234 * @param[in] readWrite - Boolean flag indicating desired access 00235 * @param[in] regAdrs - AMG8833 register to start reading/writting 00236 * from/to 00237 * @param[in] numBytes - Number of bytes to read/write 00238 * @param[in] dataBuf - Pointer to data buffer for storing data in 00239 * on read, or data to be written on write 00240 * 00241 * On Exit: 00242 * @param[out] dataBuf - Read data on read operation 00243 * 00244 * @return CmdResult - result of operation 00245 */ 00246 CmdResult gridEyeAccess(bool readWrite, GridEyeRegister regAdrs, uint8_t numBytes, uint8_t * dataBuf); 00247 00248 00249 /** 00250 * @brief gridEyeGetThermistor 00251 * 00252 * @details Gets internal thermistor temperature 00253 * 00254 * On Entry: 00255 * @param[in] thermTemp - reference to int16_t var that will be overwritten 00256 * with thermistor data 00257 * 00258 * On Exit: 00259 * @param[out] thermTemp - thermistor data 00260 * 00261 * @return CmdResult - result of operation 00262 */ 00263 CmdResult gridEyeGetThermistor(int16_t & thermTemp); 00264 00265 00266 /** 00267 * @brief gridEyeGetPixelTemperature 00268 * 00269 * @details Gets individual pixel temperature 00270 * 00271 * On Entry: 00272 * @param[in] pixelAdrs - address of pixel to read 00273 * @param[in] pixelTemp - reference to int16_t var that will be overwritten 00274 * with thermistor data 00275 * 00276 * On Exit: 00277 * @param[out] pixelTemp - pixel data 00278 * 00279 * @return CmdResult - result of operation 00280 */ 00281 CmdResult gridEyeGetPixelTemperature(uint8_t pixelAdrs, int16_t & pixelTemp); 00282 00283 00284 /** 00285 * @brief gridEyeGetFrameTemperature 00286 * 00287 * @details Gets pixel frame(64 pixels) temperature 00288 * 00289 * On Entry: 00290 * @param[in] frameTemp - buffer to hold data 00291 * 00292 * On Exit: 00293 * @param[out] frameTemp - pixel data 00294 * 00295 * @return CmdResult - result of operation 00296 */ 00297 CmdResult gridEyeGetFrameTemperature(int16_t * frameTemp); 00298 }; 00299 00300 00301 #endif /*OWGridEye_H*/
Generated on Thu Jul 14 2022 15:33:01 by
1.7.2