Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak7451ctrl.cpp@39:3821886c902e, 2017-07-18 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Tue Jul 18 23:20:26 2017 +0000
- Revision:
- 39:3821886c902e
- Parent:
- 34:1ea3357c8d9a
- Child:
- 43:45225713cd58
For AK09970 Small demo board. Takezawa-san's request.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 11:cef8dc1cf010 | 1 | #include "ak7451ctrl.h" |
masahikofukasawa | 11:cef8dc1cf010 | 2 | #include "debug.h" |
masahikofukasawa | 11:cef8dc1cf010 | 3 | |
masahikofukasawa | 11:cef8dc1cf010 | 4 | /** |
masahikofukasawa | 11:cef8dc1cf010 | 5 | * Constructor. |
masahikofukasawa | 11:cef8dc1cf010 | 6 | * |
masahikofukasawa | 11:cef8dc1cf010 | 7 | */ |
masahikofukasawa | 27:41aa9fb23a2f | 8 | Ak7451Ctrl::Ak7451Ctrl() : AkmSensor(){ |
masahikofukasawa | 11:cef8dc1cf010 | 9 | ak7451 = NULL; |
masahikofukasawa | 11:cef8dc1cf010 | 10 | } |
masahikofukasawa | 11:cef8dc1cf010 | 11 | |
masahikofukasawa | 11:cef8dc1cf010 | 12 | /** |
masahikofukasawa | 11:cef8dc1cf010 | 13 | * Destructor. |
masahikofukasawa | 11:cef8dc1cf010 | 14 | * |
masahikofukasawa | 11:cef8dc1cf010 | 15 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 16 | Ak7451Ctrl::~Ak7451Ctrl(){ |
masahikofukasawa | 11:cef8dc1cf010 | 17 | if (ak7451) delete ak7451; |
masahikofukasawa | 11:cef8dc1cf010 | 18 | } |
masahikofukasawa | 11:cef8dc1cf010 | 19 | |
masahikofukasawa | 11:cef8dc1cf010 | 20 | AkmSensor::Status Ak7451Ctrl::init(const uint8_t id, const uint8_t subid){ |
masahikofukasawa | 11:cef8dc1cf010 | 21 | primaryId = id; |
masahikofukasawa | 11:cef8dc1cf010 | 22 | subId = subid; |
masahikofukasawa | 11:cef8dc1cf010 | 23 | |
masahikofukasawa | 11:cef8dc1cf010 | 24 | if(subId == SUB_ID_AK7451){ |
tkstreet | 25:76c11ab5060e | 25 | SPI* mSpi; // SPI connection |
tkstreet | 25:76c11ab5060e | 26 | DigitalOut* mCs; // Chip select pin |
tkstreet | 25:76c11ab5060e | 27 | |
tkstreet | 25:76c11ab5060e | 28 | // Initialize SPI connection |
masahikofukasawa | 11:cef8dc1cf010 | 29 | AK7451::Status status = AK7451::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 30 | mSpi = new SPI(SPI_MOSI, SPI_MISO, SPI_SCK); |
masahikofukasawa | 11:cef8dc1cf010 | 31 | mSpi->format(8,1); // 8bit, Mode=1 |
masahikofukasawa | 11:cef8dc1cf010 | 32 | mSpi->frequency(1000000); |
tkstreet | 25:76c11ab5060e | 33 | |
tkstreet | 25:76c11ab5060e | 34 | // Initialize chip select pin |
masahikofukasawa | 11:cef8dc1cf010 | 35 | mCs = new DigitalOut(SPI_CS); |
masahikofukasawa | 11:cef8dc1cf010 | 36 | ak7451 = new AK7451(); |
masahikofukasawa | 11:cef8dc1cf010 | 37 | ak7451->begin(mSpi, mCs); |
masahikofukasawa | 13:d008249f0359 | 38 | sensorName = "AK7451"; |
masahikofukasawa | 11:cef8dc1cf010 | 39 | |
tkstreet | 25:76c11ab5060e | 40 | // Set to User Mode |
masahikofukasawa | 11:cef8dc1cf010 | 41 | status = ak7451->setOperationMode(AK7451::AK7451_USER_MODE); |
masahikofukasawa | 11:cef8dc1cf010 | 42 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 43 | MSG("#Error: AK7451 user mode failed.\r\n"); |
masahikofukasawa | 11:cef8dc1cf010 | 44 | return AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 45 | } |
masahikofukasawa | 11:cef8dc1cf010 | 46 | MSG("#AK7451 user mode succeed.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 47 | |
masahikofukasawa | 30:5a241d9b3262 | 48 | // E_RD 0x1 clockwise rotation |
masahikofukasawa | 30:5a241d9b3262 | 49 | // E_Z_MODE 0x0 normal output |
masahikofukasawa | 30:5a241d9b3262 | 50 | // E_ABZ_E 0x1 ABZ Output enable |
masahikofukasawa | 30:5a241d9b3262 | 51 | // E_ABZ_HYS 0x2 ABZ Hysteresis=1LSB |
masahikofukasawa | 30:5a241d9b3262 | 52 | // ABZ_RES 0x0 ABZ phase resolution = 1024ppr |
masahikofukasawa | 30:5a241d9b3262 | 53 | char data[2] = {0x02,0xA0}; |
tkstreet | 25:76c11ab5060e | 54 | |
masahikofukasawa | 11:cef8dc1cf010 | 55 | status = ak7451->writeEEPROM(0x07,data); // set clockwise |
masahikofukasawa | 11:cef8dc1cf010 | 56 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 57 | MSG("#Error: AK7451 write EEPROM failed.\r\n"); |
masahikofukasawa | 11:cef8dc1cf010 | 58 | return AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 59 | } |
masahikofukasawa | 39:3821886c902e | 60 | MSG("#Error: AK7451 write EEPROM succeed.\r\n"); |
tkstreet | 34:1ea3357c8d9a | 61 | |
masahikofukasawa | 30:5a241d9b3262 | 62 | /* |
tkstreet | 25:76c11ab5060e | 63 | // Set to Normal Mode |
masahikofukasawa | 11:cef8dc1cf010 | 64 | status = ak7451->setOperationMode(AK7451::AK7451_NORMAL_MODE); |
masahikofukasawa | 11:cef8dc1cf010 | 65 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 11:cef8dc1cf010 | 66 | MSG("#AK7451 normal mode failed.\r\n"); |
masahikofukasawa | 11:cef8dc1cf010 | 67 | return AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 68 | } |
masahikofukasawa | 11:cef8dc1cf010 | 69 | MSG("#AK7451 normal mode succeed.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 70 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 71 | interval = SENSOR_SAMPLING_RATE; // 10Hz |
masahikofukasawa | 11:cef8dc1cf010 | 72 | } |
masahikofukasawa | 11:cef8dc1cf010 | 73 | else{ |
masahikofukasawa | 11:cef8dc1cf010 | 74 | return AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 75 | } |
masahikofukasawa | 11:cef8dc1cf010 | 76 | |
masahikofukasawa | 11:cef8dc1cf010 | 77 | return AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 78 | } |
masahikofukasawa | 11:cef8dc1cf010 | 79 | |
masahikofukasawa | 11:cef8dc1cf010 | 80 | AkmSensor::Status Ak7451Ctrl::startSensor(){ |
masahikofukasawa | 30:5a241d9b3262 | 81 | AK7451::Status status = ak7451->setOperationMode(AK7451::AK7451_NORMAL_MODE); |
masahikofukasawa | 30:5a241d9b3262 | 82 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 83 | MSG("#Error: AK7451 normal mode failed.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 84 | return AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 85 | } |
masahikofukasawa | 29:b488d2c89fba | 86 | ticker.attach(callback(this, &AkmSensor::setEvent), interval); |
masahikofukasawa | 11:cef8dc1cf010 | 87 | return AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 88 | } |
masahikofukasawa | 11:cef8dc1cf010 | 89 | |
masahikofukasawa | 11:cef8dc1cf010 | 90 | AkmSensor::Status Ak7451Ctrl::startSensor(const float sec){ |
masahikofukasawa | 30:5a241d9b3262 | 91 | AK7451::Status status = ak7451->setOperationMode(AK7451::AK7451_NORMAL_MODE); |
masahikofukasawa | 30:5a241d9b3262 | 92 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 93 | MSG("#Error: AK7451 normal mode failed.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 94 | return AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 95 | } |
masahikofukasawa | 30:5a241d9b3262 | 96 | |
masahikofukasawa | 11:cef8dc1cf010 | 97 | interval = sec; |
masahikofukasawa | 29:b488d2c89fba | 98 | ticker.attach(callback(this, &AkmSensor::setEvent), interval); |
masahikofukasawa | 29:b488d2c89fba | 99 | MSG("#Start sensor %s.\r\n",sensorName); |
masahikofukasawa | 11:cef8dc1cf010 | 100 | return AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 101 | } |
masahikofukasawa | 11:cef8dc1cf010 | 102 | |
masahikofukasawa | 11:cef8dc1cf010 | 103 | AkmSensor::Status Ak7451Ctrl::stopSensor(){ |
masahikofukasawa | 30:5a241d9b3262 | 104 | AK7451::Status status; |
masahikofukasawa | 30:5a241d9b3262 | 105 | status = ak7451->setOperationMode(AK7451::AK7451_USER_MODE); |
masahikofukasawa | 30:5a241d9b3262 | 106 | if( status != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 107 | MSG("#Error: AK7451 user mode failed.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 108 | return AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 109 | } |
masahikofukasawa | 11:cef8dc1cf010 | 110 | ticker.detach(); |
masahikofukasawa | 29:b488d2c89fba | 111 | AkmSensor::clearEvent(); |
masahikofukasawa | 11:cef8dc1cf010 | 112 | return AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 113 | } |
masahikofukasawa | 11:cef8dc1cf010 | 114 | |
masahikofukasawa | 11:cef8dc1cf010 | 115 | AkmSensor::Status Ak7451Ctrl::readSensorData(Message* msg){ |
masahikofukasawa | 29:b488d2c89fba | 116 | AkmSensor::clearEvent(); |
masahikofukasawa | 29:b488d2c89fba | 117 | |
masahikofukasawa | 11:cef8dc1cf010 | 118 | char angle[2] = {0x00,0x00}; |
masahikofukasawa | 11:cef8dc1cf010 | 119 | AK7451::Status status = ak7451->readAngle(angle); |
masahikofukasawa | 11:cef8dc1cf010 | 120 | |
masahikofukasawa | 11:cef8dc1cf010 | 121 | msg->setCommand(Message::CMD_START_MEASUREMENT); |
masahikofukasawa | 11:cef8dc1cf010 | 122 | msg->setArgument( 0, status ); |
masahikofukasawa | 11:cef8dc1cf010 | 123 | msg->setArgument( 1, angle[0] ); |
masahikofukasawa | 11:cef8dc1cf010 | 124 | msg->setArgument( 2, angle[1] ); |
masahikofukasawa | 11:cef8dc1cf010 | 125 | |
masahikofukasawa | 11:cef8dc1cf010 | 126 | if( status != SUCCESS){ |
masahikofukasawa | 11:cef8dc1cf010 | 127 | return AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 128 | } |
masahikofukasawa | 11:cef8dc1cf010 | 129 | return AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 130 | } |
masahikofukasawa | 11:cef8dc1cf010 | 131 | |
masahikofukasawa | 11:cef8dc1cf010 | 132 | AkmSensor::Status Ak7451Ctrl::requestCommand(Message* in, Message* out){ |
masahikofukasawa | 11:cef8dc1cf010 | 133 | AkmSensor::Status status = AkmSensor::SUCCESS; |
masahikofukasawa | 11:cef8dc1cf010 | 134 | |
masahikofukasawa | 11:cef8dc1cf010 | 135 | Message::Command cmd = in->getCommand(); |
masahikofukasawa | 11:cef8dc1cf010 | 136 | |
masahikofukasawa | 11:cef8dc1cf010 | 137 | switch(cmd){ |
masahikofukasawa | 30:5a241d9b3262 | 138 | case Message::CMD_ANGLE_READ: |
masahikofukasawa | 30:5a241d9b3262 | 139 | { |
masahikofukasawa | 30:5a241d9b3262 | 140 | // read angle |
masahikofukasawa | 30:5a241d9b3262 | 141 | char angle[2] = {0x00,0x00}; |
masahikofukasawa | 30:5a241d9b3262 | 142 | char density = 0x00; |
masahikofukasawa | 30:5a241d9b3262 | 143 | char abnormal = 0x00; |
masahikofukasawa | 30:5a241d9b3262 | 144 | |
masahikofukasawa | 30:5a241d9b3262 | 145 | if( ak7451->readAngleMeasureCommand(angle, &density, &abnormal) != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 146 | MSG("#Error: read angle\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 147 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 148 | } |
masahikofukasawa | 30:5a241d9b3262 | 149 | out->setCommand(Message::CMD_ANGLE_READ); |
masahikofukasawa | 30:5a241d9b3262 | 150 | out->setArgument( 0, (abnormal != 0x03)|(status == AkmSensor::ERROR) ? 0x01 : 0x00 ); |
masahikofukasawa | 30:5a241d9b3262 | 151 | out->setArgument( 1, angle[0] ); |
masahikofukasawa | 30:5a241d9b3262 | 152 | out->setArgument( 2, angle[1] ); |
masahikofukasawa | 30:5a241d9b3262 | 153 | out->setArgument( 3, density ); |
masahikofukasawa | 30:5a241d9b3262 | 154 | break; |
masahikofukasawa | 30:5a241d9b3262 | 155 | } |
masahikofukasawa | 11:cef8dc1cf010 | 156 | case Message::CMD_ANGLE_ZERO_RESET: |
masahikofukasawa | 11:cef8dc1cf010 | 157 | { |
masahikofukasawa | 30:5a241d9b3262 | 158 | AK7451::Status st; |
masahikofukasawa | 30:5a241d9b3262 | 159 | /* |
masahikofukasawa | 30:5a241d9b3262 | 160 | AK7451::OperationMode mode = AK7451::AK7451_USER_MODE; |
masahikofukasawa | 11:cef8dc1cf010 | 161 | |
masahikofukasawa | 30:5a241d9b3262 | 162 | // check the mode |
masahikofukasawa | 30:5a241d9b3262 | 163 | char data[1]; |
masahikofukasawa | 30:5a241d9b3262 | 164 | if( ak7451->readRegister(0x00, data) != AK7451::SUCCESS) { |
masahikofukasawa | 30:5a241d9b3262 | 165 | MSG("#NORMAL MODE detected. Set into USER mode.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 166 | mode = AK7451::AK7451_NORMAL_MODE; |
masahikofukasawa | 30:5a241d9b3262 | 167 | st = ak7451->setOperationMode(AK7451::AK7451_USER_MODE); |
masahikofukasawa | 30:5a241d9b3262 | 168 | if( st != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 169 | MSG("#Error: when set user mode\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 170 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 171 | } |
masahikofukasawa | 11:cef8dc1cf010 | 172 | } |
masahikofukasawa | 30:5a241d9b3262 | 173 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 174 | st = ak7451->setAngleZero(); // reset ZP data |
masahikofukasawa | 11:cef8dc1cf010 | 175 | if( st != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 176 | MSG("#Error: setAngleZero: code=%d\r\n",st); |
masahikofukasawa | 11:cef8dc1cf010 | 177 | status = AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 178 | } |
masahikofukasawa | 30:5a241d9b3262 | 179 | /* |
masahikofukasawa | 30:5a241d9b3262 | 180 | st = ak7451->setOperationMode(mode); |
masahikofukasawa | 11:cef8dc1cf010 | 181 | if( st != AK7451::SUCCESS ){ |
masahikofukasawa | 39:3821886c902e | 182 | MSG("#Error: when set mode:%d\r\n",mode); |
masahikofukasawa | 11:cef8dc1cf010 | 183 | status = AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 184 | } |
masahikofukasawa | 30:5a241d9b3262 | 185 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 186 | if( status == AkmSensor::ERROR ){ |
masahikofukasawa | 11:cef8dc1cf010 | 187 | out->setArgument(0,1); |
masahikofukasawa | 11:cef8dc1cf010 | 188 | }else{ |
masahikofukasawa | 11:cef8dc1cf010 | 189 | out->setArgument(0,0); |
masahikofukasawa | 11:cef8dc1cf010 | 190 | } |
masahikofukasawa | 11:cef8dc1cf010 | 191 | break; |
masahikofukasawa | 11:cef8dc1cf010 | 192 | } |
masahikofukasawa | 30:5a241d9b3262 | 193 | case Message::CMD_REG_WRITE: |
masahikofukasawa | 30:5a241d9b3262 | 194 | case Message::CMD_REG_WRITEN: |
masahikofukasawa | 30:5a241d9b3262 | 195 | { |
masahikofukasawa | 30:5a241d9b3262 | 196 | char address = in->getArgument(0); |
masahikofukasawa | 30:5a241d9b3262 | 197 | int len = in->getArgument(1); |
masahikofukasawa | 30:5a241d9b3262 | 198 | if(len != 2){ |
masahikofukasawa | 39:3821886c902e | 199 | MSG("#Error: length=%d. Only support 2byte length\r\n",len); |
masahikofukasawa | 30:5a241d9b3262 | 200 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 201 | return status; |
masahikofukasawa | 30:5a241d9b3262 | 202 | } |
masahikofukasawa | 30:5a241d9b3262 | 203 | if(in->getArgNum() != len+2){ |
masahikofukasawa | 39:3821886c902e | 204 | MSG("#Error: argument num. Args=%d\r\n",in->getArgNum()); |
masahikofukasawa | 30:5a241d9b3262 | 205 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 206 | out->setArgument(0,(char)status); |
masahikofukasawa | 30:5a241d9b3262 | 207 | return status; |
masahikofukasawa | 30:5a241d9b3262 | 208 | } |
masahikofukasawa | 30:5a241d9b3262 | 209 | |
masahikofukasawa | 30:5a241d9b3262 | 210 | char data[len]; |
masahikofukasawa | 30:5a241d9b3262 | 211 | for(int i=0; i<len; i++){ |
masahikofukasawa | 30:5a241d9b3262 | 212 | data[i] = in->getArgument(i+2); |
masahikofukasawa | 30:5a241d9b3262 | 213 | } |
masahikofukasawa | 30:5a241d9b3262 | 214 | if( ak7451->writeRegister(address, data) != AK7451::SUCCESS) { |
masahikofukasawa | 30:5a241d9b3262 | 215 | status = AkmSensor::ERROR; |
masahikofukasawa | 39:3821886c902e | 216 | MSG("#Error: register write.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 217 | } |
masahikofukasawa | 30:5a241d9b3262 | 218 | if( ak7451->writeEEPROM(address, data) != AK7451::SUCCESS) { |
masahikofukasawa | 30:5a241d9b3262 | 219 | status = AkmSensor::ERROR; |
masahikofukasawa | 39:3821886c902e | 220 | MSG("#Error: EEPROM write.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 221 | } |
masahikofukasawa | 30:5a241d9b3262 | 222 | out->setArgument(0,(char)status); |
masahikofukasawa | 30:5a241d9b3262 | 223 | break; |
masahikofukasawa | 30:5a241d9b3262 | 224 | } |
masahikofukasawa | 30:5a241d9b3262 | 225 | case Message::CMD_REG_READ: |
masahikofukasawa | 30:5a241d9b3262 | 226 | case Message::CMD_REG_READN: |
masahikofukasawa | 30:5a241d9b3262 | 227 | { |
masahikofukasawa | 30:5a241d9b3262 | 228 | if(in->getArgNum() != 2){ |
masahikofukasawa | 39:3821886c902e | 229 | MSG("#Error: argument num. Args=%d\r\n",in->getArgNum()); |
masahikofukasawa | 30:5a241d9b3262 | 230 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 231 | return status; |
masahikofukasawa | 30:5a241d9b3262 | 232 | } |
masahikofukasawa | 30:5a241d9b3262 | 233 | |
masahikofukasawa | 30:5a241d9b3262 | 234 | char address = in->getArgument(0); |
masahikofukasawa | 30:5a241d9b3262 | 235 | int len = in->getArgument(1); |
masahikofukasawa | 30:5a241d9b3262 | 236 | if(len != 2){ |
masahikofukasawa | 39:3821886c902e | 237 | MSG("#Error: length=%d. Only support 2byte length\r\n",len); |
masahikofukasawa | 30:5a241d9b3262 | 238 | status = AkmSensor::ERROR; |
masahikofukasawa | 30:5a241d9b3262 | 239 | return status; |
masahikofukasawa | 30:5a241d9b3262 | 240 | } |
masahikofukasawa | 30:5a241d9b3262 | 241 | char data[len]; |
masahikofukasawa | 30:5a241d9b3262 | 242 | if( ak7451->readRegister(address, data) != AK7451::SUCCESS) { |
masahikofukasawa | 30:5a241d9b3262 | 243 | status = AkmSensor::ERROR; |
masahikofukasawa | 39:3821886c902e | 244 | MSG("#Error: register read.\r\n"); |
masahikofukasawa | 30:5a241d9b3262 | 245 | } |
masahikofukasawa | 30:5a241d9b3262 | 246 | for(int i=0; i<len; i++){ |
masahikofukasawa | 30:5a241d9b3262 | 247 | out->setArgument(i, data[i]); |
masahikofukasawa | 30:5a241d9b3262 | 248 | } |
masahikofukasawa | 30:5a241d9b3262 | 249 | break; |
masahikofukasawa | 30:5a241d9b3262 | 250 | } |
masahikofukasawa | 11:cef8dc1cf010 | 251 | default: |
masahikofukasawa | 11:cef8dc1cf010 | 252 | { |
masahikofukasawa | 39:3821886c902e | 253 | MSG("#Error: no command.\r\n"); |
masahikofukasawa | 11:cef8dc1cf010 | 254 | status = AkmSensor::ERROR; |
masahikofukasawa | 11:cef8dc1cf010 | 255 | break; |
masahikofukasawa | 11:cef8dc1cf010 | 256 | } |
masahikofukasawa | 11:cef8dc1cf010 | 257 | } |
masahikofukasawa | 11:cef8dc1cf010 | 258 | |
masahikofukasawa | 11:cef8dc1cf010 | 259 | return status; |
masahikofukasawa | 11:cef8dc1cf010 | 260 | } |
masahikofukasawa | 11:cef8dc1cf010 | 261 |