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