mirror of https://github.com/ARMmbed/mbed-os.git
Enhance compatibility between control_t and base_control_t:
* Add conversion operator in control_t to convert instances to base_control_tpull/2559/head
parent
6d319c521f
commit
7a6edda44c
|
@ -174,11 +174,10 @@ namespace v1 {
|
||||||
control_t(base_control_t other) :
|
control_t(base_control_t other) :
|
||||||
base_control_t(other) {}
|
base_control_t(other) {}
|
||||||
|
|
||||||
control_t
|
friend control_t operator+(const control_t& lhs, const control_t& rhs) {
|
||||||
inline operator+(const control_t& rhs) const {
|
|
||||||
control_t result(
|
control_t result(
|
||||||
repeat_t(this->repeat | rhs.repeat),
|
repeat_t(lhs.repeat | rhs.repeat),
|
||||||
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : this->timeout);
|
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : lhs.timeout);
|
||||||
|
|
||||||
if (result.timeout != TIMEOUT_NONE && result.timeout > rhs.timeout) {
|
if (result.timeout != TIMEOUT_NONE && result.timeout > rhs.timeout) {
|
||||||
result.timeout = rhs.timeout;
|
result.timeout = rhs.timeout;
|
||||||
|
@ -208,6 +207,14 @@ namespace v1 {
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator base_control_t() const {
|
||||||
|
base_control_t result = {
|
||||||
|
repeat,
|
||||||
|
timeout
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static base_control_t make_base_control_t(repeat_t repeat, uint32_t timeout) {
|
static base_control_t make_base_control_t(repeat_t repeat, uint32_t timeout) {
|
||||||
base_control_t result = {
|
base_control_t result = {
|
||||||
|
|
Loading…
Reference in New Issue