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