SdFat

Classes | Macros | Typedefs | Functions | Variables
SdSpiDriver.h File Reference

SpiDriver classes. More...

`#include "../common/SysCall.h"`
`#include "SPI.h"`
`#include "SdSpiArduinoDriver.h"`
Include dependency graph for SdSpiDriver.h:
This graph shows which files directly or indirectly include this file:

## Classes
class | SdSpiConfig
| SPI card configuration. More...

## Macros
#define | SD_SCK_HZ(maxSpeed) (maxSpeed)
#define | SD_SCK_MHZ(maxMhz) (1000000UL*(maxMhz))
#define | SPI_DIV3_SPEED SD_SCK_MHZ(16)
#define | SPI_DIV6_SPEED SD_SCK_MHZ(8)
#define | SPI_EIGHTH_SPEED SD_SCK_MHZ(1)
#define | SPI_FULL_SPEED SD_SCK_MHZ(50)
#define | SPI_HALF_SPEED SD_SCK_MHZ(4)
#define | SPI_QUARTER_SPEED SD_SCK_MHZ(2)
#define | SPI_SIXTEENTH_SPEED SD_SCK_HZ(500000)

## Typedefs
typedef SPIClass | SpiPort_t

## Functions
void | sdCsInit (SdCsPin_t pin)
void | sdCsWrite (SdCsPin_t pin, bool level)
bool | spiOptionDedicated (uint8_t opt)

## Variables
const uint8_t | DEDICATED_SPI = 1
const uint8_t | SHARED_SPI = 0

## Detailed Description

SpiDriver classes.

Copyright (c) 2011-2021 Bill Greiman This file is part of the SdFat library for SD memory cards.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## Macro Definition Documentation

## ◆ SD_SCK_HZ

#define SD_SCK_HZ | ( |  | maxSpeed | ) | (maxSpeed)

SPISettings for SCK frequency in Hz.

## ◆ SD_SCK_MHZ

#define SD_SCK_MHZ | ( |  | maxMhz | ) | (1000000UL*(maxMhz))

SPISettings for SCK frequency in MHz.

## ◆ SPI_DIV3_SPEED

#define SPI_DIV3_SPEED SD_SCK_MHZ(16)

Set SCK rate to 16 MHz for Due

## ◆ SPI_DIV6_SPEED

#define SPI_DIV6_SPEED SD_SCK_MHZ(8)

Set SCK rate to 8 MHz for Due

## ◆ SPI_EIGHTH_SPEED

#define SPI_EIGHTH_SPEED SD_SCK_MHZ(1)

Set SCK rate to 1 MHz for AVR.

## ◆ SPI_FULL_SPEED

#define SPI_FULL_SPEED SD_SCK_MHZ(50)

Set SCK to max rate.

## ◆ SPI_HALF_SPEED

#define SPI_HALF_SPEED SD_SCK_MHZ(4)

Set SCK rate to 4 MHz for AVR.

## ◆ SPI_QUARTER_SPEED

#define SPI_QUARTER_SPEED SD_SCK_MHZ(2)

Set SCK rate to 2 MHz for AVR.

## ◆ SPI_SIXTEENTH_SPEED

#define SPI_SIXTEENTH_SPEED SD_SCK_HZ(500000)

Set SCK rate to 500 kHz for AVR.

## Typedef Documentation

## ◆ SpiPort_t

typedef SPIClass SpiPort_t

Port type for Arduino SPI hardware driver.

## Function Documentation

## ◆ sdCsInit()

void sdCsInit | ( | SdCsPin_t | pin | ) |

Initialize SD chip select pin.

Parameters

  [in] | pin | SD card chip select pin.

Copyright (c) 2011-2021 Bill Greiman This file is part of the SdFat library for SD memory cards.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## ◆ sdCsWrite()

void sdCsWrite | ( | SdCsPin_t | pin,
|  | bool | level
| ) |  |

Initialize SD chip select pin.

Parameters

  [in] | pin | SD card chip select pin.
  [in] | level | SD card chip select level.

## ◆ spiOptionDedicated()

bool spiOptionDedicated | ( | uint8_t | opt | ) |
| inline

Parameters

  [in] | opt | option field of SdSpiConfig.

Returns
  true for dedicated SPI.

## Variable Documentation

## ◆ DEDICATED_SPI

const uint8_t DEDICATED_SPI = 1

The SD is the only device on the SPI bus.

## ◆ SHARED_SPI

const uint8_t SHARED_SPI = 0

SPI bus is share with other devices.