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.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_MAX32625PICO_NO_BOOT/TARGET_Maxim/TARGET_MAX32625/mxc/owm.h@169:a7c7b631e539
mbed library. Release version 164

Who changed what in which revision?

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