The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_SDT32620B/TOOLCHAIN_IAR/owm.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 167:84c0a372a020 | 1 | /** |
AnnaBridge | 167:84c0a372a020 | 2 | * @file |
AnnaBridge | 167:84c0a372a020 | 3 | * @brief Registers, Bit Masks and Bit Positions for the 1-Wire Master |
AnnaBridge | 167:84c0a372a020 | 4 | * peripheral module. |
AnnaBridge | 167:84c0a372a020 | 5 | */ |
AnnaBridge | 167:84c0a372a020 | 6 | /* **************************************************************************** |
AnnaBridge | 167:84c0a372a020 | 7 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
AnnaBridge | 167:84c0a372a020 | 8 | * |
AnnaBridge | 167:84c0a372a020 | 9 | * Permission is hereby granted, free of charge, to any person obtaining a |
AnnaBridge | 167:84c0a372a020 | 10 | * copy of this software and associated documentation files (the "Software"), |
AnnaBridge | 167:84c0a372a020 | 11 | * to deal in the Software without restriction, including without limitation |
AnnaBridge | 167:84c0a372a020 | 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
AnnaBridge | 167:84c0a372a020 | 13 | * and/or sell copies of the Software, and to permit persons to whom the |
AnnaBridge | 167:84c0a372a020 | 14 | * Software is furnished to do so, subject to the following conditions: |
AnnaBridge | 167:84c0a372a020 | 15 | * |
AnnaBridge | 167:84c0a372a020 | 16 | * The above copyright notice and this permission notice shall be included |
AnnaBridge | 167:84c0a372a020 | 17 | * in all copies or substantial portions of the Software. |
AnnaBridge | 167:84c0a372a020 | 18 | * |
AnnaBridge | 167:84c0a372a020 | 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
AnnaBridge | 167:84c0a372a020 | 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
AnnaBridge | 167:84c0a372a020 | 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
AnnaBridge | 167:84c0a372a020 | 22 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
AnnaBridge | 167:84c0a372a020 | 23 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
AnnaBridge | 167:84c0a372a020 | 24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
AnnaBridge | 167:84c0a372a020 | 25 | * OTHER DEALINGS IN THE SOFTWARE. |
AnnaBridge | 167:84c0a372a020 | 26 | * |
AnnaBridge | 167:84c0a372a020 | 27 | * Except as contained in this notice, the name of Maxim Integrated |
AnnaBridge | 167:84c0a372a020 | 28 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
AnnaBridge | 167:84c0a372a020 | 29 | * Products, Inc. Branding Policy. |
AnnaBridge | 167:84c0a372a020 | 30 | * |
AnnaBridge | 167:84c0a372a020 | 31 | * The mere transfer of this software does not imply any licenses |
AnnaBridge | 167:84c0a372a020 | 32 | * of trade secrets, proprietary technology, copyrights, patents, |
AnnaBridge | 167:84c0a372a020 | 33 | * trademarks, maskwork rights, or any other form of intellectual |
AnnaBridge | 167:84c0a372a020 | 34 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
AnnaBridge | 167:84c0a372a020 | 35 | * ownership rights. |
AnnaBridge | 167:84c0a372a020 | 36 | * |
AnnaBridge | 167:84c0a372a020 | 37 | * $Date: 2016-03-14 10:08:53 -0500 (Mon, 14 Mar 2016) $ |
AnnaBridge | 167:84c0a372a020 | 38 | * $Revision: 21855 $ |
AnnaBridge | 167:84c0a372a020 | 39 | * |
AnnaBridge | 167:84c0a372a020 | 40 | **************************************************************************** */ |
AnnaBridge | 167:84c0a372a020 | 41 | |
AnnaBridge | 167:84c0a372a020 | 42 | /* Define to prevent redundant inclusion */ |
AnnaBridge | 167:84c0a372a020 | 43 | #ifndef _OWM_H_ |
AnnaBridge | 167:84c0a372a020 | 44 | #define _OWM_H_ |
AnnaBridge | 167:84c0a372a020 | 45 | |
AnnaBridge | 167:84c0a372a020 | 46 | /* **** Includes **** */ |
AnnaBridge | 167:84c0a372a020 | 47 | #include "mxc_config.h" |
AnnaBridge | 167:84c0a372a020 | 48 | #include "mxc_sys.h" |
AnnaBridge | 167:84c0a372a020 | 49 | #include "owm_regs.h" |
AnnaBridge | 167:84c0a372a020 | 50 | |
AnnaBridge | 167:84c0a372a020 | 51 | #ifdef __cplusplus |
AnnaBridge | 167:84c0a372a020 | 52 | extern "C" { |
AnnaBridge | 167:84c0a372a020 | 53 | #endif |
AnnaBridge | 167:84c0a372a020 | 54 | |
AnnaBridge | 167:84c0a372a020 | 55 | /** |
AnnaBridge | 167:84c0a372a020 | 56 | * @ingroup periphlibs |
AnnaBridge | 167:84c0a372a020 | 57 | * @defgroup owm 1-Wire Master (OWM) |
AnnaBridge | 167:84c0a372a020 | 58 | * @{ |
AnnaBridge | 167:84c0a372a020 | 59 | */ |
AnnaBridge | 167:84c0a372a020 | 60 | |
AnnaBridge | 167:84c0a372a020 | 61 | /* **** Definitions **** */ |
AnnaBridge | 167:84c0a372a020 | 62 | |
AnnaBridge | 167:84c0a372a020 | 63 | /** |
AnnaBridge | 167:84c0a372a020 | 64 | * Enumeration type for 1-Wire Overdrive Speed Options. |
AnnaBridge | 167:84c0a372a020 | 65 | */ |
AnnaBridge | 167:84c0a372a020 | 66 | typedef enum { |
AnnaBridge | 167:84c0a372a020 | 67 | OWM_OVERDRIVE_UNUSED = MXC_V_OWM_CTRL_STAT_OD_SPEC_MODE_12US, /**< 12us Overdrive Speed Select. */ |
AnnaBridge | 167:84c0a372a020 | 68 | OWM_OVERDRIVE_12US = MXC_V_OWM_CTRL_STAT_OD_SPEC_MODE_12US, /**< 12us Overdrive Speed Select. */ |
AnnaBridge | 167:84c0a372a020 | 69 | OWM_OVERDRIVE_10US = MXC_V_OWM_CTRL_STAT_OD_SPEC_MODE_10US /**< 10us Overdrive Speed Select. */ |
AnnaBridge | 167:84c0a372a020 | 70 | } owm_overdrive_t; |
AnnaBridge | 167:84c0a372a020 | 71 | |
AnnaBridge | 167:84c0a372a020 | 72 | /** |
AnnaBridge | 167:84c0a372a020 | 73 | * Enumeration type for specifying options for 1-Wire external pullup mode. |
AnnaBridge | 167:84c0a372a020 | 74 | */ |
AnnaBridge | 167:84c0a372a020 | 75 | typedef enum { |
AnnaBridge | 167:84c0a372a020 | 76 | OWM_EXT_PU_ACT_HIGH = 0, /**< Pullup pin is active high when enabled. */ |
AnnaBridge | 167:84c0a372a020 | 77 | OWM_EXT_PU_ACT_LOW = 1, /**< Pullup pin is active low when enabled. */ |
AnnaBridge | 167:84c0a372a020 | 78 | OWM_EXT_PU_UNUSED = 2, /**< Pullup pin is not used for an external pullup. */ |
AnnaBridge | 167:84c0a372a020 | 79 | } owm_ext_pu_t; |
AnnaBridge | 167:84c0a372a020 | 80 | |
AnnaBridge | 167:84c0a372a020 | 81 | /** |
AnnaBridge | 167:84c0a372a020 | 82 | * Structure type for 1-Wire Master configuration. |
AnnaBridge | 167:84c0a372a020 | 83 | */ |
AnnaBridge | 167:84c0a372a020 | 84 | typedef struct { |
AnnaBridge | 167:84c0a372a020 | 85 | uint8_t int_pu_en; /**< 1 = internal pullup on. */ |
AnnaBridge | 167:84c0a372a020 | 86 | owm_ext_pu_t ext_pu_mode; /**< See #owm_ext_pu_t. */ |
AnnaBridge | 167:84c0a372a020 | 87 | uint8_t long_line_mode; /**< 1 = long line mode enable. */ |
AnnaBridge | 167:84c0a372a020 | 88 | owm_overdrive_t overdrive_spec; /**< 0 = timeslot is 12us, 1 = timeslot is 10us. */ |
AnnaBridge | 167:84c0a372a020 | 89 | } owm_cfg_t; |
AnnaBridge | 167:84c0a372a020 | 90 | |
AnnaBridge | 167:84c0a372a020 | 91 | |
AnnaBridge | 167:84c0a372a020 | 92 | #define READ_ROM_COMMAND 0x33 /**< Read ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 93 | #define MATCH_ROM_COMMAND 0x55 /**< Match ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 94 | #define SEARCH_ROM_COMMAND 0xF0 /**< Search ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 95 | #define SKIP_ROM_COMMAND 0xCC /**< Skip ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 96 | #define OD_SKIP_ROM_COMMAND 0x3C /**< Overdrive Skip ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 97 | #define OD_MATCH_ROM_COMMAND 0x69 /**< Overdrive Match ROM Command */ |
AnnaBridge | 167:84c0a372a020 | 98 | #define RESUME_COMMAND 0xA5 /**< Resume Command */ |
AnnaBridge | 167:84c0a372a020 | 99 | |
AnnaBridge | 167:84c0a372a020 | 100 | /* **** Globals **** */ |
AnnaBridge | 167:84c0a372a020 | 101 | |
AnnaBridge | 167:84c0a372a020 | 102 | /* **** Function Prototypes **** */ |
AnnaBridge | 167:84c0a372a020 | 103 | |
AnnaBridge | 167:84c0a372a020 | 104 | /** |
AnnaBridge | 167:84c0a372a020 | 105 | * @brief Initialize and enable OWM module. |
AnnaBridge | 167:84c0a372a020 | 106 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 107 | * @param cfg Pointer to OWM configuration. |
AnnaBridge | 167:84c0a372a020 | 108 | * @param sys_cfg Pointer to system configuration object |
AnnaBridge | 167:84c0a372a020 | 109 | * |
AnnaBridge | 167:84c0a372a020 | 110 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 111 | * @retval #E_NULL_PTR if parameter is a null pointer |
AnnaBridge | 167:84c0a372a020 | 112 | * @retval #E_BUSY if IOMAN was not configured correctly |
AnnaBridge | 167:84c0a372a020 | 113 | * @retval #E_UNINITIALIZED if OWM CLK disabled |
AnnaBridge | 167:84c0a372a020 | 114 | * @retval #E_NOT_SUPPORTED if 1MHz CLK cannot be created with given system and owm CLK |
AnnaBridge | 167:84c0a372a020 | 115 | * @retval #E_BAD_PARAM if bad cfg parameter passed in |
AnnaBridge | 167:84c0a372a020 | 116 | */ |
AnnaBridge | 167:84c0a372a020 | 117 | int OWM_Init(mxc_owm_regs_t *owm, const owm_cfg_t *cfg, const sys_cfg_owm_t *sys_cfg); |
AnnaBridge | 167:84c0a372a020 | 118 | |
AnnaBridge | 167:84c0a372a020 | 119 | /** |
AnnaBridge | 167:84c0a372a020 | 120 | * @brief Shutdown OWM module. |
AnnaBridge | 167:84c0a372a020 | 121 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 122 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 123 | * @retval #E_BUSY if IOMAN was not released |
AnnaBridge | 167:84c0a372a020 | 124 | */ |
AnnaBridge | 167:84c0a372a020 | 125 | int OWM_Shutdown(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 126 | |
AnnaBridge | 167:84c0a372a020 | 127 | /** |
AnnaBridge | 167:84c0a372a020 | 128 | * @brief Send 1-Wire reset pulse. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 129 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 130 | * @retval (0) = no presence pulse detected, (1) = presence pulse detected |
AnnaBridge | 167:84c0a372a020 | 131 | */ |
AnnaBridge | 167:84c0a372a020 | 132 | int OWM_Reset(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 133 | |
AnnaBridge | 167:84c0a372a020 | 134 | /** |
AnnaBridge | 167:84c0a372a020 | 135 | * @brief Send and receive one byte of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 136 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 137 | * @param data data to send |
AnnaBridge | 167:84c0a372a020 | 138 | * @retval data read (1 byte) |
AnnaBridge | 167:84c0a372a020 | 139 | */ |
AnnaBridge | 167:84c0a372a020 | 140 | int OWM_TouchByte(mxc_owm_regs_t *owm, uint8_t data); |
AnnaBridge | 167:84c0a372a020 | 141 | |
AnnaBridge | 167:84c0a372a020 | 142 | /** |
AnnaBridge | 167:84c0a372a020 | 143 | * @brief Write one byte of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 144 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 145 | * @param data data to send |
AnnaBridge | 167:84c0a372a020 | 146 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 147 | * @retval #E_COMM_ERR if data written != data parameter |
AnnaBridge | 167:84c0a372a020 | 148 | */ |
AnnaBridge | 167:84c0a372a020 | 149 | int OWM_WriteByte(mxc_owm_regs_t *owm, uint8_t data); |
AnnaBridge | 167:84c0a372a020 | 150 | |
AnnaBridge | 167:84c0a372a020 | 151 | /** |
AnnaBridge | 167:84c0a372a020 | 152 | * @brief Read one byte of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 153 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 154 | * @retval data read (1 byte) |
AnnaBridge | 167:84c0a372a020 | 155 | */ |
AnnaBridge | 167:84c0a372a020 | 156 | int OWM_ReadByte(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 157 | |
AnnaBridge | 167:84c0a372a020 | 158 | /** |
AnnaBridge | 167:84c0a372a020 | 159 | * @brief Send and receive one bit of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 160 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 161 | * @param bit bit to send |
AnnaBridge | 167:84c0a372a020 | 162 | * @retval bit read |
AnnaBridge | 167:84c0a372a020 | 163 | */ |
AnnaBridge | 167:84c0a372a020 | 164 | int OWM_TouchBit(mxc_owm_regs_t *owm, uint8_t bit); |
AnnaBridge | 167:84c0a372a020 | 165 | |
AnnaBridge | 167:84c0a372a020 | 166 | /** |
AnnaBridge | 167:84c0a372a020 | 167 | * @brief Write one bit of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 168 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 169 | * @param bit bit to send |
AnnaBridge | 167:84c0a372a020 | 170 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 171 | * @retval #E_COMM_ERR if bit written != bit parameter |
AnnaBridge | 167:84c0a372a020 | 172 | */ |
AnnaBridge | 167:84c0a372a020 | 173 | int OWM_WriteBit(mxc_owm_regs_t *owm, uint8_t bit); |
AnnaBridge | 167:84c0a372a020 | 174 | |
AnnaBridge | 167:84c0a372a020 | 175 | /** |
AnnaBridge | 167:84c0a372a020 | 176 | * @brief Read one bit of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 177 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 178 | * @retval bit read |
AnnaBridge | 167:84c0a372a020 | 179 | */ |
AnnaBridge | 167:84c0a372a020 | 180 | int OWM_ReadBit(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 181 | |
AnnaBridge | 167:84c0a372a020 | 182 | /** |
AnnaBridge | 167:84c0a372a020 | 183 | * @brief Write multiple bytes of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 184 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 185 | * @param data Pointer to buffer for write data. |
AnnaBridge | 167:84c0a372a020 | 186 | * @param len Number of bytes to write. |
AnnaBridge | 167:84c0a372a020 | 187 | * |
AnnaBridge | 167:84c0a372a020 | 188 | * @retval Number of bytes written if successful |
AnnaBridge | 167:84c0a372a020 | 189 | * @retval #E_COMM_ERR if line short detected before transaction |
AnnaBridge | 167:84c0a372a020 | 190 | */ |
AnnaBridge | 167:84c0a372a020 | 191 | int OWM_Write(mxc_owm_regs_t *owm, uint8_t* data, int len); |
AnnaBridge | 167:84c0a372a020 | 192 | |
AnnaBridge | 167:84c0a372a020 | 193 | /** |
AnnaBridge | 167:84c0a372a020 | 194 | * @brief Read multiple bytes of data. Will block until transaction is complete. |
AnnaBridge | 167:84c0a372a020 | 195 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 196 | * @param data Pointer to buffer for read data. |
AnnaBridge | 167:84c0a372a020 | 197 | * @param len Number of bytes to read. |
AnnaBridge | 167:84c0a372a020 | 198 | * |
AnnaBridge | 167:84c0a372a020 | 199 | * @retval Number of bytes read if successful |
AnnaBridge | 167:84c0a372a020 | 200 | * @retval #E_COMM_ERR if line short detected before transaction |
AnnaBridge | 167:84c0a372a020 | 201 | */ |
AnnaBridge | 167:84c0a372a020 | 202 | int OWM_Read(mxc_owm_regs_t *owm, uint8_t* data, int len); |
AnnaBridge | 167:84c0a372a020 | 203 | |
AnnaBridge | 167:84c0a372a020 | 204 | /** |
AnnaBridge | 167:84c0a372a020 | 205 | * @brief Starts 1-Wire communication with Read ROM command |
AnnaBridge | 167:84c0a372a020 | 206 | * @note Only use the Read ROM command with one slave on the bus |
AnnaBridge | 167:84c0a372a020 | 207 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 208 | * @param ROMCode Pointer to buffer for ROM code read |
AnnaBridge | 167:84c0a372a020 | 209 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 210 | * @retval #E_COMM_ERR if reset, read or write fails |
AnnaBridge | 167:84c0a372a020 | 211 | */ |
AnnaBridge | 167:84c0a372a020 | 212 | int OWM_ReadROM(mxc_owm_regs_t *owm, uint8_t* ROMCode); |
AnnaBridge | 167:84c0a372a020 | 213 | |
AnnaBridge | 167:84c0a372a020 | 214 | /** |
AnnaBridge | 167:84c0a372a020 | 215 | * @brief Starts 1-Wire communication with Match ROM command |
AnnaBridge | 167:84c0a372a020 | 216 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 217 | * @param ROMCode Pointer to buffer with ROM code to match |
AnnaBridge | 167:84c0a372a020 | 218 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 219 | * @retval #E_COMM_ERR if reset or write fails |
AnnaBridge | 167:84c0a372a020 | 220 | */ |
AnnaBridge | 167:84c0a372a020 | 221 | int OWM_MatchROM(mxc_owm_regs_t *owm, uint8_t* ROMCode); |
AnnaBridge | 167:84c0a372a020 | 222 | |
AnnaBridge | 167:84c0a372a020 | 223 | /** |
AnnaBridge | 167:84c0a372a020 | 224 | * @brief Starts 1-Wire communication with Overdrive Match ROM command |
AnnaBridge | 167:84c0a372a020 | 225 | * @note After Overdrive Match ROM command is sent, the OWM is set to |
AnnaBridge | 167:84c0a372a020 | 226 | * overdrive speed. To set back to standard speed use OWM_SetOverdrive. |
AnnaBridge | 167:84c0a372a020 | 227 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 228 | * @param ROMCode Pointer to buffer with ROM code to match |
AnnaBridge | 167:84c0a372a020 | 229 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 230 | * @retval #E_COMM_ERR if reset or write fails |
AnnaBridge | 167:84c0a372a020 | 231 | */ |
AnnaBridge | 167:84c0a372a020 | 232 | int OWM_ODMatchROM(mxc_owm_regs_t *owm, uint8_t* ROMCode); |
AnnaBridge | 167:84c0a372a020 | 233 | |
AnnaBridge | 167:84c0a372a020 | 234 | /** |
AnnaBridge | 167:84c0a372a020 | 235 | * @brief Starts 1-Wire communication with Skip ROM command |
AnnaBridge | 167:84c0a372a020 | 236 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 237 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 238 | * @retval #E_COMM_ERR if reset or write fails |
AnnaBridge | 167:84c0a372a020 | 239 | */ |
AnnaBridge | 167:84c0a372a020 | 240 | int OWM_SkipROM(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 241 | |
AnnaBridge | 167:84c0a372a020 | 242 | /** |
AnnaBridge | 167:84c0a372a020 | 243 | * @brief Starts 1-Wire communication with Overdrive Skip ROM command |
AnnaBridge | 167:84c0a372a020 | 244 | * @note After Overdrive Skip ROM command is sent, the OWM is set to |
AnnaBridge | 167:84c0a372a020 | 245 | * overdrive speed. To set back to standard speed use OWM_SetOverdrive |
AnnaBridge | 167:84c0a372a020 | 246 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 247 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 248 | * @retval #E_COMM_ERR if reset or write fails |
AnnaBridge | 167:84c0a372a020 | 249 | */ |
AnnaBridge | 167:84c0a372a020 | 250 | int OWM_ODSkipROM(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 251 | |
AnnaBridge | 167:84c0a372a020 | 252 | /** |
AnnaBridge | 167:84c0a372a020 | 253 | * @brief Starts 1-Wire communication with Resume command |
AnnaBridge | 167:84c0a372a020 | 254 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 255 | * @retval #E_NO_ERROR if everything is successful |
AnnaBridge | 167:84c0a372a020 | 256 | * @retval #E_COMM_ERR if reset or write fails |
AnnaBridge | 167:84c0a372a020 | 257 | */ |
AnnaBridge | 167:84c0a372a020 | 258 | int OWM_Resume(mxc_owm_regs_t *owm); |
AnnaBridge | 167:84c0a372a020 | 259 | |
AnnaBridge | 167:84c0a372a020 | 260 | /** |
AnnaBridge | 167:84c0a372a020 | 261 | * @brief Starts 1-Wire communication with Search ROM command |
AnnaBridge | 167:84c0a372a020 | 262 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 263 | * @param newSearch (1) = start new search, (0) = continue search for next ROM |
AnnaBridge | 167:84c0a372a020 | 264 | * @param ROMCode Pointer to buffer with ROM code found |
AnnaBridge | 167:84c0a372a020 | 265 | * @retval (1) = ROM found, (0) = no new ROM found, end of search |
AnnaBridge | 167:84c0a372a020 | 266 | */ |
AnnaBridge | 167:84c0a372a020 | 267 | int OWM_SearchROM(mxc_owm_regs_t *owm, int newSearch, uint8_t* ROMCode); |
AnnaBridge | 167:84c0a372a020 | 268 | |
AnnaBridge | 167:84c0a372a020 | 269 | /** |
AnnaBridge | 167:84c0a372a020 | 270 | * @brief Clear interrupt flags. |
AnnaBridge | 167:84c0a372a020 | 271 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 272 | * @param mask Mask of interrupts to clear. |
AnnaBridge | 167:84c0a372a020 | 273 | */ |
AnnaBridge | 167:84c0a372a020 | 274 | __STATIC_INLINE void OWM_ClearFlags(mxc_owm_regs_t *owm, uint32_t mask) |
AnnaBridge | 167:84c0a372a020 | 275 | { |
AnnaBridge | 167:84c0a372a020 | 276 | owm->intfl = mask; |
AnnaBridge | 167:84c0a372a020 | 277 | } |
AnnaBridge | 167:84c0a372a020 | 278 | |
AnnaBridge | 167:84c0a372a020 | 279 | /** |
AnnaBridge | 167:84c0a372a020 | 280 | * @brief Get interrupt flags. |
AnnaBridge | 167:84c0a372a020 | 281 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 282 | * @retval Mask of active flags. |
AnnaBridge | 167:84c0a372a020 | 283 | */ |
AnnaBridge | 167:84c0a372a020 | 284 | __STATIC_INLINE unsigned OWM_GetFlags(mxc_owm_regs_t *owm) |
AnnaBridge | 167:84c0a372a020 | 285 | { |
AnnaBridge | 167:84c0a372a020 | 286 | return (owm->intfl); |
AnnaBridge | 167:84c0a372a020 | 287 | } |
AnnaBridge | 167:84c0a372a020 | 288 | |
AnnaBridge | 167:84c0a372a020 | 289 | /** |
AnnaBridge | 167:84c0a372a020 | 290 | * @brief Enables/Disables the External pullup |
AnnaBridge | 167:84c0a372a020 | 291 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 292 | * @param enable (1) = enable, (0) = disable |
AnnaBridge | 167:84c0a372a020 | 293 | */ |
AnnaBridge | 167:84c0a372a020 | 294 | __STATIC_INLINE void OWM_SetExtPullup(mxc_owm_regs_t *owm, int enable) |
AnnaBridge | 167:84c0a372a020 | 295 | { |
AnnaBridge | 167:84c0a372a020 | 296 | if(enable) |
AnnaBridge | 167:84c0a372a020 | 297 | owm->cfg |= MXC_F_OWM_CFG_EXT_PULLUP_ENABLE; |
AnnaBridge | 167:84c0a372a020 | 298 | else |
AnnaBridge | 167:84c0a372a020 | 299 | owm->cfg &= ~(MXC_F_OWM_CFG_EXT_PULLUP_ENABLE); |
AnnaBridge | 167:84c0a372a020 | 300 | } |
AnnaBridge | 167:84c0a372a020 | 301 | |
AnnaBridge | 167:84c0a372a020 | 302 | /** |
AnnaBridge | 167:84c0a372a020 | 303 | * @brief Enables/Disables Overdrive speed |
AnnaBridge | 167:84c0a372a020 | 304 | * @param owm Pointer to OWM regs. |
AnnaBridge | 167:84c0a372a020 | 305 | * @param enable (1) = overdrive, (0) = standard |
AnnaBridge | 167:84c0a372a020 | 306 | */ |
AnnaBridge | 167:84c0a372a020 | 307 | __STATIC_INLINE void OWM_SetOverdrive(mxc_owm_regs_t *owm, int enable) |
AnnaBridge | 167:84c0a372a020 | 308 | { |
AnnaBridge | 167:84c0a372a020 | 309 | if(enable) |
AnnaBridge | 167:84c0a372a020 | 310 | owm->cfg |= MXC_F_OWM_CFG_OVERDRIVE; |
AnnaBridge | 167:84c0a372a020 | 311 | else |
AnnaBridge | 167:84c0a372a020 | 312 | owm->cfg &= ~(MXC_F_OWM_CFG_OVERDRIVE); |
AnnaBridge | 167:84c0a372a020 | 313 | } |
AnnaBridge | 167:84c0a372a020 | 314 | |
AnnaBridge | 167:84c0a372a020 | 315 | /**@} end of group owm */ |
AnnaBridge | 167:84c0a372a020 | 316 | #ifdef __cplusplus |
AnnaBridge | 167:84c0a372a020 | 317 | } |
AnnaBridge | 167:84c0a372a020 | 318 | #endif |
AnnaBridge | 167:84c0a372a020 | 319 | |
AnnaBridge | 167:84c0a372a020 | 320 | #endif /* _OWM_H_ */ |