MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
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-08-28 17:03:02 -0500 (Tue, 28 Aug 2018) $
38 * $Revision: 37424 $
39 *
40 **************************************************************************** */
41 
42 /* Define to prevent redundant inclusion */
43 #ifndef _OWM_H_
44 #define _OWM_H_
45 
46 /* **** Includes **** */
47 #include "mxc_device.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 
118 int OWM_Reset (void);
119 
125 int OWM_TouchByte (uint8_t data);
126 
133 int OWM_WriteByte (uint8_t data);
134 
139 int OWM_ReadByte (void);
140 
146 int OWM_TouchBit (uint8_t bit);
147 
154 int OWM_WriteBit (uint8_t bit);
155 
160 int OWM_ReadBit (void);
161 
170 int OWM_Write (uint8_t* data, int len);
171 
180 int OWM_Read (uint8_t* data, int len);
181 
189 int OWM_ReadROM (uint8_t* ROMCode);
190 
197 int OWM_MatchROM (uint8_t* ROMCode);
198 
207 int OWM_ODMatchROM (uint8_t* ROMCode);
208 
214 int OWM_SkipROM (void);
215 
223 int OWM_ODSkipROM (void);
224 
230 int OWM_Resume (void);
231 
238 int OWM_SearchROM (int newSearch, uint8_t* ROMCode);
239 
244 void OWM_ClearFlags (uint32_t mask);
245 
250 unsigned OWM_GetFlags (void);
251 
256 void OWM_SetExtPullup (int enable);
257 
262 void OWM_SetOverdrive (int enable);
263 
264 // TODO
265 // FIXME
266 // add function headers/descriptions
267 void OWM_EnableInt (int flags);
268 void OWM_DisableInt (int flags);
269 int OWM_SetForcePresenceDetect (int enable);
270 int OWM_SetInternalPullup (int enable);
271 int OWM_SetExternalPullup (owm_ext_pu_t ext_pu_mode);
272 int OWM_SystemClockUpdated();
273 int OWM_SetSearchROMAccelerator (int enable);
274 int OWM_BitBang_Init (int initialState);
275 int OWM_BitBang_Read();
276 int OWM_BitBang_Write (int state);
277 int OWM_BitBang_Disable();
278 
279 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif /* _OWM_H_ */
unsigned OWM_GetFlags(void)
Get interrupt flags.
Definition: owm.h:69
Definition: owm.h:68
int OWM_WriteByte(uint8_t data)
Write one byte of data. Will block until transaction is complete.
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.
int OWM_MatchROM(uint8_t *ROMCode)
Starts 1-Wire communication with Match ROM command.
uint8_t long_line_mode
Definition: owm.h:78
void OWM_ClearFlags(uint32_t mask)
Clear interrupt flags.
int OWM_Write(uint8_t *data, int len)
Write multiple bytes of data. Will block until transaction is complete.
int OWM_Resume(void)
Starts 1-Wire communication with Resume command.
int OWM_SkipROM(void)
Starts 1-Wire communication with Skip ROM command.
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. Will block until transaction is complete.
int OWM_Read(uint8_t *data, int len)
Read multiple bytes of data. Will block until transaction is complete.
void OWM_Shutdown(void)
Shutdown OWM module.
Definition: owm.h:67
owm_ext_pu_t
Definition: owm.h:66
void OWM_SetOverdrive(int enable)
Enables/Disables Overdrive speed.
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
Definition: owm.h:77
uint8_t int_pu_en
Definition: owm.h:76
int OWM_TouchByte(uint8_t data)
Send and receive one byte of data. Will block until transaction is complete.
int OWM_Reset(void)
Send 1-Wire reset pulse. Will block until transaction is complete.
int OWM_ReadByte(void)
Read one byte of data. Will block until transaction is complete.
Definition: owm.h:75
int OWM_ReadBit(void)
Read one bit of data. Will block until transaction is complete.
int OWM_ODSkipROM(void)
Starts 1-Wire communication with Overdrive Skip ROM command.
int OWM_WriteBit(uint8_t bit)
Write one bit of data. Will block until transaction is complete.