NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_onewire.c File Reference

1-Wire Interface Controller (ONEWIRE) HW driver source file. More...

#include <neorv32.h>

Functions

int neorv32_onewire_available (void)
 
int neorv32_onewire_setup (uint32_t t_base)
 
void neorv32_onewire_enable (void)
 
void neorv32_onewire_disable (void)
 
int neorv32_onewire_sense (void)
 
int neorv32_onewire_busy (void)
 
void neorv32_onewire_reset (void)
 
int neorv32_onewire_reset_get_presence (void)
 
void neorv32_onewire_read_bit (void)
 
uint8_t neorv32_onewire_read_bit_get (void)
 
void neorv32_onewire_write_bit (uint8_t bit)
 
void neorv32_onewire_read_byte (void)
 
uint8_t neorv32_onewire_read_byte_get (void)
 
void neorv32_onewire_write_byte (uint8_t byte)
 
int neorv32_onewire_reset_blocking (void)
 
uint8_t neorv32_onewire_read_bit_blocking (void)
 
void neorv32_onewire_write_bit_blocking (uint8_t bit)
 
uint8_t neorv32_onewire_read_byte_blocking (void)
 
void neorv32_onewire_write_byte_blocking (uint8_t byte)
 

Detailed Description

1-Wire Interface Controller (ONEWIRE) HW driver source file.

Note
These functions should only be used if the ONEWIRE unit was synthesized (IO_ONEWIRE_EN = true).
See also
https://stnolting.github.io/neorv32/sw/files.html

Function Documentation

◆ neorv32_onewire_available()

int neorv32_onewire_available ( void )

Check if ONEWIRE controller was synthesized.

Returns
0 if ONEWIRE was not synthesized, 1 if ONEWIRE is available.

◆ neorv32_onewire_busy()

int neorv32_onewire_busy ( void )

Check if ONEWIRE module is busy.

Note
This function is non-blocking.
Returns
0 if not busy, 1 if busy.

◆ neorv32_onewire_disable()

void neorv32_onewire_disable ( void )

Disable ONEWIRE controller.

◆ neorv32_onewire_enable()

void neorv32_onewire_enable ( void )

Enable ONEWIRE controller.

◆ neorv32_onewire_read_bit()

void neorv32_onewire_read_bit ( void )

Initiate single-bit read.

Note
This function is non-blocking.

◆ neorv32_onewire_read_bit_blocking()

uint8_t neorv32_onewire_read_bit_blocking ( void )

Read single bit.

Warning
This function is blocking!
Returns
Read bit in bit 0.

◆ neorv32_onewire_read_bit_get()

uint8_t neorv32_onewire_read_bit_get ( void )

Get bit from previous single-bit read operation

Note
This function is non-blocking.
Returns
Read bit in bit 0.

◆ neorv32_onewire_read_byte()

void neorv32_onewire_read_byte ( void )

Initiate read byte.

Note
This function is non-blocking.

◆ neorv32_onewire_read_byte_blocking()

uint8_t neorv32_onewire_read_byte_blocking ( void )

Read byte.

Warning
This function is blocking!
Returns
Read byte.

◆ neorv32_onewire_read_byte_get()

uint8_t neorv32_onewire_read_byte_get ( void )

Get data from previous read byte operation.

Note
This function is non-blocking.
Returns
Read byte.

◆ neorv32_onewire_reset()

void neorv32_onewire_reset ( void )

Initiate reset pulse.

Note
This function is non-blocking.

◆ neorv32_onewire_reset_blocking()

int neorv32_onewire_reset_blocking ( void )

Generate reset pulse and check if any bus device is present.

Warning
This function is blocking!
Returns
0 if at lest one device is present, -1 otherwise

◆ neorv32_onewire_reset_get_presence()

int neorv32_onewire_reset_get_presence ( void )

Get bus presence (after RESET).

Note
This function is non-blocking.
Returns
0 if at lest one device is present, -1 otherwise

◆ neorv32_onewire_sense()

int neorv32_onewire_sense ( void )

Get current bus state.

Returns
1 if bus is high, 0 if bus is low.

◆ neorv32_onewire_setup()

int neorv32_onewire_setup ( uint32_t t_base)

Reset, configure and enable ONEWIRE interface controller.

Parameters
[in]t_baseBase tick time in ns.
Returns
0 if configuration failed, otherwise the actual t_base time in ns is returned.

◆ neorv32_onewire_write_bit()

void neorv32_onewire_write_bit ( uint8_t bit)

Initiate single-bit write.

Note
This function is non-blocking.
Parameters
[in]bitBit to be send.

◆ neorv32_onewire_write_bit_blocking()

void neorv32_onewire_write_bit_blocking ( uint8_t bit)

Write single bit.

Warning
This function is blocking!
Parameters
[in]bitBit to be send.

◆ neorv32_onewire_write_byte()

void neorv32_onewire_write_byte ( uint8_t byte)

Initiate write byte.

Note
This function is non-blocking.
Parameters
[in]byteByte to be send.

◆ neorv32_onewire_write_byte_blocking()

void neorv32_onewire_write_byte_blocking ( uint8_t byte)

Write byte.

Warning
This function is blocking!
Parameters
[in]byteByte to be send.