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.
main.cpp@0:4ff8aeb3e4d1, 2021-04-02 (annotated)
- Committer:
- _seminahn
- Date:
- Fri Apr 02 05:24:49 2021 +0000
- Revision:
- 0:4ff8aeb3e4d1
- Child:
- 1:2594a70c1ddd
top_module
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| _seminahn | 0:4ff8aeb3e4d1 | 1 | /* mbed Microcontroller Library |
| _seminahn | 0:4ff8aeb3e4d1 | 2 | * Copyright (c) 2019 ARM Limited |
| _seminahn | 0:4ff8aeb3e4d1 | 3 | * SPDX-License-Identifier: Apache-2.0 |
| _seminahn | 0:4ff8aeb3e4d1 | 4 | * |
| _seminahn | 0:4ff8aeb3e4d1 | 5 | * 20201024 Thread example : |
| _seminahn | 0:4ff8aeb3e4d1 | 6 | * got from https://os.mbed.com/docs/mbed-os/v6.3/apis/thread.html |
| _seminahn | 0:4ff8aeb3e4d1 | 7 | */ |
| _seminahn | 0:4ff8aeb3e4d1 | 8 | #define NO_ROS 0 |
| _seminahn | 0:4ff8aeb3e4d1 | 9 | #include "mbedHeader.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 10 | #include "robotConfig.h" |
| _seminahn | 0:4ff8aeb3e4d1 | 11 | #include "rosHeader.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 12 | #include "moduleHeader.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 13 | #include "defineHeader.h" |
| _seminahn | 0:4ff8aeb3e4d1 | 14 | #include "instanceHeader.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 15 | #include "myUtil.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 16 | #include "globalVariable.h" |
| _seminahn | 0:4ff8aeb3e4d1 | 17 | #include "initFunction.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 18 | #include "threadDeclaration.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 19 | #include "callbackHeader.hpp" |
| _seminahn | 0:4ff8aeb3e4d1 | 20 | |
| _seminahn | 0:4ff8aeb3e4d1 | 21 | /* function protopytes begin ------------------------------------------------ */ |
| _seminahn | 0:4ff8aeb3e4d1 | 22 | |
| _seminahn | 0:4ff8aeb3e4d1 | 23 | /* function protopytes end -------------------------------------------------- */ |
| _seminahn | 0:4ff8aeb3e4d1 | 24 | |
| _seminahn | 0:4ff8aeb3e4d1 | 25 | |
| _seminahn | 0:4ff8aeb3e4d1 | 26 | /* Instancs begin ----------------------------------------------------------- */ |
| _seminahn | 0:4ff8aeb3e4d1 | 27 | #if (NO_ROS) |
| _seminahn | 0:4ff8aeb3e4d1 | 28 | mbed::Serial pc(USBTX, USBRX); |
| _seminahn | 0:4ff8aeb3e4d1 | 29 | #else |
| _seminahn | 0:4ff8aeb3e4d1 | 30 | ros::NodeHandle nh; |
| _seminahn | 0:4ff8aeb3e4d1 | 31 | #endif |
| _seminahn | 0:4ff8aeb3e4d1 | 32 | //MODULE module(BOOSTPUMP_PIN, SOLENOID_PIN, PURIFIER_PWM_PIN, PURIFIER_BR_PIN, UVC_PIN); |
| _seminahn | 0:4ff8aeb3e4d1 | 33 | MODULE module(PURIFIER_PWM_PIN, PURIFIER_BR_PIN, UVC_PIN); |
| _seminahn | 0:4ff8aeb3e4d1 | 34 | Serial bt(BT_TX,BT_RX); |
| _seminahn | 0:4ff8aeb3e4d1 | 35 | #define CALIBRATION_MODE 1 |
| _seminahn | 0:4ff8aeb3e4d1 | 36 | /* Instancs end ------------------------------------------------------------- */ |
| _seminahn | 0:4ff8aeb3e4d1 | 37 | int main() { |
| _seminahn | 0:4ff8aeb3e4d1 | 38 | SystemCoreClockUpdate(); |
| _seminahn | 0:4ff8aeb3e4d1 | 39 | #if (NO_ROS) |
| _seminahn | 0:4ff8aeb3e4d1 | 40 | initSerial(); |
| _seminahn | 0:4ff8aeb3e4d1 | 41 | //pc.printf("- Start of Program. CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock); |
| _seminahn | 0:4ff8aeb3e4d1 | 42 | #else |
| _seminahn | 0:4ff8aeb3e4d1 | 43 | initROS(); |
| _seminahn | 0:4ff8aeb3e4d1 | 44 | #endif |
| _seminahn | 0:4ff8aeb3e4d1 | 45 | //initBT(); |
| _seminahn | 0:4ff8aeb3e4d1 | 46 | initThread(); |
| _seminahn | 0:4ff8aeb3e4d1 | 47 | while(1) {;} |
| _seminahn | 0:4ff8aeb3e4d1 | 48 | #if (NO_ROS) |
| _seminahn | 0:4ff8aeb3e4d1 | 49 | pc.printf("- End of Program\r\n"); |
| _seminahn | 0:4ff8aeb3e4d1 | 50 | #endif |
| _seminahn | 0:4ff8aeb3e4d1 | 51 | return 0; |
| _seminahn | 0:4ff8aeb3e4d1 | 52 | } |
| _seminahn | 0:4ff8aeb3e4d1 | 53 | |
| _seminahn | 0:4ff8aeb3e4d1 | 54 | /***** EOF *****/ |