|
uTL
micro Template library
|
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>
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 | |
| |
| 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... | |
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.
Definition at line 52 of file _1wire_uart.h.
| 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.
| 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.
|
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.
|
protecteddefault |
Allow constructor from derived only.
|
protecteddefault |
Allow destructor from derived only
|
private |
|
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
| t | Timing |
Definition at line 181 of file _1wire_uart.h.
|
inlineprivate |
Send a 1-Wire write bit and read the response.
Write 1 — -----------------------------------—
RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP TX: 0xFF RX: 0xFF->1, less->0
Write 0 — ---—
RS: | | | | | | | | | | | bit: ST 0 1 2 3 4 5 6 7 SP < ----------— 87/11 usec ----------—> TX: 0x00 RX: 0x00
| b | The bit to send |
Definition at line 136 of file _1wire_uart.h.
|
inlineprivate |
Get the 1-wire bus speed.
Definition at line 111 of file _1wire_uart.h.
|
private |
Set the 1-wire bus speed.
Set the 1-wire bus speed for normal operation only
| s | The desired speed |
Definition at line 156 of file _1wire_uart.h.
|
inlineprivate |
Implementers's (driver) baudrate function.
| The | desired Baudrate |
Definition at line 96 of file _1wire_uart.h.
|
inlineprivate |
Implementers's (driver) read-write function. We expect the following USART configuration:
| The | byte to send |
Definition at line 89 of file _1wire_uart.h.
|
private |
Syntactic sugar to CRTP casting.
Definition at line 54 of file _1wire_uart.h.
|
private |
Definition at line 109 of file _1wire_uart.h.