uTL
micro Template library
|
Template base class for 1-wire communication interface using CRTP. More...
#include <_1wire.h>
Public Types | |
enum | Speed { Speed::STD =0, Speed::OVDR } |
1-wire bus speed More... | |
using | type = _1wire_i |
Export type as identity meta-function. More... | |
Public Member Functions | |
User functionality provided by the interface | |
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... | |
Protected Member Functions | |
Object lifetime | |
_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 | |
| |
Speed | speed () const |
Get the 1-wire bus speed. More... | |
void | speed (Speed s) |
bool | bit (bool b) |
Write a bit to the 1-Wire bus, return response/write status and provide the recovery time. More... | |
bool | _reset (Speed s) |
Private Attributes | |
_1wire_id_t | dec_ {_1wire_id_t::nullDev()} |
_1wire_id_t | pos_ {_1wire_id_t::nullDev()} |
_1wire_id_t | cur_ {_1wire_id_t::nullDev()} |
Friends api to provide functionality to all class specializations | |
enum | Command { CMD_READ_ROM = 0x33, CMD_OVDR_SKIP = 0x3C, CMD_MATCH = 0x55, CMD_OVDR_MATCH = 0x69, CMD_SKIP = 0xCC, CMD_ALARM_SEARCH = 0xEC, CMD_SEARCH_ROM = 0xF0 } |
template<typename _T > | |
byte_t | _1wire_i_det::_touch (_T &, byte_t, typename _T::Speed) |
template<typename _T > | |
void | _1wire_i_det::_match (_T &obj, _1wire_id_t &id, typename _T::Speed s) |
template<typename _T > | |
void | _1wire_i_det::_match_n_ovdr (_T &obj, _1wire_id_t &id) |
template<typename _T > | |
void | _1wire_i_det::_skip (_T &obj, typename _T::Speed s) |
template<typename _T > | |
void | _1wire_i_det::_skip_n_ovdr (_T &obj) |
template<typename _T > | |
_1wire_id_t | _1wire_i_det::_first (_T &, typename _T::Speed, bool) |
template<typename _T > | |
_1wire_id_t | _1wire_i_det::_next (_T &, typename _T::Speed, bool) |
Template base class for 1-wire communication interface using CRTP.
impl_t | The CRTP type (the derived/implementation class typename). |
using utl::_1wire_i< impl_t >::type = _1wire_i |
|
private |
|
strong |
|
protecteddefault |
Allow constructor from derived only.
|
protecteddefault |
Allow destructor from derived only.
|
protecteddelete |
No copies.
|
private |
|
inlineprivate |
|
inlineprivate |
|
inline |
'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.
s | The bus speed |
alarm | If set, search for alarm devices |
|
inline |
|
inline |
|
inline |
'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.
s | The bus speed |
alarm | If set, search for alarm devices |
|
protecteddelete |
|
inline |
|
inline |
size_t utl::_1wire_i< _I >::rx_data | ( | byte_t * | in, |
size_t | n, | ||
Speed | s = Speed::STD |
||
) |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
size_t utl::_1wire_i< _I >::tx_data | ( | const byte_t * | out, |
byte_t * | in, | ||
size_t | n, | ||
Speed | s = Speed::STD |
||
) |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |