From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: STM32F4 Discovery, communication and libraries Date: Wed, 10 Sep 2014 10:46:49 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <60a42dc6-d8d0-4432-ae5a-86de18b82840@googlegroups.com> <5kkrv9hejn2qhdckkeo8lidkbh3bkme1gn@4ax.com> <5b91313c-acf9-4a6e-b157-6ba7c8021567@googlegroups.com> <0513ad07-6fbe-463a-be6f-097cd5113f52@googlegroups.com> <4f1ec65a-d66a-40bf-a0d6-278fde206e70@googlegroups.com> <1cjwzr30b24xy.11kpydntxhfo5$.dlg@40tude.net> <929e9226-e4aa-474e-843c-68ed800eefad@googlegroups.com> <5b5583ca-c7b2-40be-9090-6253f0514db5@googlegroups.com> <7feccd2d-dcfd-405e-ae5d-e27d6662daa9@googlegroups.com> <854mwfwonu.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 10 Sep 2014 17:46:51 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="5b4eadb0ecf28f7f740a0e18f3715b8f"; logging-data="11716"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pDal07ShBcuEdEKhyVV1r8y7HyQDlhFc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 In-Reply-To: <854mwfwonu.fsf@stephe-leake.org> Cancel-Lock: sha1:TF2PzFxt/xhpDHnLffTqvtTImhs= Xref: number.nntp.dca.giganews.com comp.lang.ada:188954 Date: 2014-09-10T10:46:49-07:00 List-Id: On 09/10/2014 07:11 AM, Stephen Leake wrote: > > Yes, control may have tighter timing requirements. But if they can all > be expressed as fixed periods, and it all fits within your CPU budget, > then a timer-driven single thread is the way to go. Anything more > complicated just makes the system harder to understand, and eats power. What makes the system harder to understand is an implementation that doesn't model the problem. For example, the problem description doesn't exactly scream "priority queue", a possible implementation suggested in another post. To my mind, the problem description sounds like a loop that wakes up every T seconds and does whatever sampling/control is required at that time (where T is the largest interval such that all the sampling/control intervals are integral multiples of T). A task per sampled/controlled device would be the next possible implementation I would consider. As always, one should always write the clearest implementation and then measure it before making it less clear to meet timing or power-consumption requirements. > Way overkill. Global variables is all you need. While a publish/subscribe mechanism is probably overkill, global variables should never be used. Global variables are a guaranteed way to make your S/W hard to understand and modify. -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49