utl::_1wire_uart_i< virtual_tag > Class Template Referenceabstract

A virtual base class interface implementation. Using the private virtual interface we provide the interface from _1wire_i<virtual_tag> More...

`#include <_1wire_uart.h>`

Inheritance diagram for utl::_1wire_uart_i< virtual_tag >:

## Public Types

using | type = _1wire_uart_i< virtual_tag >
| Export type as identity meta-function. More...
using | Speed = typename _1wire_i< virtual_tag >::Speed
| Bring bus speed. More...
Public Types inherited from utl::_1wire_i< virtual_tag >
enum | Speed { Speed::STD =0, Speed::OVDR }
| 1-wire bus speed More...
using | type = _1wire_i< virtual_tag >
| 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< virtual_tag >
| _1wire_i ()=default
| Allow constructor from derived only. More...
| _1wire_i (const type &)=delete
| No copies. More...
type & | operator= (const type &)=delete

## Private Member Functions

Implementation requirements
virtual byte_t | UART_RW (byte_t byte)=0
| Implementers's (driver) read-write function. We use the following USART configuration: More...
virtual void | UART_BR (uint32_t br)=0
| Implementers's (driver) baudrate function. 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< virtual_tag >
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...
virtual | ~_1wire_i ()=default

## Detailed Description

### template<>
class utl::_1wire_uart_i< virtual_tag >

A virtual base class interface implementation. Using the private virtual interface we provide the interface from _1wire_i<virtual_tag>

Parameters

  impl_t | = virtual_tag

Definition at line 198 of file _1wire_uart.h.

## Member Typedef Documentation

## Speed

using utl::_1wire_uart_i< virtual_tag >::Speed = typename _1wire_i<virtual_tag>::Speed

Bring bus speed.

Definition at line 201 of file _1wire_uart.h.

## type

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

Export type as identity meta-function.

Definition at line 200 of file _1wire_uart.h.

## Member Enumeration Documentation

## BR

enum utl::_1wire_uart_i< virtual_tag >::BR

private

1-wire UART baudrates

Enumerator
BR_STD_RST |
BR_OVR_RST |
BR_STD |
BR_OVR |

Definition at line 244 of file _1wire_uart.h.

## Constructor & Destructor Documentation

## _1wire_uart_i()

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

protecteddefault

Allow constructor from derived only.

## ~_1wire_uart_i()

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

protecteddefault

Allow destructor from derived only

## Member Function Documentation

## _reset()

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

privatevirtual

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

Implements utl::_1wire_i< virtual_tag >.

Definition at line 320 of file _1wire_uart.h.

## bit()

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

inlineprivatevirtual

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

Implements utl::_1wire_i< virtual_tag >.

Definition at line 277 of file _1wire_uart.h.

## speed() [1/2]

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

inlineprivatevirtual

Get the 1-wire bus speed.

Implements utl::_1wire_i< virtual_tag >.

Definition at line 252 of file _1wire_uart.h.

## speed() [2/2]

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

privatevirtual

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

Implements utl::_1wire_i< virtual_tag >.

Definition at line 296 of file _1wire_uart.h.

## UART_BR()

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

privatepure virtual

Implementers's (driver) baudrate function.

Parameters

  The | desired Baudrate

## UART_RW()

virtual byte_t utl::_1wire_uart_i< virtual_tag >::UART_RW | ( | byte_t | byte | ) |

privatepure virtual

Implementers's (driver) read-write function. We use 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)

## Member Data Documentation

## _speed

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

private

Definition at line 250 of file _1wire_uart.h.

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

- include/utl/com/_1wire_uart.h