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: mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed
app/TaskGyroscope.h@10:4051c38bf73f, 2018-11-02 (annotated)
- Committer:
- mitea1
- Date:
- Fri Nov 02 17:01:02 2018 +0000
- Revision:
- 10:4051c38bf73f
- Parent:
- 6:90655031d4f7
wtf
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mitea1 | 0:f2815503561f | 1 | /** |
| mitea1 | 0:f2815503561f | 2 | * @file TaskGyroscope.h |
| mitea1 | 0:f2815503561f | 3 | * |
| mitea1 | 0:f2815503561f | 4 | * @author Adrian |
| mitea1 | 0:f2815503561f | 5 | * @date 30.05.2016 |
| mitea1 | 0:f2815503561f | 6 | * |
| mitea1 | 0:f2815503561f | 7 | */ |
| mitea1 | 0:f2815503561f | 8 | |
| mitea1 | 0:f2815503561f | 9 | #include "MPU9250.h" |
| mitea1 | 0:f2815503561f | 10 | #include "MPU9250GyroscopeMessage.h" |
| mitea1 | 0:f2815503561f | 11 | #include "main.h" |
| mitea1 | 6:90655031d4f7 | 12 | #include "Task.h" |
| mitea1 | 0:f2815503561f | 13 | |
| mitea1 | 0:f2815503561f | 14 | #ifndef TASKGYROSCOPE_H_ |
| mitea1 | 0:f2815503561f | 15 | #define TASKGYROSCOPE_H_ |
| mitea1 | 0:f2815503561f | 16 | |
| mitea1 | 0:f2815503561f | 17 | /** |
| mitea1 | 0:f2815503561f | 18 | * @class TaskGyroscope |
| mitea1 | 0:f2815503561f | 19 | * @brief This TaskGyroscope Class handles the gyroscope measurement using the MPU9250. |
| mitea1 | 0:f2815503561f | 20 | * Starting the task using the start() starts the measurement of all axis. |
| mitea1 | 0:f2815503561f | 21 | * It can be used alongside with other measurement Tasks inside the mbed::rtos |
| mitea1 | 0:f2815503561f | 22 | * environment. The Task Class basically wraps mbeds Thread functionality. |
| mitea1 | 0:f2815503561f | 23 | */ |
| mitea1 | 6:90655031d4f7 | 24 | class TaskGyroscope : public Task { |
| mitea1 | 0:f2815503561f | 25 | public: |
| mitea1 | 0:f2815503561f | 26 | TaskGyroscope(MPU9250*,Mutex*, Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT>*); |
| mitea1 | 0:f2815503561f | 27 | TaskGyroscope(MPU9250*,Mutex*,Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT>*, |
| mitea1 | 0:f2815503561f | 28 | osPriority, uint32_t, unsigned char*); |
| mitea1 | 0:f2815503561f | 29 | virtual ~TaskGyroscope(); |
| mitea1 | 0:f2815503561f | 30 | |
| mitea1 | 6:90655031d4f7 | 31 | private: |
| mitea1 | 0:f2815503561f | 32 | |
| mitea1 | 0:f2815503561f | 33 | rtos::Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT>* queue; |
| mitea1 | 0:f2815503561f | 34 | |
| mitea1 | 0:f2815503561f | 35 | MPU9250* mpu9250; |
| mitea1 | 0:f2815503561f | 36 | |
| mitea1 | 4:2674bd4168f8 | 37 | /** |
| mitea1 | 0:f2815503561f | 38 | * @brief A thread safe method that acquires data from the gyroscope. After acquiring data from the |
| mitea1 | 0:f2815503561f | 39 | * it stores the data inside a MPU9250GyroscopeMessage |
| mitea1 | 0:f2815503561f | 40 | */ |
| mitea1 | 6:90655031d4f7 | 41 | void measure(); |
| mitea1 | 0:f2815503561f | 42 | |
| mitea1 | 0:f2815503561f | 43 | /** |
| mitea1 | 0:f2815503561f | 44 | * @brief Sets the message Queue of the Task where the measured values will be stored |
| mitea1 | 0:f2815503561f | 45 | * after the measurement |
| mitea1 | 0:f2815503561f | 46 | * @param queueGyro the queue where the MPU9250GyroscopeMessage will be stored |
| mitea1 | 0:f2815503561f | 47 | */ |
| mitea1 | 0:f2815503561f | 48 | void setQueue(Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT>* queueGyro); |
| mitea1 | 0:f2815503561f | 49 | |
| mitea1 | 0:f2815503561f | 50 | }; |
| mitea1 | 0:f2815503561f | 51 | |
| mitea1 | 0:f2815503561f | 52 | #endif /* TASKGYROSCOPE_H_ */ |