Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: rover_car rover_pc supervisor watering_unit ... more
ssWiPort.hpp
00001 /** \file ssWiPort.hpp 00002 * \brief Header for introducing the dual head port 00003 * 00004 */ 00005 00006 #ifndef __SHARED_SLOTTED_WIRELESS_PORT_HPP__ 00007 #define __SHARED_SLOTTED_WIRELESS_PORT_HPP__ 00008 00009 #include "rtos.h" 00010 00011 #include "ssWiTypes.hpp" 00012 00013 #include <atomic> 00014 00015 /** \brief Internal type which represents a logical flow 00016 * 00017 * Ports are used internally to model a virtual memory are of the network. 00018 * Note that a port is a dual gate memory area which means that if you write 00019 * on it, the reading operation does not read that value but the one received 00020 * through the network 00021 */ 00022 class ssWiPort 00023 { 00024 /** \brief receiving buffer */ 00025 std::atomic<PortValue> valueRX; 00026 00027 /** \brief transmission buffer */ 00028 std::atomic<PortValue> valueTX; 00029 00030 /** \brief modification flag (if true a new value has to be sent) */ 00031 std::atomic<bool> modified; 00032 00033 public: 00034 00035 /** \brief constructor */ 00036 ssWiPort () { 00037 modified = false; 00038 valueTX = 0; 00039 valueRX = 0; 00040 } 00041 00042 /** \brief get the value to be sent 00043 */ 00044 PortValue getTXValue(); 00045 00046 /** \brief write a value to be sent 00047 */ 00048 void setTXValue(PortValue tmp); 00049 00050 /** \brief true if there is a value to be sent 00051 */ 00052 bool isModified(); 00053 00054 /** \brief Read the last received value 00055 */ 00056 PortValue getRXValue(); 00057 00058 /** \brief Write the last received value 00059 */ 00060 void setRXValue(PortValue tmp); 00061 00062 }; 00063 00064 #endif //__SHARED_SLOTTED_WIRELESS_PORT_HPP__
Generated on Tue Jul 12 2022 15:15:30 by
1.7.2