Page 1 of 1
Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 2:08 am
by AtomSoft
If you go to page 11/139
Should it be:
Code: Select all
void swap (int &x, int &y) {
int tmp = x;
x = y;
y = tmp;
}
Re: Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 2:22 am
by Folknology
Jason (Lopez) Good catch, maybe there should be an errata section on the forums for documentation/books etc..
Jason (XCore admin) could that be added?
Re: Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 2:36 am
by AtomSoft
heh thanks im just reading through this and seen it nothing special really :D
Re: Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 2:50 am
by AtomSoft
Since this is a getting start thread i should add to it heh...
Code: Select all
# include <xs1.h>
in port oneBit = XS1_PORT_1A ;
out port counter = XS1_PORT_4A ;
int main ( void ) {
int x;
int i = 0;
oneBit :> x;
while (1) {
oneBit when pinsneq (x) :> x;
counter <: ++i;
}
}
Ok to clarify .. because the PDF wasnt clear to me... What this is doing is sampling the PIN 1A and storing the value into x....
Now lets say x = 0 @
The below line basically gets the PIN 1A value and waits until its NOT EQUAL to x (initial value) and when its not it places the new value into x...
This code increments i by 1 (i = i +1) then stores it in counter variable..
Would that be exactly how it works? wasnt that easier to understand if it was correct... heh
Re: Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 10:17 am
by jason
Folknology wrote:Jason (Lopez) Good catch, maybe there should be an errata section on the forums for documentation/books etc..
Jason (XCore admin) could that be added?
I think the official errata can be found on the book page on XMOS.com.
For example for
Programming on XMOS Devices. Scroll to the bottom.
I think it would be wise to raise a support ticket on the XMOS.com site so they can be aware of this and update it in one location, otherwise updates/edits will be hard to track for the people writing the books.
Re: Found something in Programming XC on XMOS Devices PDF
Posted: Tue Dec 15, 2009 3:21 pm
by AtomSoft
i sent out a ticket.