MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
1-Wire Master (OWM)

Modules

 OWM_Registers
 

Data Structures

struct  owm_cfg_t
 

Macros

#define READ_ROM_COMMAND   0x33
 
#define MATCH_ROM_COMMAND   0x55
 
#define SEARCH_ROM_COMMAND   0xF0
 
#define SKIP_ROM_COMMAND   0xCC
 
#define OD_SKIP_ROM_COMMAND   0x3C
 
#define OD_MATCH_ROM_COMMAND   0x69
 
#define RESUME_COMMAND   0xA5
 

Enumerations

enum  owm_ext_pu_t
 

Functions

int OWM_Init (const owm_cfg_t *cfg, const sys_cfg_owm_t *sys_cfg)
 
void OWM_Shutdown (void)
 
int OWM_Reset (void)
 
int OWM_TouchByte (uint8_t data)
 
int OWM_WriteByte (uint8_t data)
 
int OWM_ReadByte (void)
 
int OWM_TouchBit (uint8_t bit)
 
int OWM_WriteBit (uint8_t bit)
 
int OWM_ReadBit (void)
 
int OWM_Write (uint8_t *data, int len)
 
int OWM_Read (uint8_t *data, int len)
 
int OWM_ReadROM (uint8_t *ROMCode)
 
int OWM_MatchROM (uint8_t *ROMCode)
 
int OWM_ODMatchROM (uint8_t *ROMCode)
 
int OWM_SkipROM (void)
 
int OWM_ODSkipROM (void)
 
int OWM_Resume (void)
 
int OWM_SearchROM (int newSearch, uint8_t *ROMCode)
 
void OWM_ClearFlags (uint32_t mask)
 
unsigned OWM_GetFlags (void)
 
void OWM_SetExtPullup (int enable)
 
void OWM_SetOverdrive (int enable)
 

Detailed Description


Data Structure Documentation

◆ owm_cfg_t

struct owm_cfg_t

Structure type for 1-Wire Master configuration.

Data Fields

uint8_t int_pu_en
 
owm_ext_pu_t ext_pu_mode
 
uint8_t long_line_mode
 

Field Documentation

◆ ext_pu_mode

owm_ext_pu_t ext_pu_mode

◆ int_pu_en

uint8_t int_pu_en

1 = internal pullup on.

◆ long_line_mode

uint8_t long_line_mode

1 = long line mode enable.

Macro Definition Documentation

◆ MATCH_ROM_COMMAND

#define MATCH_ROM_COMMAND   0x55

Match ROM Command

◆ OD_MATCH_ROM_COMMAND

#define OD_MATCH_ROM_COMMAND   0x69

Overdrive Match ROM Command

◆ OD_SKIP_ROM_COMMAND

#define OD_SKIP_ROM_COMMAND   0x3C

Overdrive Skip ROM Command

◆ READ_ROM_COMMAND

#define READ_ROM_COMMAND   0x33

Read ROM Command

◆ RESUME_COMMAND

#define RESUME_COMMAND   0xA5

Resume Command

◆ SEARCH_ROM_COMMAND

#define SEARCH_ROM_COMMAND   0xF0

Search ROM Command

◆ SKIP_ROM_COMMAND

#define SKIP_ROM_COMMAND   0xCC

Skip ROM Command

Enumeration Type Documentation

◆ owm_ext_pu_t

Enumeration type for specifying options for 1-Wire external pullup mode.

Enumerator
OWM_EXT_PU_ACT_HIGH 

Pullup pin is active high when enabled.

OWM_EXT_PU_ACT_LOW 

Pullup pin is active low when enabled.

OWM_EXT_PU_UNUSED 

Pullup pin is not used for an external pullup.

Function Documentation

◆ OWM_ClearFlags()

void OWM_ClearFlags ( uint32_t  mask)

Clear interrupt flags.

Parameters
maskMask of interrupts to clear.

◆ OWM_GetFlags()

unsigned OWM_GetFlags ( void  )

Get interrupt flags.

Returns
Mask of active flags.

◆ OWM_Init()

int OWM_Init ( const owm_cfg_t cfg,
const sys_cfg_owm_t *  sys_cfg 
)

Initialize and enable OWM module.

Parameters
cfgPointer to OWM configuration.
sys_cfgSystem configuration object
Returns
E_NO_ERROR if everything is successful
E_NULL_PTR if parameter is a null pointer
E_BUSY if IOMAN was not configured correctly
E_UNINITIALIZED if OWM CLK disabled
E_NOT_SUPPORTED if 1MHz CLK cannot be created with given system and owm CLK
E_BAD_PARAM if bad cfg parameter passed in

◆ OWM_MatchROM()

int OWM_MatchROM ( uint8_t *  ROMCode)

Starts 1-Wire communication with Match ROM command.

Parameters
ROMCodePointer to buffer with ROM code to match
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset or write fails

◆ OWM_ODMatchROM()

int OWM_ODMatchROM ( uint8_t *  ROMCode)

Starts 1-Wire communication with Overdrive Match ROM command.

Note
After Overdrive Match ROM command is sent, the OWM is set to overdrive speed. To set back to standard speed use OWM_SetOverdrive.
Parameters
ROMCodePointer to buffer with ROM code to match
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset or write fails

◆ OWM_ODSkipROM()

int OWM_ODSkipROM ( void  )

Starts 1-Wire communication with Overdrive Skip ROM command.

Note
After Overdrive Skip ROM command is sent, the OWM is set to overdrive speed. To set back to standard speed use OWM_SetOverdrive
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset or write fails

◆ OWM_Read()

int OWM_Read ( uint8_t *  data,
int  len 
)

Read multiple bytes of data. Will block until transaction is complete.

Parameters
dataPointer to buffer for read data.
lenNumber of bytes to read.
Returns
Number of bytes read if successful
E_COMM_ERR if line short detected before transaction

◆ OWM_ReadBit()

int OWM_ReadBit ( void  )

Read one bit of data. Will block until transaction is complete.

Returns
bit read

◆ OWM_ReadByte()

int OWM_ReadByte ( void  )

Read one byte of data. Will block until transaction is complete.

Returns
data read (1 byte)

◆ OWM_ReadROM()

int OWM_ReadROM ( uint8_t *  ROMCode)

Starts 1-Wire communication with Read ROM command.

Note
Only use the Read ROM command with one slave on the bus
Parameters
ROMCodePointer to buffer for ROM code read
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset, read or write fails

◆ OWM_Reset()

int OWM_Reset ( void  )

Send 1-Wire reset pulse. Will block until transaction is complete.

Returns
0 if no 1-wire devices reponded during the presence pulse, 1 otherwise

◆ OWM_Resume()

int OWM_Resume ( void  )

Starts 1-Wire communication with Resume command.

Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset or write fails

◆ OWM_SearchROM()

int OWM_SearchROM ( int  newSearch,
uint8_t *  ROMCode 
)

Starts 1-Wire communication with Search ROM command.

Parameters
newSearch(1) = start new search, (0) = continue search for next ROM
ROMCodePointer to buffer with ROM code found
Returns
(1) = ROM found, (0) = no new ROM found, end of search

◆ OWM_SetExtPullup()

void OWM_SetExtPullup ( int  enable)

Enables/Disables the External pullup.

Parameters
enable(1) = enable, (0) = disable

◆ OWM_SetOverdrive()

void OWM_SetOverdrive ( int  enable)

Enables/Disables Overdrive speed.

Parameters
enable(1) = overdrive, (0) = standard

◆ OWM_SkipROM()

int OWM_SkipROM ( void  )

Starts 1-Wire communication with Skip ROM command.

Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if reset or write fails

◆ OWM_TouchBit()

int OWM_TouchBit ( uint8_t  bit)

Send and receive one bit of data. Will block until transaction is complete.

Parameters
bitbit to send
Returns
bit read

◆ OWM_TouchByte()

int OWM_TouchByte ( uint8_t  data)

Send and receive one byte of data. Will block until transaction is complete.

Parameters
datadata to send
Returns
data read (1 byte)

◆ OWM_Write()

int OWM_Write ( uint8_t *  data,
int  len 
)

Write multiple bytes of data. Will block until transaction is complete.

Parameters
dataPointer to buffer for write data.
lenNumber of bytes to write.
Returns
Number of bytes written if successful
E_COMM_ERR if line short detected before transaction

◆ OWM_WriteBit()

int OWM_WriteBit ( uint8_t  bit)

Write one bit of data. Will block until transaction is complete.

Parameters
bitbit to send
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if bit written != bit parameter

◆ OWM_WriteByte()

int OWM_WriteByte ( uint8_t  data)

Write one byte of data. Will block until transaction is complete.

Parameters
datadata to send
Returns
E_NO_ERROR if everything is successful
E_COMM_ERR if data written != data parameter