MAX32680 Peripheral Driver API
Peripheral Driver API for the MAX32680
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
owm.h
1
7/******************************************************************************
8 *
9 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
10 * Analog Devices, Inc.),
11 * Copyright (C) 2023-2024 Analog Devices, Inc.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 ******************************************************************************/
26
27/* Define to prevent redundant inclusion */
28#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_OWM_H_
29#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_OWM_H_
30
31/* **** Includes **** */
32#include "mxc_device.h"
33#include "mxc_sys.h"
34#include "owm_regs.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
46/* **** Definitions **** */
47
51typedef enum {
56
60typedef struct {
61 uint8_t int_pu_en;
64 // mxc_owm_overdrive_t overdrive_spec; /**< 0 = timeslot is 12us, 1 = timeslot is 10us. */
66
67#define READ_ROM_COMMAND 0x33
68#define MATCH_ROM_COMMAND 0x55
69#define SEARCH_ROM_COMMAND 0xF0
70#define SKIP_ROM_COMMAND 0xCC
71#define OD_SKIP_ROM_COMMAND 0x3C
72#define OD_MATCH_ROM_COMMAND 0x69
73#define RESUME_COMMAND 0xA5
75/* **** Globals **** */
76
77/* **** Function Prototypes **** */
78
91
97
104
111
119int MXC_OWM_TouchByte(uint8_t data);
120
129int MXC_OWM_WriteByte(uint8_t data);
130
137
145int MXC_OWM_TouchBit(uint8_t bit);
146
155int MXC_OWM_WriteBit(uint8_t bit);
156
163
173int MXC_OWM_Write(uint8_t *data, int len);
174
184int MXC_OWM_Read(uint8_t *data, int len);
185
195int MXC_OWM_ReadROM(uint8_t *ROMCode);
196
205int MXC_OWM_MatchROM(uint8_t *ROMCode);
206
217int MXC_OWM_ODMatchROM(uint8_t *ROMCode);
218
226
236
244
253int MXC_OWM_SearchROM(int newSearch, uint8_t *ROMCode);
254
260void MXC_OWM_ClearFlags(uint32_t mask);
261
267unsigned MXC_OWM_GetFlags(void);
268
274void MXC_OWM_SetExtPullup(int enable);
275
281void MXC_OWM_SetOverdrive(int enable);
282
288void MXC_OWM_EnableInt(int flags);
289
295void MXC_OWM_DisableInt(int flags);
296
305
314
323
330
339
347int MXC_OWM_BitBang_Init(int initialState);
348
355
364
371
373#ifdef __cplusplus
374}
375#endif
376
377#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_OWM_H_
uint8_t long_line_mode
Definition: owm.h:63
mxc_owm_ext_pu_t ext_pu_mode
Definition: owm.h:62
uint8_t int_pu_en
Definition: owm.h:61
int MXC_OWM_ReadROM(uint8_t *ROMCode)
Starts 1-Wire communication with Read ROM command.
int MXC_OWM_SetExternalPullup(mxc_owm_ext_pu_t ext_pu_mode)
Enables/Disables the External pullup.
void MXC_OWM_SetOverdrive(int enable)
Enables/Disables Overdrive speed.
int MXC_OWM_SkipROM(void)
Starts 1-Wire communication with Skip ROM command.
int MXC_OWM_Reset(void)
Send 1-Wire reset pulse. Will block until transaction is complete.
void MXC_OWM_EnableInt(int flags)
Enables interrupts.
int MXC_OWM_ODMatchROM(uint8_t *ROMCode)
Starts 1-Wire communication with Overdrive Match ROM command.
int MXC_OWM_SetInternalPullup(int enable)
Enables/Disables the Internal pullup.
int MXC_OWM_BitBang_Disable(void)
Disable Bit Bang mode.
int MXC_OWM_MatchROM(uint8_t *ROMCode)
Starts 1-Wire communication with Match ROM command.
void MXC_OWM_Shutdown(void)
Shutdown OWM module.
int MXC_OWM_SetSearchROMAccelerator(int enable)
Enable/Disable Search ROM Accelerator mode.
int MXC_OWM_GetPresenceDetect(void)
Get the presence pulse detect status.
int MXC_OWM_Init(const mxc_owm_cfg_t *cfg)
Initialize and enable OWM module.
void MXC_OWM_ClearFlags(uint32_t mask)
Clear interrupt flags.
int MXC_OWM_BitBang_Read(void)
Read current value of wire.
int MXC_OWM_ReadBit(void)
Read one bit of data. Will block until transaction is complete.
int MXC_OWM_TouchBit(uint8_t bit)
Send and receive one bit of data. Will block until transaction is complete.
int MXC_OWM_WriteBit(uint8_t bit)
Write one bit of data. Will block until transaction is complete.
int MXC_OWM_TouchByte(uint8_t data)
Send and receive one byte of data. Will block until transaction is complete.
mxc_owm_ext_pu_t
Enumeration type for specifying options for 1-Wire external pullup mode.
Definition: owm.h:51
int MXC_OWM_BitBang_Write(int state)
Set value of wire.
int MXC_OWM_Read(uint8_t *data, int len)
Read multiple bytes of data. Will block until transaction is complete.
void MXC_OWM_SetExtPullup(int enable)
Enables/Disables the External pullup.
int MXC_OWM_ODSkipROM(void)
Starts 1-Wire communication with Overdrive Skip ROM command.
void MXC_OWM_DisableInt(int flags)
Disables interrupts.
int MXC_OWM_SetForcePresenceDetect(int enable)
Enables/Disables driving of OWM_IO low during presence detection.
int MXC_OWM_SystemClockUpdated(void)
Call to correct divider if system clock has changed.
int MXC_OWM_BitBang_Init(int initialState)
Prepare OWM for bit bang mode.
int MXC_OWM_Resume(void)
Starts 1-Wire communication with Resume command.
int MXC_OWM_SearchROM(int newSearch, uint8_t *ROMCode)
Starts 1-Wire communication with Search ROM command.
int MXC_OWM_ReadByte(void)
Read one byte of data. Will block until transaction is complete.
unsigned MXC_OWM_GetFlags(void)
Get interrupt flags.
int MXC_OWM_Write(uint8_t *data, int len)
Write multiple bytes of data. Will block until transaction is complete.
int MXC_OWM_WriteByte(uint8_t data)
Write one byte of data. Will block until transaction is complete.
@ MXC_OWM_EXT_PU_ACT_LOW
Definition: owm.h:53
@ MXC_OWM_EXT_PU_ACT_HIGH
Definition: owm.h:52
@ MXC_OWM_EXT_PU_UNUSED
Definition: owm.h:54
Structure type for 1-Wire Master configuration.
Definition: owm.h:60
Registers, Bit Masks and Bit Positions for the OWM Peripheral Module.