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