Manipulating pins (SD Card)

Hi,

I have been using Lady Adas SD Card library and wondered how i need to connect the SD Card to the arduino.

in the library i think that the pins are defined with

#define configure_pin_mosi() DDRB |= (1 << DDB3)
#define configure_pin_sck() DDRB |= (1 << DDB5)
#define configure_pin_ss() DDRB |= (1 << DDB2)
#define configure_pin_miso() DDRB &= ~(1 << DDB4)
#define select_card() PORTB &= ~(1 << PB2)
#define unselect_card() PORTB |= (1 << PB2)

yet i connected it like

The problem now is that i dont have any idea of what to do about those defined. basicly it would be possible to follow the reference, but i guess i would screw too much up if i follow it without doing it right.. The problem is just that i cannot think of how to link the info of the picture (the sd card pin names) with the ones in the define..

May someone help me with that?

The definitions are addressing the port directly, there is no need to do this. Just follow the diagrams so that pin 10 is connected to CS so you define that as:-
int CS = 10;
int DI = 11;
pinMode(CS,OUTPUT);
pinMode(DI,INPUT);

and so on.

ok, i see what you have in mind, but my problem is i dont see the connection between the pin descriptions in the #defines and those on the SD Card

edit
Maybe i should make clear, that the diagram is not related to the Library - so there is the problem

This line:-
#define configure_pin_mosi() DDRB |= (1 << DDB3)

is saying that the pin mosi (serial in) is in data port B at a bit position given by the variable DDB3, which probably equates to bit 3. So port B bit 3 is the serial in pin labeled DI (data in) on the diagram.
Similarly CS is chip select which is select card in the definitions. DO is data out or miso.

But as you say:-

that the diagram is not related to the Library

So I don't know why you want to know how they are related?

ok, thanks for that description.. i think i begin to get it. Their relation is just that the figure shows how an SD card is connected to an arduino, yet the #defines are from a library which is not using the same pins (although i begin to think it does.. strange).
Anyway, the description you gave has given me a small idea of what the related, yet uncorrelated descriptions might mean so i can rebuild it.

Thank you