@@ -40,6 +40,9 @@ class Shared
40
40
{
41
41
public:
42
42
43
+ T get ();
44
+ void set (T const & val);
45
+
43
46
operator T ();
44
47
void operator = (T const & other);
45
48
inline T peek () const { return _val; }
@@ -57,7 +60,7 @@ class Shared
57
60
**************************************************************************************/
58
61
59
62
template <class T , size_t QUEUE_SIZE>
60
- Shared<T,QUEUE_SIZE>::operator T ()
63
+ T Shared<T,QUEUE_SIZE>::get ()
61
64
{
62
65
T * val_ptr = _mailbox.try_get_for (rtos::Kernel::wait_for_u32_forever);
63
66
if (val_ptr)
@@ -70,7 +73,7 @@ Shared<T,QUEUE_SIZE>::operator T()
70
73
}
71
74
72
75
template <class T , size_t QUEUE_SIZE>
73
- void Shared<T,QUEUE_SIZE>::operator = (T const & other )
76
+ void Shared<T,QUEUE_SIZE>::set (T const & val )
74
77
{
75
78
/* If the mailbox is full we are discarding the
76
79
* oldest element and then push the new one into
@@ -92,4 +95,16 @@ void Shared<T,QUEUE_SIZE>::operator = (T const & other)
92
95
}
93
96
}
94
97
98
+ template <class T , size_t QUEUE_SIZE>
99
+ Shared<T,QUEUE_SIZE>::operator T ()
100
+ {
101
+ return get ();
102
+ }
103
+
104
+ template <class T , size_t QUEUE_SIZE>
105
+ void Shared<T,QUEUE_SIZE>::operator = (T const & other)
106
+ {
107
+ set (other);
108
+ }
109
+
95
110
#endif /* ARDUINO_THREADS_SHARED_HPP_ */
0 commit comments