utl::_1wire_uart_i< Impl_t > Class Template Reference

1-wire UART interface template class using CRTP Using the private virtual interface we provide the interface from _1wire_i<> More...

`#include <_1wire_uart.h>`

Inheritance diagram for utl::_1wire_uart_i< Impl_t >:

## Public Types

using | type = _1wire_uart_i< Impl_t >
| Export type as identity meta-function. More...
using | Speed = typename _1wire_i< type >::Speed
| Bring bus speed. More...
Public Types inherited from utl::_1wire_i< impl_t >
enum | Speed { Speed::STD =0, Speed::OVDR }
| 1-wire bus speed More...
using | type = _1wire_i
| Export type as identity meta-function. More...

## Protected Member Functions

Object lifetime
| _1wire_uart_i ()=default
| Allow constructor from derived only. More...
| ~_1wire_uart_i ()=default
Protected Member Functions inherited from utl::_1wire_i< impl_t >
| _1wire_i ()=default
| Allow constructor from derived only. More...
| ~_1wire_i ()=default
| Allow destructor from derived only. More...
| _1wire_i (const _1wire_i &)=delete
| No copies. More...
_1wire_i & | operator= (const _1wire_i &)=delete

## Private Member Functions

| _CRTP_IMPL (Impl_t)
Implementation requirements

Note
  In order for the implementation to have the following as private members it also need to declare this class as friend

byte_t | UART_RW (byte_t byte)
| Implementers's (driver) read-write function. We expect the following USART configuration: More...
void | UART_BR (uint32_t br)
| Implementers's (driver) baudrate function. More...

## Private Attributes

friend | _1wire_i< _1wire_uart_i< Impl_t > >
| Syntactic sugar to CRTP casting. More...

## Implementation of base requirements

enum | BR { BR_STD_RST =9600, BR_OVR_RST =57600, BR_STD =115200, BR_OVR =921600 }
| 1-wire UART baudrates More...
Speed | _speed {Speed::STD}
Speed | speed () const
| Get the 1-wire bus speed. More...
void | speed (Speed s)
| Set the 1-wire bus speed. More...
bool | bit (bool b)
| Send a 1-Wire write bit and read the response. More...
bool | _reset (Speed s)

Generate a 1-wire reset

Reset \ / \ X X X /

RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP < -------— 1024/174 usec ----------—> More...

## Additional Inherited Members

Public Member Functions inherited from utl::_1wire_i< impl_t >
bool | reset (Speed s=Speed::STD)
| Generate a 1-wire reset. More...
byte_t | tx_data (byte_t out, Speed s=Speed::STD)
size_t | tx_data (const byte_t *out, byte_t *in, size_t n, Speed s=Speed::STD)
byte_t | rx_data (Speed s=Speed::STD)
size_t | rx_data (byte_t *in, size_t n, Speed s=Speed::STD)
void | match (_1wire_id_t &id, Speed s=Speed::STD)
void | match_n_ovdr (_1wire_id_t &id)
void | skip (Speed s=Speed::STD)
void | skip_n_ovdr ()
_1wire_id_t | first (Speed s=Speed::STD, bool alarm=false)
| 'first' operation, to search on the 1-Wire for the first device. This is performed by setting dec_, pos_ and cur_ to zero and then doing the search. More...
_1wire_id_t | next (Speed s=Speed::STD, bool alarm=false)
| 'next' operation, to search on the 1-Wire for the next device. This search is usually performed after a 'first' operation or another 'next' operation. Based on maxim-ic application note 187. More...

## Detailed Description

### template<typename Impl_t>
class utl::_1wire_uart_i< Impl_t >

1-wire UART interface template class using CRTP Using the private virtual interface we provide the interface from _1wire_i<>

A 1-wire implementation using a microprocessor's uart for bit timing inherited from _1wire_i base class.

See also
  _1wire_i

Definition at line 52 of file _1wire_uart.h.

## Member Typedef Documentation

## Speed

template<typename Impl_t >

using utl::_1wire_uart_i< Impl_t >::Speed = typename _1wire_i<type>::Speed

Bring bus speed.

Definition at line 57 of file _1wire_uart.h.

## type

template<typename Impl_t >

using utl::_1wire_uart_i< Impl_t >::type = _1wire_uart_i<Impl_t>

Export type as identity meta-function.

Definition at line 56 of file _1wire_uart.h.

## Member Enumeration Documentation

## BR

template<typename Impl_t >

enum utl::_1wire_uart_i::BR

private

1-wire UART baudrates

Enumerator
BR_STD_RST |
BR_OVR_RST |
BR_STD |
BR_OVR |

Definition at line 103 of file _1wire_uart.h.

## Constructor & Destructor Documentation

## _1wire_uart_i()

template<typename Impl_t >

utl::_1wire_uart_i< Impl_t >::_1wire_uart_i | ( |  | ) |

protecteddefault

Allow constructor from derived only.

## ~_1wire_uart_i()

template<typename Impl_t >

utl::_1wire_uart_i< Impl_t >::~_1wire_uart_i | ( |  | ) |

protecteddefault

Allow destructor from derived only

## Member Function Documentation

## _CRTP_IMPL()

template<typename Impl_t >

utl::_1wire_uart_i< Impl_t >::_CRTP_IMPL | ( | Impl_t |  | ) |

private

## _reset()

template<typename Impl_t >

bool utl::_1wire_uart_i< Impl_t >::_reset | ( | Speed | s | ) |

private

Generate a 1-wire reset

Reset \ / \ X X X /

RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP < -------— 1024/174 usec ----------—>

TX: (STD)0xF0, (OVDR)0xF8 RX: less if present

Parameters

  t | Timing

Returns
  The status of the operation
  - 0 Fail
  - 1 Success

Definition at line 181 of file _1wire_uart.h.

## bit()

template<typename Impl_t >

bool utl::_1wire_uart_i< Impl_t >::bit | ( | bool | b | ) |

inlineprivate

Send a 1-Wire write bit and read the response.

Write 1 — -----------------------------------—

## Read 0/1 \ /

RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP TX: 0xFF RX: 0xFF->1, less->0

Write 0 — ---—

## Read 0 \ /

RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP < ----------— 87/11 usec ----------—> TX: 0x00 RX: 0x00

Parameters

  b | The bit to send

Returns
  The response

Definition at line 136 of file _1wire_uart.h.

## speed() [1/2]

template<typename Impl_t >

Speed utl::_1wire_uart_i< Impl_t >::speed | ( |  | ) | const

inlineprivate

Get the 1-wire bus speed.

Definition at line 111 of file _1wire_uart.h.

## speed() [2/2]

template<typename Impl_t >

void utl::_1wire_uart_i< Impl_t >::speed | ( | Speed | s | ) |

private

Set the 1-wire bus speed.

Set the 1-wire bus speed for normal operation only

Note
  We have moved the BR set functionality here to reduce the code inside bit(). This is OK as long as the _1wire_i<> always check speed.

Parameters

  s | The desired speed

Definition at line 156 of file _1wire_uart.h.

## UART_BR()

template<typename Impl_t >

void utl::_1wire_uart_i< Impl_t >::UART_BR | ( | uint32_t | br | ) |

inlineprivate

Implementers's (driver) baudrate function.

Parameters

  The | desired Baudrate

Definition at line 96 of file _1wire_uart.h.

## UART_RW()

template<typename Impl_t >

byte_t utl::_1wire_uart_i< Impl_t >::UART_RW | ( | byte_t | byte | ) |

inlineprivate

Implementers's (driver) read-write function. We expect the following USART configuration:

- Word Length = 8 Bits
- Stop Bit = One Stop bit
- Parity = No parity
  Parameters

    The | byte to send

  Returns
    The byte received.
  Note
    Due to the nature of the technique, the received byte is the actual bus condition during the communication frame (time slot)

Definition at line 89 of file _1wire_uart.h.

## Member Data Documentation

## _1wire_i< _1wire_uart_i< Impl_t > >

template<typename Impl_t >

friend utl::_1wire_uart_i< Impl_t >::_1wire_i< _1wire_uart_i< Impl_t > >

private

Syntactic sugar to CRTP casting.

Definition at line 54 of file _1wire_uart.h.

## _speed

template<typename Impl_t >

Speed utl::_1wire_uart_i< Impl_t >::_speed {Speed::STD}

private

Definition at line 109 of file _1wire_uart.h.

The documentation for this class was generated from the following file:

- include/utl/com/_1wire_uart.h