1、Tutorial:ZBus-the lightweight and flexible Zephyr message busRodrigo Peixoto,Edge-UFAL/Citriniorodrigopex1Thread AThread BThread CCallback DCallback ESubscribersListenersAsynchronousSynchronousTimeSpaceSynchronizationDecoupledCoupled ZBusChan 1Chan 2Chan 3Chan N2Bus topologies3ONE-TO-ONEONE-TO-MANYM
2、ANY-TO-MANYExample of use4 ZBUSProposed solution5 APP INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa threadTimerWQ ZBUSStep 016Main thread ZBUSStep 027PROJECT INFOMain thread ZBUSStep 038PROJECT INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMock
3、 ZBUSStep 049PROJECT INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore thread ZBUSStep 0510PROJECT INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa thread ZBUSStep 0611PROJECT INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAY
4、LOADCore threadTRANSMISSION DONELoRa threadTimerWQ ZBUSStep 0712PROJECT INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa threadTimerWQ ZBUSStep 0813 APP INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa thre
5、adTimerWQ ZBUSStep 0914 APP INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa threadTimerWQFix execution sequence!ZBUSStep 1015 APP INFOSTART TRIGGERSensor threadMain threadSENSOR DATAMockPAYLOADCore threadTRANSMISSION DONELoRa threadTimerWQTips and tric
6、ks16 Avoid excessive use of them,they are running during the publishing processListeners17 Think of them as an ISR.They must run as quickly as possible Do not sleep inside listeners.It will increase the publishing latencyListeners18 Use zbus_chan_const_msg ins