14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

114 Appendix B. Documentation <strong>of</strong> <strong>the</strong> programming<br />

void Led_SM(void);<br />

void Print_Int(int a, u8 * str);<br />

void vectorByMatrix3x1(double A[][3], double x[3],<br />

double b[3]);<br />

void vectorByMatrix4x1(double A[][4], double x[4],<br />

double b[4]);<br />

void Matrix_Mult(double a1[][4], double a2[][4],<br />

double a3[][4]);<br />

void Matrix_Mult3334(double a1[][3], double a2[][4],<br />

double a3[][4]);<br />

void Matrix_Mult3443(double a1[][4], double a2[][3],<br />

double a3[][3]);<br />

void Inverse(double A[][3], double X[][3]);<br />

void vectorByMatrix3x1_s16(s16 A[][3], s16 x[3], s16 b[3]);<br />

/* Private functions ---------------------------------------------------------*/<br />

void Led_SM(void) {<br />

static int Count = 0;<br />

}<br />

Count++;<br />

if (Count < 50000) {<br />

LED_ON(LEDR);<br />

} else {<br />

LED_OFF(LEDR);<br />

if (Count > 60000) {<br />

Count = 0;<br />

}<br />

}<br />

void Print_Int(int a, u8 * str) {<br />

u8 myStr[10];<br />

USB_WriteString(str);<br />

USB_WriteString(":");<br />

Num2String(a, myStr);<br />

USB_WriteString(myStr);<br />

USB_WriteString("\r\n");<br />

}<br />

void vectorByMatrix3x1(double A[][3], double x[3],<br />

double b[3]) {<br />

b[0] = A[0][0] * x[0] + A[0][1] * x[1] + A[0][2] * x[2];<br />

b[1] = A[1][0] * x[0] + A[1][1] * x[1] + A[1][2] * x[2];<br />

b[2] = A[2][0] * x[0] + A[2][1] * x[1] + A[2][2] * x[2];<br />

}<br />

void vectorByMatrix3x1_s16(s16 A[][3], s16 x[3], s16 b[3]) {<br />

b[0] = A[0][0] * x[0] / 100 + A[0][1] * x[1] / 100<br />

+ A[0][2] * x[2] / 100;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!