| Line |  | 
|---|
| 1 | // gyrohandler.cc | 
|---|
| 2 | // Eric Aubourg         CEA/DAPNIA/SPP   septembre 1999 | 
|---|
| 3 |  | 
|---|
| 4 | #include <string.h> | 
|---|
| 5 | #include "gyrohandler.h" | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 | GyroHandler::GyroHandler() { | 
|---|
| 9 | memset(gyro, 0, 3*nb_per_block*2*sizeof(int4)); | 
|---|
| 10 | } | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | GyroHandler::GyroHandler(GyroHandler const& x) { | 
|---|
| 14 | memcpy(gyro, x.gyro, 3*nb_per_block*2*sizeof(int4)); | 
|---|
| 15 | } | 
|---|
| 16 |  | 
|---|
| 17 | GyroHandler& GyroHandler::operator = (GyroHandler const& x) { | 
|---|
| 18 | memcpy(gyro, x.gyro, 3*nb_per_block*2*sizeof(int4)); | 
|---|
| 19 | return *this; | 
|---|
| 20 | } | 
|---|
| 21 |  | 
|---|
| 22 | GyroHandler::~GyroHandler() { | 
|---|
| 23 |  | 
|---|
| 24 | } | 
|---|
| 25 |  | 
|---|
| 26 | void GyroHandler::ProcessBlock(block_type_gyro* blk) { | 
|---|
| 27 | memcpy(gyro, blk->gyro, 3*nb_per_block*2*sizeof(int4)); | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | int4  GyroHandler::getRawSignal(int imesure, int igyro) { | 
|---|
| 31 | if (igyro<0 || igyro>=3) return 0; | 
|---|
| 32 | if (imesure<0 || imesure>=nb_per_block*2) return 0; | 
|---|
| 33 | return gyro[igyro][imesure]-32768; | 
|---|
| 34 | } | 
|---|
| 35 |  | 
|---|
| 36 | double GyroHandler::getSignal(int imesure, int igyro) {  // V | 
|---|
| 37 | return getRawSignal(imesure, igyro) * 2. / 32768.; // +- 2V dynamique sur 16 bits | 
|---|
| 38 | } | 
|---|
| 39 |  | 
|---|
| 40 | double GyroHandler::getSpeed(int imesure, int igyro) { | 
|---|
| 41 | return getSignal(imesure, igyro) * 10; | 
|---|
| 42 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.