You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

/*
It is an open source software to implement SD routines to
small embedded systems. This is a free software and is opened for education,
research and commercial developments under license policy of following trems.
(C) 2013 vinxru (aleksey.f.morozov@gmail.com)
It is a free software and there is NO WARRANTY.
No restriction on use. You can use, modify and redistribute it for
personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
Redistributions of source code must retain the above copyright notice.
Version 0.99 5-05-2013
*/
#ifndef _SD_H_
#define _SD_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#define LED1_PORT PORTB
#define LED1_DDR DDRB
#define LED1_PIN PB4
#define LED2_PORT PORTB
#define LED2_DDR DDRB
#define LED2_PIN PB5
#define LED_R_ON() (LED1_PORT |= (1 << LED1_PIN))
#define LED_R_OFF() (LED1_PORT &= ~(1 << LED1_PIN))
#define LED_W_ON() (LED2_PORT |= (1 << LED2_PIN))
#define LED_W_OFF() (LED2_PORT &= ~(1 << LED2_PIN))
uint8_t sd_init(); /* Èíèöèàëèçàöèÿ êàðòû */
uint8_t sd_check(); /* Ïðîâåðêà íàëè÷èÿ êàðòû */
uint8_t sd_read(uint8_t* buffer, uint32_t sector, uint16_t offsetInSector, uint16_t length); /* ×òåíèå ÷àñòè ñåêòîðà */
uint8_t sd_write512(uint8_t* buffer, uint32_t sector); /* Çàïèñü ñåêòîðà */
#ifdef __cplusplus
}
#endif
#endif