@@ -60,59 +60,59 @@ SDClass SD;
6060 * @brief Link SD, register the file system object to the FatFs mode and configure
6161 * relatives SD IOs including SD Detect Pin if any
6262 * @param None
63- * @retval TRUE or FALSE
63+ * @retval true or false
6464 */
65- uint8_t SDClass::begin (uint32_t detectpin)
65+ bool SDClass::begin (uint32_t detectpin)
6666{
6767 /* ##-1- Initializes SD IOs #############################################*/
6868 if (_card.init (detectpin)) {
6969 return _fatFs.init ();
7070 }
71- return FALSE ;
71+ return false ;
7272}
7373
7474/* *
7575 * @brief Check if a file or folder exist on the SD disk
7676 * @param filename: File name
77- * @retval TRUE or FALSE
77+ * @retval true or false
7878 */
79- uint8_t SDClass::exists (const char *filepath)
79+ bool SDClass::exists (const char *filepath)
8080{
8181 FILINFO fno;
8282
8383 if (f_stat (filepath, &fno) != FR_OK) {
84- return FALSE ;
84+ return false ;
8585 } else {
86- return TRUE ;
86+ return true ;
8787 }
8888}
8989
9090/* *
9191 * @brief Create directory on the SD disk
9292 * @param filename: File name
93- * @retval TRUE if created or existing else FALSE
93+ * @retval true if created or existing else false
9494 */
95- uint8_t SDClass::mkdir (const char *filepath)
95+ bool SDClass::mkdir (const char *filepath)
9696{
9797 FRESULT res = f_mkdir (filepath);
9898 if ((res != FR_OK) && (res != FR_EXIST)) {
99- return FALSE ;
99+ return false ;
100100 } else {
101- return TRUE ;
101+ return true ;
102102 }
103103}
104104
105105/* *
106106 * @brief Remove directory on the SD disk
107107 * @param filename: File name
108- * @retval TRUE or FALSE
108+ * @retval true or false
109109 */
110- uint8_t SDClass::rmdir (const char *filepath)
110+ bool SDClass::rmdir (const char *filepath)
111111{
112112 if (f_unlink (filepath) != FR_OK) {
113- return FALSE ;
113+ return false ;
114114 } else {
115- return TRUE ;
115+ return true ;
116116 }
117117}
118118
@@ -141,7 +141,7 @@ File SDClass::open(const char *filepath, uint8_t mode)
141141{
142142 File file = File (filepath);
143143
144- if ((mode == FILE_WRITE) && (SD.exists (filepath) != TRUE )) {
144+ if ((mode == FILE_WRITE) && (! SD.exists (filepath))) {
145145 mode = mode | FA_CREATE_ALWAYS;
146146 }
147147
@@ -154,14 +154,14 @@ File SDClass::open(const char *filepath, uint8_t mode)
154154/* *
155155 * @brief Remove a file on the SD disk
156156 * @param filename: File name
157- * @retval TRUE or FALSE
157+ * @retval true or false
158158 */
159- uint8_t SDClass::remove (const char *filepath)
159+ bool SDClass::remove (const char *filepath)
160160{
161161 if (f_unlink (filepath) != FR_OK) {
162- return FALSE ;
162+ return false ;
163163 } else {
164- return TRUE ;
164+ return true ;
165165 }
166166}
167167
@@ -455,17 +455,17 @@ uint32_t File::position()
455455/* *
456456 * @brief Seek to a new position in the file
457457 * @param pos: The position to which to seek
458- * @retval TRUE or FALSE
458+ * @retval true or false
459459 */
460- uint8_t File::seek (uint32_t pos)
460+ bool File::seek (uint32_t pos)
461461{
462462 if (pos > size ()) {
463- return FALSE ;
463+ return false ;
464464 } else {
465465 if (f_lseek (_fil, pos) != FR_OK) {
466- return FALSE ;
466+ return false ;
467467 } else {
468- return TRUE ;
468+ return true ;
469469 }
470470 }
471471}
@@ -486,9 +486,9 @@ uint32_t File::size()
486486File::operator bool ()
487487{
488488#if _FATFS == 68300
489- return ((_name == NULL ) || ((_fil == NULL ) && (_dir.obj .fs == 0 )) || ((_fil != NULL ) && (_fil->obj .fs == 0 ) && (_dir.obj .fs == 0 ))) ? FALSE : TRUE ;
489+ return ! ((_name == NULL ) || ((_fil == NULL ) && (_dir.obj .fs == 0 )) || ((_fil != NULL ) && (_fil->obj .fs == 0 ) && (_dir.obj .fs == 0 )));
490490#else
491- return ((_name == NULL ) || ((_fil == NULL ) && (_dir.fs == 0 )) || ((_fil != NULL ) && (_fil->fs == 0 ) && (_dir.fs == 0 ))) ? FALSE : TRUE ;
491+ return ! ((_name == NULL ) || ((_fil == NULL ) && (_dir.fs == 0 )) || ((_fil != NULL ) && (_fil->fs == 0 ) && (_dir.fs == 0 )));
492492#endif
493493}
494494/* *
@@ -584,7 +584,7 @@ char *File::name()
584584 * @brief Check if the file is directory or normal file
585585 * @retval TRUE if directory else FALSE
586586 */
587- uint8_t File::isDirectory ()
587+ bool File::isDirectory ()
588588{
589589 FILINFO fno;
590590 if (_name == NULL ) {
@@ -595,21 +595,21 @@ uint8_t File::isDirectory()
595595#else
596596 if (_dir.fs != 0 )
597597#endif
598- return TRUE ;
598+ return true ;
599599#if _FATFS == 68300
600600 else if (_fil->obj .fs != 0 )
601601#else
602602 else if (_fil->fs != 0 )
603603#endif
604- return FALSE ;
604+ return false ;
605605 // if not init get info
606606 if (f_stat (_name, &fno) == FR_OK) {
607607 if (fno.fattrib & AM_DIR) {
608- return TRUE ;
608+ return true ;
609609 }
610610 }
611611 // Assume not a directory
612- return FALSE ;
612+ return false ;
613613}
614614
615615File File::openNextFile (uint8_t mode)
0 commit comments