diff options
author | tfateba <tfateba@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2016-11-04 23:36:20 +0000 |
---|---|---|
committer | tfateba <tfateba@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2016-11-04 23:36:20 +0000 |
commit | 55b0336818642ea4a350f58d979689015831440f (patch) | |
tree | e19542dd46dd18aa7fa67f3ba57fb2fb0a1247ee /demos/AVR/RT-ARDUINOMINI/main.c | |
parent | 66c47f272539b8e2f3530b2baf27323b6099ae1b (diff) | |
download | ChibiOS-55b0336818642ea4a350f58d979689015831440f.tar.gz ChibiOS-55b0336818642ea4a350f58d979689015831440f.tar.bz2 ChibiOS-55b0336818642ea4a350f58d979689015831440f.zip |
Add support for AVR, Arduino Mini board.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9901 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/AVR/RT-ARDUINOMINI/main.c')
-rw-r--r-- | demos/AVR/RT-ARDUINOMINI/main.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/demos/AVR/RT-ARDUINOMINI/main.c b/demos/AVR/RT-ARDUINOMINI/main.c new file mode 100644 index 000000000..4b25768f4 --- /dev/null +++ b/demos/AVR/RT-ARDUINOMINI/main.c @@ -0,0 +1,62 @@ +/*
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include "ch.h"
+#include "hal.h"
+
+static THD_WORKING_AREA(waThread1, 32);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+ chRegSetThreadName("Blinker");
+ while (true) {
+ palTogglePad(IOPORT2, PORTB_LED1);
+ chThdSleepMilliseconds(1000);
+ }
+}
+
+/*
+ * Application entry point.
+ */
+int main(void) {
+
+ /*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ palClearPad(IOPORT2, PORTB_LED1);
+
+ /*
+ * Activates the serial driver 1 using the driver default configuration.
+ */
+ sdStart(&SD1, NULL);
+
+ /*
+ * Starts the LED blinker thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ chnWrite(&SD1, (const uint8_t *)"Hello World!\r\n", 14);
+ while(TRUE) {
+ chThdSleepMilliseconds(1000);
+ }
+}
|