@@ -375,34 +375,34 @@ bool I2Cdev::writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_
375
375
376
376
if (length > 127 ) {
377
377
fprintf (stderr, " Byte write count (%d) > 127\n " , length);
378
- return (FALSE );
378
+ return (false );
379
379
}
380
380
381
381
fd = open (I2CDEV , O_RDWR);
382
382
if (fd < 0 ) {
383
383
fprintf (stderr, " Failed to open device: %s\n " , strerror (errno));
384
- return (FALSE );
384
+ return (false );
385
385
}
386
386
if (ioctl (fd, I2C_SLAVE, devAddr) < 0 ) {
387
387
fprintf (stderr, " Failed to select device: %s\n " , strerror (errno));
388
388
close (fd);
389
- return (FALSE );
389
+ return (false );
390
390
}
391
391
buf[0 ] = regAddr;
392
392
memcpy (buf+1 ,data,length);
393
393
count = write (fd, buf, length+1 );
394
394
if (count < 0 ) {
395
395
fprintf (stderr, " Failed to write device(%d): %s\n " , count, ::strerror (errno));
396
396
close (fd);
397
- return (FALSE );
397
+ return (false );
398
398
} else if (count != length+1 ) {
399
399
fprintf (stderr, " Short write to device, expected %d, got %d\n " , length+1 , count);
400
400
close (fd);
401
- return (FALSE );
401
+ return (false );
402
402
}
403
403
close (fd);
404
404
405
- return TRUE ;
405
+ return true ;
406
406
}
407
407
408
408
/* * Write multiple words to a 16-bit device register.
@@ -422,18 +422,18 @@ bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16
422
422
423
423
if (length > 63 ) {
424
424
fprintf (stderr, " Word write count (%d) > 63\n " , length);
425
- return (FALSE );
425
+ return (false );
426
426
}
427
427
428
428
fd = open (I2CDEV, O_RDWR);
429
429
if (fd < 0 ) {
430
430
fprintf (stderr, " Failed to open device: %s\n " , strerror (errno));
431
- return (FALSE );
431
+ return (false );
432
432
}
433
433
if (ioctl (fd, I2C_SLAVE, devAddr) < 0 ) {
434
434
fprintf (stderr, " Failed to select device: %s\n " , strerror (errno));
435
435
close (fd);
436
- return (FALSE );
436
+ return (false );
437
437
}
438
438
buf[0 ] = regAddr;
439
439
for (i = 0 ; i < length; i++) {
@@ -444,14 +444,14 @@ bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16
444
444
if (count < 0 ) {
445
445
fprintf (stderr, " Failed to write device(%d): %s\n " , count, ::strerror (errno));
446
446
close (fd);
447
- return (FALSE );
447
+ return (false );
448
448
} else if (count != length*2 +1 ) {
449
449
fprintf (stderr, " Short write to device, expected %d, got %d\n " , length+1 , count);
450
450
close (fd);
451
- return (FALSE );
451
+ return (false );
452
452
}
453
453
close (fd);
454
- return TRUE ;
454
+ return true ;
455
455
}
456
456
457
457
/* * Default timeout value for read operations.
0 commit comments