MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
owm.h
1 
6  /* ****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  * $Date: 2018-11-08 15:08:58 -0600 (Thu, 08 Nov 2018) $
38  * $Revision: 39056 $
39  *
40  **************************************************************************** */
41 
42 /* Define to prevent redundant inclusion */
43 #ifndef _OWM_H_
44 #define _OWM_H_
45 
46 /* **** Includes **** */
47 #include "mxc_config.h"
48 #include "mxc_sys.h"
49 #include "owm_regs.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
61 /* **** Definitions **** */
62 
66 typedef enum {
70 } owm_ext_pu_t;
71 
75 typedef struct {
76  uint8_t int_pu_en;
78  uint8_t long_line_mode;
79  // owm_overdrive_t overdrive_spec; /**< 0 = timeslot is 12us, 1 = timeslot is 10us. */
80 } owm_cfg_t;
81 
82 
83 #define READ_ROM_COMMAND 0x33
84 #define MATCH_ROM_COMMAND 0x55
85 #define SEARCH_ROM_COMMAND 0xF0
86 #define SKIP_ROM_COMMAND 0xCC
87 #define OD_SKIP_ROM_COMMAND 0x3C
88 #define OD_MATCH_ROM_COMMAND 0x69
89 #define RESUME_COMMAND 0xA5
91 /* **** Globals **** */
92 
93 /* **** Function Prototypes **** */
94 
107 int OWM_Init(const owm_cfg_t *cfg, const sys_cfg_owm_t* sys_cfg);
108 
112 void OWM_Shutdown(void);
113 
117 int OWM_Reset(void);
118 
124 int OWM_TouchByte(uint8_t data);
125 
132 int OWM_WriteByte(uint8_t data);
133 
138 int OWM_ReadByte(void);
139 
145 int OWM_TouchBit(uint8_t bit);
146 
153 int OWM_WriteBit(uint8_t bit);
154 
159 int OWM_ReadBit(void);
160 
169 int OWM_Write(uint8_t* data, int len);
170 
179 int OWM_Read(uint8_t* data, int len);
180 
188 int OWM_ReadROM(uint8_t* ROMCode);
189 
196 int OWM_MatchROM(uint8_t* ROMCode);
197 
206 int OWM_ODMatchROM(uint8_t* ROMCode);
207 
213 int OWM_SkipROM(void);
214 
222 int OWM_ODSkipROM(void);
223 
229 int OWM_Resume(void);
230 
237 int OWM_SearchROM(int newSearch, uint8_t* ROMCode);
238 
243 void OWM_ClearFlags(uint32_t mask);
244 
249 unsigned OWM_GetFlags(void);
250 
255 void OWM_SetExtPullup(int enable);
256 
261 void OWM_SetOverdrive(int enable);
262 
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 #endif /* _OWM_H_ */
unsigned OWM_GetFlags(void)
Get interrupt flags.
Pullup pin is not used for an external pullup.
Definition: owm.h:69
Pullup pin is active low when enabled.
Definition: owm.h:68
int OWM_WriteByte(uint8_t data)
Write one byte of data.
int OWM_SearchROM(int newSearch, uint8_t *ROMCode)
Starts 1-Wire communication with Search ROM command.
void OWM_SetExtPullup(int enable)
Enables/Disables the External pullup.
Structure type for 1-Wire Master configuration.
Definition: owm.h:75
int OWM_MatchROM(uint8_t *ROMCode)
Starts 1-Wire communication with Match ROM command.
void OWM_ClearFlags(uint32_t mask)
Clear interrupt flags.
int OWM_Write(uint8_t *data, int len)
Write multiple bytes of data.
int OWM_Resume(void)
Starts 1-Wire communication with Resume command.
int OWM_SkipROM(void)
Starts 1-Wire communication with Skip ROM command.
uint8_t long_line_mode
1 = long line mode enable.
Definition: owm.h:78
int OWM_ReadROM(uint8_t *ROMCode)
Starts 1-Wire communication with Read ROM command.
int OWM_ODMatchROM(uint8_t *ROMCode)
Starts 1-Wire communication with Overdrive Match ROM command.
int OWM_TouchBit(uint8_t bit)
Send and receive one bit of data.
int OWM_Read(uint8_t *data, int len)
Read multiple bytes of data.
void OWM_Shutdown(void)
Shutdown OWM module.
Pullup pin is active high when enabled.
Definition: owm.h:67
owm_ext_pu_t
Enumeration type for specifying options for 1-Wire external pullup mode.
Definition: owm.h:66
void OWM_SetOverdrive(int enable)
Enables/Disables Overdrive speed.
uint8_t int_pu_en
1 = internal pullup on.
Definition: owm.h:76
int OWM_Init(const owm_cfg_t *cfg, const sys_cfg_owm_t *sys_cfg)
Initialize and enable OWM module.
owm_ext_pu_t ext_pu_mode
See owm_ext_pu_t.
Definition: owm.h:77
int OWM_TouchByte(uint8_t data)
Send and receive one byte of data.
int OWM_Reset(void)
Send 1-Wire reset pulse.
int OWM_ReadByte(void)
Read one byte of data.
int OWM_ReadBit(void)
Read one bit of data.
int OWM_ODSkipROM(void)
Starts 1-Wire communication with Overdrive Skip ROM command.
int OWM_WriteBit(uint8_t bit)
Write one bit of data.