SdFat
Classes | Defines | Functions | Variables
Arduino/libraries/SdFat/SdBaseFile.h File Reference

SdBaseFile class. More...

#include <Arduino.h>
#include <SdFatConfig.h>
#include <SdVolume.h>
Include dependency graph for SdBaseFile.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  FatPos_t
 internal type for istream do not use in user apps More...
class  SdBaseFile
 Base class for SdFile with Print and C++ streams. More...

Defines

#define PGM_P   const char*
#define pgm_read_byte(addr)   (*(const unsigned char*)(addr))
#define pgm_read_word(addr)   (*(const uint16_t*)(addr))
#define PROGMEM   const
#define PSTR(x)   (x)

Functions

static uint16_t FAT_DATE (uint16_t year, uint8_t month, uint8_t day)
static uint8_t FAT_DAY (uint16_t fatDate)
static uint8_t FAT_HOUR (uint16_t fatTime)
static uint8_t FAT_MINUTE (uint16_t fatTime)
static uint8_t FAT_MONTH (uint16_t fatDate)
static uint8_t FAT_SECOND (uint16_t fatTime)
static uint16_t FAT_TIME (uint8_t hour, uint8_t minute, uint8_t second)
static uint16_t FAT_YEAR (uint16_t fatDate)

Variables

uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1
uint16_t const FAT_DEFAULT_TIME = (1 << 11)
uint8_t const FAT_FILE_TYPE_CLOSED = 0
uint8_t const FAT_FILE_TYPE_MIN_DIR = FAT_FILE_TYPE_ROOT_FIXED
uint8_t const FAT_FILE_TYPE_NORMAL = 1
uint8_t const FAT_FILE_TYPE_ROOT32 = 3
uint8_t const FAT_FILE_TYPE_ROOT_FIXED = 2
uint8_t const FAT_FILE_TYPE_SUBDIR = 4
uint8_t const LS_DATE = 1
uint8_t const LS_R = 4
uint8_t const LS_SIZE = 2
uint8_t const O_ACCMODE = (O_READ | O_WRITE)
uint8_t const O_APPEND = 0X04
uint8_t const O_AT_END = 0X20
uint8_t const O_CREAT = 0X40
uint8_t const O_EXCL = 0X80
uint8_t const O_RDONLY = O_READ
uint8_t const O_RDWR = (O_READ | O_WRITE)
uint8_t const O_READ = 0X01
uint8_t const O_SYNC = 0X08
uint8_t const O_TRUNC = 0X10
uint8_t const O_WRITE = 0X02
uint8_t const O_WRONLY = O_WRITE
uint8_t const T_ACCESS = 1
uint8_t const T_CREATE = 2
uint8_t const T_WRITE = 4

Detailed Description

SdBaseFile class.


Define Documentation

#define PGM_P   const char*

pointer to flash for ARM

#define pgm_read_byte (   addr)    (*(const unsigned char*)(addr))

read 8-bits from flash for ARM

#define pgm_read_word (   addr)    (*(const uint16_t*)(addr))

read 16-bits from flash for ARM

#define PROGMEM   const

store in flash for ARM

#define PSTR (   x)    (x)

store literal string in flash for ARM


Function Documentation

static uint16_t FAT_DATE ( uint16_t  year,
uint8_t  month,
uint8_t  day 
) [inline, static]

date field for FAT directory entry

Parameters:
[in]year[1980,2107]
[in]month[1,12]
[in]day[1,31]
Returns:
Packed date for dir_t entry.
static uint8_t FAT_DAY ( uint16_t  fatDate) [inline, static]

day part of FAT directory date field

Parameters:
[in]fatDateDate in packed dir format.
Returns:
Extracted day [1,31]
static uint8_t FAT_HOUR ( uint16_t  fatTime) [inline, static]

hour part of FAT directory time field

Parameters:
[in]fatTimeTime in packed dir format.
Returns:
Extracted hour [0,23]
static uint8_t FAT_MINUTE ( uint16_t  fatTime) [inline, static]

minute part of FAT directory time field

Parameters:
[in]fatTimeTime in packed dir format.
Returns:
Extracted minute [0,59]
static uint8_t FAT_MONTH ( uint16_t  fatDate) [inline, static]

month part of FAT directory date field

Parameters:
[in]fatDateDate in packed dir format.
Returns:
Extracted month [1,12]
static uint8_t FAT_SECOND ( uint16_t  fatTime) [inline, static]

second part of FAT directory time field Note second/2 is stored in packed time.

Parameters:
[in]fatTimeTime in packed dir format.
Returns:
Extracted second [0,58]
static uint16_t FAT_TIME ( uint8_t  hour,
uint8_t  minute,
uint8_t  second 
) [inline, static]

time field for FAT directory entry

Parameters:
[in]hour[0,23]
[in]minute[0,59]
[in]second[0,59]
Returns:
Packed time for dir_t entry.
static uint16_t FAT_YEAR ( uint16_t  fatDate) [inline, static]

year part of FAT directory date field

Parameters:
[in]fatDateDate in packed dir format.
Returns:
Extracted year [1980,2107]

Variable Documentation

uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1

Default date for file timestamps is 1 Jan 2000

uint16_t const FAT_DEFAULT_TIME = (1 << 11)

Default time for file timestamp is 1 am

uint8_t const FAT_FILE_TYPE_CLOSED = 0

This file has not been opened.

Test value for directory type

uint8_t const FAT_FILE_TYPE_NORMAL = 1

A normal file

uint8_t const FAT_FILE_TYPE_ROOT32 = 3

A FAT32 root directory

uint8_t const FAT_FILE_TYPE_ROOT_FIXED = 2

A FAT12 or FAT16 root directory

uint8_t const FAT_FILE_TYPE_SUBDIR = 4

A subdirectory file

uint8_t const LS_DATE = 1

ls() flag to print modify date

uint8_t const LS_R = 4

ls() flag for recursive list of subdirectories

uint8_t const LS_SIZE = 2

ls() flag to print file size

uint8_t const O_ACCMODE = (O_READ | O_WRITE)

open() oflag mask for access modes

uint8_t const O_APPEND = 0X04

The file offset shall be set to the end of the file prior to each write.

uint8_t const O_AT_END = 0X20

set the initial position at the end of the file

uint8_t const O_CREAT = 0X40

create the file if nonexistent

uint8_t const O_EXCL = 0X80

If O_CREAT and O_EXCL are set, open() shall fail if the file exists

uint8_t const O_RDONLY = O_READ

open() oflag - same as O_IN

uint8_t const O_RDWR = (O_READ | O_WRITE)

open() oflag for reading and writing

uint8_t const O_READ = 0X01

open() oflag for reading

uint8_t const O_SYNC = 0X08

synchronous writes - call sync() after each write

uint8_t const O_TRUNC = 0X10

truncate the file to zero length

uint8_t const O_WRITE = 0X02

open() oflag for write

uint8_t const O_WRONLY = O_WRITE

open() oflag - same as O_WRITE

uint8_t const T_ACCESS = 1

set the file's last access date

uint8_t const T_CREATE = 2

set the file's creation date and time

uint8_t const T_WRITE = 4

Set the file's write date and time