<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">or use an S16 to return a (+ve) U8
value on success, with one of many -ve values indicating error(s).<br>
<br>
-mark<br>
<br>
On 5/02/2016 5:21 p.m., Jasper Mackenzie wrote:<br>
</div>
<blockquote
cite="mid:CAO0ALo2Mz67WyUSBb6oc95D-NOx2EH3HbT2=XjmE02w=JrowXQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>Good day all,<br>
</div>
What is the opinion of this esteemed group on
the best/proper/whatever way to get the
measured value from some external input from a
micro in C.<br>
</div>
<div>By measured value I mean something like
ADC, OW temp sensor, I2C sensor state etc.<br>
</div>
I am considering the following three scenarios
in increasing order of goodness:<br>
</div>
1) function returns the measured value indicating
error by out of range result (i.e 0xFF for 8 bit
int)<br>
</div>
<div>i.e:<br>
...<br>
</div>
<div>unit8_t readSomePin(void); // 0xFF indicates
error<br>
<br>
</div>
2) function returns the measured value indicating
status of measurement in another extern. variable<br>
...<br>
</div>
extern uint8_t readSomePinStatus;<br>
unit8_t readSomePin(void); // Status in
readSomePinStatus<br>
<br>
</div>
3) function returns status, the value is stored in an
argument variable:<br>
...<br>
</div>
unint8_t readSomePin(uint8_t *returnedValue);<br>
<br>
</div>
So, what is best? Is there a better way? This could no doubt
also be done with Structs, but seems like overkill to me.<br>
<br>
</div>
Cheers<br>
<br>
</div>
jasper<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Chchrobotics mailing list <a class="moz-txt-link-abbreviated" href="mailto:Chchrobotics@lists.linuxnut.co.nz">Chchrobotics@lists.linuxnut.co.nz</a>
<a class="moz-txt-link-freetext" href="http://lists.ourshack.com/mailman/listinfo/chchrobotics">http://lists.ourshack.com/mailman/listinfo/chchrobotics</a>
Mail Archives: <a class="moz-txt-link-freetext" href="http://lists.ourshack.com/pipermail/chchrobotics/">http://lists.ourshack.com/pipermail/chchrobotics/</a>
Meetings usually 3rd Monday each month. See <a class="moz-txt-link-freetext" href="http://kiwibots.org">http://kiwibots.org</a> for venue, directions and dates.
When replying, please edit your Subject line to reflect new subjects.</pre>
</blockquote>
<br>
</body>
</html>