Utilities for i2c data connection. This is ported from https://github.com/jrowberg/i2cdevlib.

Dependents:   DISCO-F746NG_rtos_test

Fork of I2Cdev by Shundo Kishi

Committer:
TuxLeon
Date:
Sun Feb 11 18:32:25 2018 +0000
Revision:
1:df0c2ace5932
Parent:
0:3aa973ebe3e5
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
syundo0730 0:3aa973ebe3e5 1 // ported from arduino library: https://github.com/jrowberg/i2cdevlib
syundo0730 0:3aa973ebe3e5 2 // written by szymon gaertig (email: szymon@gaertig.com.pl, website: szymongaertig.pl)
syundo0730 0:3aa973ebe3e5 3 // modified by shundo kishi
syundo0730 0:3aa973ebe3e5 4 //
syundo0730 0:3aa973ebe3e5 5 // Changelog:
syundo0730 0:3aa973ebe3e5 6 // 2013-01-08 - first release
syundo0730 0:3aa973ebe3e5 7 // 2016-01-31 - changed all functions and variables static to make porting from arduino easier(by shundo kishi)
syundo0730 0:3aa973ebe3e5 8
syundo0730 0:3aa973ebe3e5 9 #include "I2Cdev.h"
TuxLeon 1:df0c2ace5932 10 #include "stm32746g_discovery.h"
syundo0730 0:3aa973ebe3e5 11
TuxLeon 1:df0c2ace5932 12 I2C I2Cdev::i2c(I2C_SDA, I2C_SCL);
syundo0730 0:3aa973ebe3e5 13
syundo0730 0:3aa973ebe3e5 14 /** Default constructor.
syundo0730 0:3aa973ebe3e5 15 */
syundo0730 0:3aa973ebe3e5 16 I2Cdev::I2Cdev() {
syundo0730 0:3aa973ebe3e5 17 }
syundo0730 0:3aa973ebe3e5 18
syundo0730 0:3aa973ebe3e5 19 /** Read a single bit from an 8-bit device register.
syundo0730 0:3aa973ebe3e5 20 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 21 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 22 * @param bitNum Bit position to read (0-7)
syundo0730 0:3aa973ebe3e5 23 * @param data Container for single bit value
syundo0730 0:3aa973ebe3e5 24 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 25 * @return Status of read operation (true = success)
syundo0730 0:3aa973ebe3e5 26 */
syundo0730 0:3aa973ebe3e5 27 int8_t I2Cdev::readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 28 uint8_t b;
syundo0730 0:3aa973ebe3e5 29 uint8_t count = readByte(devAddr, regAddr, &b, timeout);
syundo0730 0:3aa973ebe3e5 30 *data = b & (1 << bitNum);
syundo0730 0:3aa973ebe3e5 31 return count;
syundo0730 0:3aa973ebe3e5 32 }
syundo0730 0:3aa973ebe3e5 33
syundo0730 0:3aa973ebe3e5 34 /** Read a single bit from a 16-bit device register.
syundo0730 0:3aa973ebe3e5 35 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 36 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 37 * @param bitNum Bit position to read (0-15)
syundo0730 0:3aa973ebe3e5 38 * @param data Container for single bit value
syundo0730 0:3aa973ebe3e5 39 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 40 * @return Status of read operation (true = success)
syundo0730 0:3aa973ebe3e5 41 */
syundo0730 0:3aa973ebe3e5 42 int8_t I2Cdev::readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 43 uint16_t b;
syundo0730 0:3aa973ebe3e5 44 uint8_t count = readWord(devAddr, regAddr, &b, timeout);
syundo0730 0:3aa973ebe3e5 45 *data = b & (1 << bitNum);
syundo0730 0:3aa973ebe3e5 46 return count;
syundo0730 0:3aa973ebe3e5 47 }
syundo0730 0:3aa973ebe3e5 48
syundo0730 0:3aa973ebe3e5 49 /** Read multiple bits from an 8-bit device register.
syundo0730 0:3aa973ebe3e5 50 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 51 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 52 * @param bitStart First bit position to read (0-7)
syundo0730 0:3aa973ebe3e5 53 * @param length Number of bits to read (not more than 8)
syundo0730 0:3aa973ebe3e5 54 * @param data Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05)
syundo0730 0:3aa973ebe3e5 55 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 56 * @return Status of read operation (true = success)
syundo0730 0:3aa973ebe3e5 57 */
syundo0730 0:3aa973ebe3e5 58 int8_t I2Cdev::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 59 // 01101001 read byte
syundo0730 0:3aa973ebe3e5 60 // 76543210 bit numbers
syundo0730 0:3aa973ebe3e5 61 // xxx args: bitStart=4, length=3
syundo0730 0:3aa973ebe3e5 62 // 010 masked
syundo0730 0:3aa973ebe3e5 63 // -> 010 shifted
syundo0730 0:3aa973ebe3e5 64 uint8_t count, b;
syundo0730 0:3aa973ebe3e5 65 if ((count = readByte(devAddr, regAddr, &b, timeout)) != 0) {
syundo0730 0:3aa973ebe3e5 66 uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 67 b &= mask;
syundo0730 0:3aa973ebe3e5 68 b >>= (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 69 *data = b;
syundo0730 0:3aa973ebe3e5 70 }
syundo0730 0:3aa973ebe3e5 71 return count;
syundo0730 0:3aa973ebe3e5 72 }
syundo0730 0:3aa973ebe3e5 73
syundo0730 0:3aa973ebe3e5 74 /** Read multiple bits from a 16-bit device register.
syundo0730 0:3aa973ebe3e5 75 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 76 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 77 * @param bitStart First bit position to read (0-15)
syundo0730 0:3aa973ebe3e5 78 * @param length Number of bits to read (not more than 16)
syundo0730 0:3aa973ebe3e5 79 * @param data Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05)
syundo0730 0:3aa973ebe3e5 80 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 81 * @return Status of read operation (1 = success, 0 = failure, -1 = timeout)
syundo0730 0:3aa973ebe3e5 82 */
syundo0730 0:3aa973ebe3e5 83 int8_t I2Cdev::readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 84 // 1101011001101001 read byte
syundo0730 0:3aa973ebe3e5 85 // fedcba9876543210 bit numbers
syundo0730 0:3aa973ebe3e5 86 // xxx args: bitStart=12, length=3
syundo0730 0:3aa973ebe3e5 87 // 010 masked
syundo0730 0:3aa973ebe3e5 88 // -> 010 shifted
syundo0730 0:3aa973ebe3e5 89 uint8_t count;
syundo0730 0:3aa973ebe3e5 90 uint16_t w;
syundo0730 0:3aa973ebe3e5 91 if ((count = readWord(devAddr, regAddr, &w, timeout)) != 0) {
syundo0730 0:3aa973ebe3e5 92 uint16_t mask = ((1 << length) - 1) << (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 93 w &= mask;
syundo0730 0:3aa973ebe3e5 94 w >>= (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 95 *data = w;
syundo0730 0:3aa973ebe3e5 96 }
syundo0730 0:3aa973ebe3e5 97 return count;
syundo0730 0:3aa973ebe3e5 98 }
syundo0730 0:3aa973ebe3e5 99 /** Read single byte from an 8-bit device register.
syundo0730 0:3aa973ebe3e5 100 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 101 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 102 * @param data Container for byte value read from device
syundo0730 0:3aa973ebe3e5 103 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 104 * @return Status of read operation (true = success)
syundo0730 0:3aa973ebe3e5 105 */
syundo0730 0:3aa973ebe3e5 106 int8_t I2Cdev::readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 107 return readBytes(devAddr, regAddr, 1, data, timeout);
syundo0730 0:3aa973ebe3e5 108 }
syundo0730 0:3aa973ebe3e5 109
syundo0730 0:3aa973ebe3e5 110 /** Read single word from a 16-bit device register.
syundo0730 0:3aa973ebe3e5 111 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 112 * @param regAddr Register regAddr to read from
syundo0730 0:3aa973ebe3e5 113 * @param data Container for word value read from device
syundo0730 0:3aa973ebe3e5 114 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 115 * @return Status of read operation (true = success)
syundo0730 0:3aa973ebe3e5 116 */
syundo0730 0:3aa973ebe3e5 117 int8_t I2Cdev::readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout) {
syundo0730 0:3aa973ebe3e5 118 return readWords(devAddr, regAddr, 1, data, timeout);
syundo0730 0:3aa973ebe3e5 119 }
syundo0730 0:3aa973ebe3e5 120
syundo0730 0:3aa973ebe3e5 121 /** Read multiple bytes from an 8-bit device register.
syundo0730 0:3aa973ebe3e5 122 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 123 * @param regAddr First register regAddr to read from
syundo0730 0:3aa973ebe3e5 124 * @param length Number of bytes to read
syundo0730 0:3aa973ebe3e5 125 * @param data Buffer to store read data in
syundo0730 0:3aa973ebe3e5 126 * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout)
syundo0730 0:3aa973ebe3e5 127 * @return Number of bytes read (-1 indicates failure)
syundo0730 0:3aa973ebe3e5 128 */
syundo0730 0:3aa973ebe3e5 129 int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout)
syundo0730 0:3aa973ebe3e5 130 {
syundo0730 0:3aa973ebe3e5 131 char command[1];
syundo0730 0:3aa973ebe3e5 132 command[0] = regAddr;
syundo0730 0:3aa973ebe3e5 133 char *redData = (char*)malloc(length);
syundo0730 0:3aa973ebe3e5 134 i2c.write(devAddr<<1, command, 1, true);
syundo0730 0:3aa973ebe3e5 135 i2c.read(devAddr<<1, redData, length);
syundo0730 0:3aa973ebe3e5 136 for(int i =0; i < length; i++) {
syundo0730 0:3aa973ebe3e5 137 data[i] = redData[i];
syundo0730 0:3aa973ebe3e5 138 }
syundo0730 0:3aa973ebe3e5 139 free (redData);
syundo0730 0:3aa973ebe3e5 140 return length;
syundo0730 0:3aa973ebe3e5 141 }
syundo0730 0:3aa973ebe3e5 142
syundo0730 0:3aa973ebe3e5 143 int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout)
syundo0730 0:3aa973ebe3e5 144 {
syundo0730 0:3aa973ebe3e5 145 return 0;
syundo0730 0:3aa973ebe3e5 146 }
syundo0730 0:3aa973ebe3e5 147
syundo0730 0:3aa973ebe3e5 148 /** write a single bit in an 8-bit device register.
syundo0730 0:3aa973ebe3e5 149 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 150 * @param regAddr Register regAddr to write to
syundo0730 0:3aa973ebe3e5 151 * @param bitNum Bit position to write (0-7)
syundo0730 0:3aa973ebe3e5 152 * @param value New bit value to write
syundo0730 0:3aa973ebe3e5 153 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 154 */
syundo0730 0:3aa973ebe3e5 155 bool I2Cdev::writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data) {
syundo0730 0:3aa973ebe3e5 156 uint8_t b;
syundo0730 0:3aa973ebe3e5 157 readByte(devAddr, regAddr, &b);
syundo0730 0:3aa973ebe3e5 158 b = (data != 0) ? (b | (1 << bitNum)) : (b & ~(1 << bitNum));
syundo0730 0:3aa973ebe3e5 159 return writeByte(devAddr, regAddr, b);
syundo0730 0:3aa973ebe3e5 160 }
syundo0730 0:3aa973ebe3e5 161
syundo0730 0:3aa973ebe3e5 162 /** write a single bit in a 16-bit device register.
syundo0730 0:3aa973ebe3e5 163 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 164 * @param regAddr Register regAddr to write to
syundo0730 0:3aa973ebe3e5 165 * @param bitNum Bit position to write (0-15)
syundo0730 0:3aa973ebe3e5 166 * @param value New bit value to write
syundo0730 0:3aa973ebe3e5 167 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 168 */
syundo0730 0:3aa973ebe3e5 169 bool I2Cdev::writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data) {
syundo0730 0:3aa973ebe3e5 170 uint16_t w;
syundo0730 0:3aa973ebe3e5 171 readWord(devAddr, regAddr, &w);
syundo0730 0:3aa973ebe3e5 172 w = (data != 0) ? (w | (1 << bitNum)) : (w & ~(1 << bitNum));
syundo0730 0:3aa973ebe3e5 173 return writeWord(devAddr, regAddr, w);
syundo0730 0:3aa973ebe3e5 174 }
syundo0730 0:3aa973ebe3e5 175
syundo0730 0:3aa973ebe3e5 176 /** Write multiple bits in an 8-bit device register.
syundo0730 0:3aa973ebe3e5 177 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 178 * @param regAddr Register regAddr to write to
syundo0730 0:3aa973ebe3e5 179 * @param bitStart First bit position to write (0-7)
syundo0730 0:3aa973ebe3e5 180 * @param length Number of bits to write (not more than 8)
syundo0730 0:3aa973ebe3e5 181 * @param data Right-aligned value to write
syundo0730 0:3aa973ebe3e5 182 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 183 */
syundo0730 0:3aa973ebe3e5 184 bool I2Cdev::writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data) {
syundo0730 0:3aa973ebe3e5 185 // 010 value to write
syundo0730 0:3aa973ebe3e5 186 // 76543210 bit numbers
syundo0730 0:3aa973ebe3e5 187 // xxx args: bitStart=4, length=3
syundo0730 0:3aa973ebe3e5 188 // 00011100 mask byte
syundo0730 0:3aa973ebe3e5 189 // 10101111 original value (sample)
syundo0730 0:3aa973ebe3e5 190 // 10100011 original & ~mask
syundo0730 0:3aa973ebe3e5 191 // 10101011 masked | value
syundo0730 0:3aa973ebe3e5 192 uint8_t b;
syundo0730 0:3aa973ebe3e5 193 if (readByte(devAddr, regAddr, &b) != 0) {
syundo0730 0:3aa973ebe3e5 194 uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 195 data <<= (bitStart - length + 1); // shift data into correct position
syundo0730 0:3aa973ebe3e5 196 data &= mask; // zero all non-important bits in data
syundo0730 0:3aa973ebe3e5 197 b &= ~(mask); // zero all important bits in existing byte
syundo0730 0:3aa973ebe3e5 198 b |= data; // combine data with existing byte
syundo0730 0:3aa973ebe3e5 199 return writeByte(devAddr, regAddr, b);
syundo0730 0:3aa973ebe3e5 200 } else {
syundo0730 0:3aa973ebe3e5 201 return false;
syundo0730 0:3aa973ebe3e5 202 }
syundo0730 0:3aa973ebe3e5 203 }
syundo0730 0:3aa973ebe3e5 204
syundo0730 0:3aa973ebe3e5 205 /** Write multiple bits in a 16-bit device register.
syundo0730 0:3aa973ebe3e5 206 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 207 * @param regAddr Register regAddr to write to
syundo0730 0:3aa973ebe3e5 208 * @param bitStart First bit position to write (0-15)
syundo0730 0:3aa973ebe3e5 209 * @param length Number of bits to write (not more than 16)
syundo0730 0:3aa973ebe3e5 210 * @param data Right-aligned value to write
syundo0730 0:3aa973ebe3e5 211 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 212 */
syundo0730 0:3aa973ebe3e5 213 bool I2Cdev::writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data) {
syundo0730 0:3aa973ebe3e5 214 // 010 value to write
syundo0730 0:3aa973ebe3e5 215 // fedcba9876543210 bit numbers
syundo0730 0:3aa973ebe3e5 216 // xxx args: bitStart=12, length=3
syundo0730 0:3aa973ebe3e5 217 // 0001110000000000 mask byte
syundo0730 0:3aa973ebe3e5 218 // 1010111110010110 original value (sample)
syundo0730 0:3aa973ebe3e5 219 // 1010001110010110 original & ~mask
syundo0730 0:3aa973ebe3e5 220 // 1010101110010110 masked | value
syundo0730 0:3aa973ebe3e5 221 uint16_t w;
syundo0730 0:3aa973ebe3e5 222 if (readWord(devAddr, regAddr, &w) != 0) {
syundo0730 0:3aa973ebe3e5 223 uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1);
syundo0730 0:3aa973ebe3e5 224 data <<= (bitStart - length + 1); // shift data into correct position
syundo0730 0:3aa973ebe3e5 225 data &= mask; // zero all non-important bits in data
syundo0730 0:3aa973ebe3e5 226 w &= ~(mask); // zero all important bits in existing word
syundo0730 0:3aa973ebe3e5 227 w |= data; // combine data with existing word
syundo0730 0:3aa973ebe3e5 228 return writeWord(devAddr, regAddr, w);
syundo0730 0:3aa973ebe3e5 229 } else {
syundo0730 0:3aa973ebe3e5 230 return false;
syundo0730 0:3aa973ebe3e5 231 }
syundo0730 0:3aa973ebe3e5 232 }
syundo0730 0:3aa973ebe3e5 233
syundo0730 0:3aa973ebe3e5 234 /** Write single byte to an 8-bit device register.
syundo0730 0:3aa973ebe3e5 235 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 236 * @param regAddr Register address to write to
syundo0730 0:3aa973ebe3e5 237 * @param data New byte value to write
syundo0730 0:3aa973ebe3e5 238 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 239 */
syundo0730 0:3aa973ebe3e5 240 bool I2Cdev::writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data) {
syundo0730 0:3aa973ebe3e5 241 return writeBytes(devAddr, regAddr, 1, &data);
syundo0730 0:3aa973ebe3e5 242 }
syundo0730 0:3aa973ebe3e5 243
syundo0730 0:3aa973ebe3e5 244 /** Write single word to a 16-bit device register.
syundo0730 0:3aa973ebe3e5 245 * @param devAddr I2C slave device address
syundo0730 0:3aa973ebe3e5 246 * @param regAddr Register address to write to
syundo0730 0:3aa973ebe3e5 247 * @param data New word value to write
syundo0730 0:3aa973ebe3e5 248 * @return Status of operation (true = success)
syundo0730 0:3aa973ebe3e5 249 */
syundo0730 0:3aa973ebe3e5 250 bool I2Cdev::writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data) {
syundo0730 0:3aa973ebe3e5 251 return writeWords(devAddr, regAddr, 1, &data);
syundo0730 0:3aa973ebe3e5 252 }
syundo0730 0:3aa973ebe3e5 253
syundo0730 0:3aa973ebe3e5 254 bool I2Cdev::writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data)
syundo0730 0:3aa973ebe3e5 255 {
syundo0730 0:3aa973ebe3e5 256 i2c.start();
syundo0730 0:3aa973ebe3e5 257 i2c.write(devAddr<<1);
syundo0730 0:3aa973ebe3e5 258 i2c.write(regAddr);
syundo0730 0:3aa973ebe3e5 259 for(int i = 0; i < length; i++) {
syundo0730 0:3aa973ebe3e5 260 i2c.write(data[i]);
syundo0730 0:3aa973ebe3e5 261 }
syundo0730 0:3aa973ebe3e5 262 i2c.stop();
syundo0730 0:3aa973ebe3e5 263 return true;
syundo0730 0:3aa973ebe3e5 264 }
syundo0730 0:3aa973ebe3e5 265
syundo0730 0:3aa973ebe3e5 266 bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data)
syundo0730 0:3aa973ebe3e5 267 {
syundo0730 0:3aa973ebe3e5 268 return true;
syundo0730 0:3aa973ebe3e5 269 }
syundo0730 0:3aa973ebe3e5 270
syundo0730 0:3aa973ebe3e5 271 uint16_t I2Cdev::readTimeout(void)
syundo0730 0:3aa973ebe3e5 272 {
syundo0730 0:3aa973ebe3e5 273 return 0;
syundo0730 0:3aa973ebe3e5 274 }