I run chibiOS/RT with the Firmware from 6.1.2013.
I changed the blinking Port to GPIO7.
The LED change State every second.
I implement two functions to the shell (hanoi and ackermann).
When i run ackermann, the pi hangs and nothing work. i will try to change to unsigned int.
When I run hanoi, then everything works fine.
->But the LED is blinking very fast (polling). This is wrong because it has to change every second the State.
}
void hanoi(BaseSequentialStream *chp, int n, char a, char b, char c){
if(n > 0){
hanoi(chp, n-1, a, c, b);
chprintf(chp,"Uebertragung von %c auf %c\r\n", a, b);
hanoi(chp, n-1, c, b, a);
}
}
static void cmd_ackermann(BaseSequentialStream chp, int argc, char argv[]) {
I run chibiOS/RT with the Firmware from 6.1.2013. I changed the blinking Port to GPIO7.
The LED change State every second. I implement two functions to the shell (hanoi and ackermann).
When i run ackermann, the pi hangs and nothing work. i will try to change to unsigned int.
When I run hanoi, then everything works fine. ->But the LED is blinking very fast (polling). This is wrong because it has to change every second the State.
Where is the mistake ? Or is this not true RTOS?
static void cmd_hanoi(BaseSequentialStream chp, int argc, char argv[]) { chprintf(chp, "start\r\n"); hanoi(chp, 20,'A','C','B'); chprintf(chp, "end\r\n");
} void hanoi(BaseSequentialStream *chp, int n, char a, char b, char c){ if(n > 0){ hanoi(chp, n-1, a, c, b); chprintf(chp,"Uebertragung von %c auf %c\r\n", a, b); hanoi(chp, n-1, c, b, a); } }
static void cmd_ackermann(BaseSequentialStream chp, int argc, char argv[]) {
} int ackermann(int n, int m){ if (n == 0) return m+1; else if (m == 0) return ackermann(n - 1, 1); else return ackermann(n - 1, ackermann(n, m - 1)); }
static const ShellCommand commands[] = {
ifdef EXTENDED_SHELL
{"mem", cmd_mem}, {"threads", cmd_threads}, {"test", cmd_test}
endif
{"ackermann", cmd_ackermann}, {"hanoi", cmd_hanoi}, {"reboot", cmd_reboot}, {NULL, NULL} };