Track gyro using a DCM.
This brings in an implementation of some general matrix manipulation routines, not all of which are used at teh moment. Output the DCM on the UART at 50Hz for the host to display it usefully.
This commit is contained in:
25
uart.c
25
uart.c
@@ -155,6 +155,31 @@ void putint(unsigned int n) {
|
||||
putstr(s+i);
|
||||
}
|
||||
|
||||
void putint_s(int n) {
|
||||
char s[12];
|
||||
int i;
|
||||
int neg;
|
||||
|
||||
/* OK, technically, this might not work properly for the most
|
||||
* negative possible number. Oh well.
|
||||
*/
|
||||
neg = (n < 0);
|
||||
if (neg)
|
||||
n = -n;
|
||||
|
||||
i = 11;
|
||||
s[i] = '\0';
|
||||
|
||||
do {
|
||||
s[--i] = n % 10 + '0';
|
||||
} while ((n /= 10) > 0);
|
||||
|
||||
if (neg)
|
||||
s[--i] = '-';
|
||||
|
||||
putstr(s+i);
|
||||
}
|
||||
|
||||
void puthex(unsigned int n) {
|
||||
char s[9];
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user