Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU9250_SPI
Fork of WearableDevice_Nucleo by
main.cpp@1:a6dc717fb060, 2017-10-11 (annotated)
- Committer:
- gusteibolt
- Date:
- Wed Oct 11 17:28:39 2017 +0000
- Revision:
- 1:a6dc717fb060
- Parent:
- 0:73cd0cb02330
- Child:
- 3:26aeff25f610
Initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gusteibolt | 1:a6dc717fb060 | 1 | /* |
gusteibolt | 1:a6dc717fb060 | 2 | * Los Putacos |
gusteibolt | 1:a6dc717fb060 | 3 | * Copyright (C) 2017, All rights reserved. |
gusteibolt | 1:a6dc717fb060 | 4 | * ________________________________________ |
gusteibolt | 1:a6dc717fb060 | 5 | * |
gusteibolt | 1:a6dc717fb060 | 6 | * Created by: Gustavo Campana, Michael Schmidt, Miguel Lopez |
gusteibolt | 1:a6dc717fb060 | 7 | * Date: 11-Oct-2017 |
gusteibolt | 1:a6dc717fb060 | 8 | * Version: V0.1 |
gusteibolt | 1:a6dc717fb060 | 9 | */ |
gusteibolt | 1:a6dc717fb060 | 10 | |
gusteibolt | 1:a6dc717fb060 | 11 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 12 | // Board: NUCLEO - F401RE |
gusteibolt | 1:a6dc717fb060 | 13 | // Version: MR1136 rev C |
gusteibolt | 1:a6dc717fb060 | 14 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 15 | |
gusteibolt | 1:a6dc717fb060 | 16 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 17 | // Includes |
gusteibolt | 0:73cd0cb02330 | 18 | #include "mbed.h" |
gusteibolt | 0:73cd0cb02330 | 19 | #include "rtos.h" |
gusteibolt | 1:a6dc717fb060 | 20 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 21 | |
gusteibolt | 1:a6dc717fb060 | 22 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 23 | // Declarations |
gusteibolt | 1:a6dc717fb060 | 24 | DigitalOut led1(LED1); |
gusteibolt | 1:a6dc717fb060 | 25 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 26 | |
gusteibolt | 1:a6dc717fb060 | 27 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 28 | // Global Variables |
gusteibolt | 1:a6dc717fb060 | 29 | //----------------------------------------------------------------- |
gusteibolt | 1:a6dc717fb060 | 30 | |
gusteibolt | 1:a6dc717fb060 | 31 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 32 | void print_char(char c = '*') |
gusteibolt | 0:73cd0cb02330 | 33 | { |
gusteibolt | 0:73cd0cb02330 | 34 | printf("%c", c); |
gusteibolt | 0:73cd0cb02330 | 35 | fflush(stdout); |
gusteibolt | 0:73cd0cb02330 | 36 | } |
gusteibolt | 1:a6dc717fb060 | 37 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 38 | |
gusteibolt | 1:a6dc717fb060 | 39 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 40 | void print_thread(void const *argument) |
gusteibolt | 0:73cd0cb02330 | 41 | { |
gusteibolt | 0:73cd0cb02330 | 42 | while (true) { |
gusteibolt | 0:73cd0cb02330 | 43 | Thread::wait(1000); |
gusteibolt | 0:73cd0cb02330 | 44 | print_char(); |
gusteibolt | 0:73cd0cb02330 | 45 | } |
gusteibolt | 0:73cd0cb02330 | 46 | } |
gusteibolt | 1:a6dc717fb060 | 47 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 48 | |
gusteibolt | 1:a6dc717fb060 | 49 | //----------------------------------------------------------------- |
gusteibolt | 0:73cd0cb02330 | 50 | int main() |
gusteibolt | 0:73cd0cb02330 | 51 | { |
gusteibolt | 0:73cd0cb02330 | 52 | printf("\n\n*** RTOS basic example ***\n"); |
gusteibolt | 0:73cd0cb02330 | 53 | Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); |
gusteibolt | 0:73cd0cb02330 | 54 | while (true) { |
gusteibolt | 0:73cd0cb02330 | 55 | led1 = !led1; |
gusteibolt | 0:73cd0cb02330 | 56 | Thread::wait(500); |
gusteibolt | 0:73cd0cb02330 | 57 | } |
gusteibolt | 0:73cd0cb02330 | 58 | } |
gusteibolt | 1:a6dc717fb060 | 59 | //----------------------------------------------------------------- |