Reaction Wheel Actuated Satellite Dynamics Test Platform
Diploma Thesis in Aerospace Engineering, January 2014
University of Applied Sciences Munich, Faculty 03
Electronics:
- 1x mbed NXP LPC 1768 Microcontroller
- 2x XBee S1 Radios + Sparkfun USB Adapter
- 1x CHR UM6-lt IMU
- 4x Graupner BEC 8 Motor Controllers
- 4x ROXXY 2826/09 Brushless Motors
- 1x Hacker TopFuel LiPo 1300mAh Battery
- 1x big Selfmade BreakOutBoard to connect all components
- 1x small BreakOutBoard to connect IMU
Hardware developed with Catia V5R20
Manufactoring Technology: Rapid Prototyping - EOS Formiga P110
Controlled via text based menu with DockLight
__________________
MODSERIAL/example3b.cpp@0:1447d2f773db, 2014-07-09 (annotated)
- Committer:
- DimitriGruebel
- Date:
- Wed Jul 09 07:35:50 2014 +0000
- Revision:
- 0:1447d2f773db
Dynamics Test Platform
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DimitriGruebel | 0:1447d2f773db | 1 | /* |
DimitriGruebel | 0:1447d2f773db | 2 | Copyright (c) 2011 Andy Kirkham |
DimitriGruebel | 0:1447d2f773db | 3 | |
DimitriGruebel | 0:1447d2f773db | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
DimitriGruebel | 0:1447d2f773db | 5 | of this software and associated documentation files (the "Software"), to deal |
DimitriGruebel | 0:1447d2f773db | 6 | in the Software without restriction, including without limitation the rights |
DimitriGruebel | 0:1447d2f773db | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
DimitriGruebel | 0:1447d2f773db | 8 | copies of the Software, and to permit persons to whom the Software is |
DimitriGruebel | 0:1447d2f773db | 9 | furnished to do so, subject to the following conditions: |
DimitriGruebel | 0:1447d2f773db | 10 | |
DimitriGruebel | 0:1447d2f773db | 11 | The above copyright notice and this permission notice shall be included in |
DimitriGruebel | 0:1447d2f773db | 12 | all copies or substantial portions of the Software. |
DimitriGruebel | 0:1447d2f773db | 13 | |
DimitriGruebel | 0:1447d2f773db | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
DimitriGruebel | 0:1447d2f773db | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
DimitriGruebel | 0:1447d2f773db | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
DimitriGruebel | 0:1447d2f773db | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
DimitriGruebel | 0:1447d2f773db | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
DimitriGruebel | 0:1447d2f773db | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
DimitriGruebel | 0:1447d2f773db | 20 | THE SOFTWARE. |
DimitriGruebel | 0:1447d2f773db | 21 | |
DimitriGruebel | 0:1447d2f773db | 22 | @file example3b.cpp |
DimitriGruebel | 0:1447d2f773db | 23 | @purpose Demos a simple filter. |
DimitriGruebel | 0:1447d2f773db | 24 | @version see ChangeLog.c |
DimitriGruebel | 0:1447d2f773db | 25 | @author Andy Kirkham |
DimitriGruebel | 0:1447d2f773db | 26 | */ |
DimitriGruebel | 0:1447d2f773db | 27 | |
DimitriGruebel | 0:1447d2f773db | 28 | /* |
DimitriGruebel | 0:1447d2f773db | 29 | This example shows how to use the new callback system. In the old system |
DimitriGruebel | 0:1447d2f773db | 30 | Mbed's FunctionPointer[1] type was used to store abd make calls to callbacks. |
DimitriGruebel | 0:1447d2f773db | 31 | However, that limits the callback function prototype to void func(void); |
DimitriGruebel | 0:1447d2f773db | 32 | which means we cannot pass parameters. |
DimitriGruebel | 0:1447d2f773db | 33 | |
DimitriGruebel | 0:1447d2f773db | 34 | This latest version of MODSERIAL now uses its own callback object. This allows |
DimitriGruebel | 0:1447d2f773db | 35 | the passing of a pointer to a class that holds information about the MODSERIAL |
DimitriGruebel | 0:1447d2f773db | 36 | object making the callback. As of version 1.18 one critcal piece of information |
DimitriGruebel | 0:1447d2f773db | 37 | is passed, a pointer to the MODSERIAL object. This allows callbacks to use the |
DimitriGruebel | 0:1447d2f773db | 38 | MODSERIAL functions and data. |
DimitriGruebel | 0:1447d2f773db | 39 | |
DimitriGruebel | 0:1447d2f773db | 40 | Additionally, since MODSERIAL and the callback parameter class MODSERIAL_IRQ_INFO |
DimitriGruebel | 0:1447d2f773db | 41 | are friends, MODSERIAL_IRQ_INFO can access the protected functions of MODSERIAL. |
DimitriGruebel | 0:1447d2f773db | 42 | This is used to ensure functions that can only be called during a callback |
DimitriGruebel | 0:1447d2f773db | 43 | can be invoked from a callback. |
DimitriGruebel | 0:1447d2f773db | 44 | |
DimitriGruebel | 0:1447d2f773db | 45 | [1] http://mbed.org/projects/libraries/svn/mbed/trunk/FunctionPointer.h |
DimitriGruebel | 0:1447d2f773db | 46 | */ |
DimitriGruebel | 0:1447d2f773db | 47 | |
DimitriGruebel | 0:1447d2f773db | 48 | |
DimitriGruebel | 0:1447d2f773db | 49 | #ifdef COMPILE_EXAMPLE3_CODE_MODSERIAL |
DimitriGruebel | 0:1447d2f773db | 50 | |
DimitriGruebel | 0:1447d2f773db | 51 | #include "mbed.h" |
DimitriGruebel | 0:1447d2f773db | 52 | #include "MODSERIAL.h" |
DimitriGruebel | 0:1447d2f773db | 53 | |
DimitriGruebel | 0:1447d2f773db | 54 | void rxCallback(MODSERIAL_IRQ_INFO *info) { |
DimitriGruebel | 0:1447d2f773db | 55 | |
DimitriGruebel | 0:1447d2f773db | 56 | // Get the pointer to our MODSERIAL object that invoked this callback. |
DimitriGruebel | 0:1447d2f773db | 57 | MODSERIAL *pc = info->serial; |
DimitriGruebel | 0:1447d2f773db | 58 | |
DimitriGruebel | 0:1447d2f773db | 59 | // info->serial points at the MODSERIAL instance so we can use it to call |
DimitriGruebel | 0:1447d2f773db | 60 | // any of the public MODSERIAL functions that are normally available. So |
DimitriGruebel | 0:1447d2f773db | 61 | // there's now no need to use the global version (pc in our case) inside |
DimitriGruebel | 0:1447d2f773db | 62 | // callback functions. |
DimitriGruebel | 0:1447d2f773db | 63 | char c = pc->rxGetLastChar(); // Where local pc variable is a pointer to the global MODSERIAL pc object. |
DimitriGruebel | 0:1447d2f773db | 64 | |
DimitriGruebel | 0:1447d2f773db | 65 | // The following is rather daft but demos the point. |
DimitriGruebel | 0:1447d2f773db | 66 | // Don't allow the letter "A" go into the RX buffer. |
DimitriGruebel | 0:1447d2f773db | 67 | // Basically acts as a filter to remove the letter "A" |
DimitriGruebel | 0:1447d2f773db | 68 | // if it goes into the RX buffer. |
DimitriGruebel | 0:1447d2f773db | 69 | if (c == 'A') { |
DimitriGruebel | 0:1447d2f773db | 70 | // Note, we call the MODSERIAL_IRQ_INFO::rxDiscardLastChar() public function which |
DimitriGruebel | 0:1447d2f773db | 71 | // is permitted access to the protected version of MODSERIAL::rxDiscardLastChar() |
DimitriGruebel | 0:1447d2f773db | 72 | // within MODSERIAL (because they are friends). This ensures rxDiscardLastChar() |
DimitriGruebel | 0:1447d2f773db | 73 | // can only be called within an rxCallback function. |
DimitriGruebel | 0:1447d2f773db | 74 | info->rxDiscardLastChar(); |
DimitriGruebel | 0:1447d2f773db | 75 | } |
DimitriGruebel | 0:1447d2f773db | 76 | } |
DimitriGruebel | 0:1447d2f773db | 77 | |
DimitriGruebel | 0:1447d2f773db | 78 | #endif |