Browse Subversion Repository
Contents of /simulator/tRunCtrlDevice.cpp
Parent Directory
| Revision Log
Revision 139 -
( show annotations)
( download)
( as text)
Sun Nov 11 00:44:41 2007 UTC
(16 years, 5 months ago)
by satofumi
File MIME type: text/x-c++src
File size: 928 byte(s)
fix sh7045/crt0.S
| 1 |
/*! |
| 2 |
\file |
| 3 |
\brief 移動ロボットのデバイスシミュレータ |
| 4 |
|
| 5 |
\author Satofumi KAMIMURA |
| 6 |
|
| 7 |
$Id$ |
| 8 |
*/ |
| 9 |
|
| 10 |
#include "motorCtrl.h" |
| 11 |
|
| 12 |
|
| 13 |
static int TargetCnt[2] = { 0, 0 }; |
| 14 |
|
| 15 |
|
| 16 |
int imask_get(void) { |
| 17 |
// !!! |
| 18 |
return 0; |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
void imask_set(int level) { |
| 23 |
// !!! |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
// encoderCtrl.c |
| 28 |
void initEncoder(int id, encoderCtrl_t *encoder) { |
| 29 |
encoder->id = id; |
| 30 |
TargetCnt[encoder->id] = 0; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
void updateEncoderInfo(encoderCtrl_t *encoder) { |
| 35 |
encoder->diff = TargetCnt[encoder->id]; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
int getEncoderDiff(const encoderCtrl_t *encoder) { |
| 40 |
return encoder->diff; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
// motorCtrl.c |
| 45 |
void initMotor(int id, motorCtrl_t *motor) { |
| 46 |
motor->id = id; |
| 47 |
|
| 48 |
initEncoder(motor->id, &motor->encoder); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
void setMotorPwm(motorCtrl_t *motor, unsigned char pwm) { |
| 53 |
// !!! |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
void setMotorMode(motorCtrl_t *motor, MotorMode mode) { |
| 58 |
// !!! |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
void setMotorVel(motorCtrl_t *motor, int cnt) { |
| 63 |
// 指令値通りにモータ回転を行わせる |
| 64 |
TargetCnt[motor->id] = cnt; |
| 65 |
} |
|