stm32f4-sdio/main.c

42 lines
728 B
C
Raw Normal View History

2015-04-26 17:54:51 +02:00
/*
* main.c
*
* Created on: Apr 25, 2015
* Author: mari
*/
#include <stm32f4xx.h>
2017-03-31 13:25:42 +02:00
#include <cmsis/arm_math.h>
#include <fatfs/ff.h>
2015-04-26 17:54:51 +02:00
#define OUTPUT(pin) (0b01 << (pin * 2))
FATFS SDfs;
FIL file;
volatile int w;
void SDIO_wait_cmd_sent();
int SDIO_switch_appmode_CMD55();
int SDIO_send_all_send_cid_CMD2();
int SDIO_send_relative_address_CMD3(uint16_t* rca);
int SDIO_send_go_idle_CMD0();
int SDIO_send_block_length_CMD16(uint32_t blocklen);
int SDIO_send_bus_width_ACMD6(uint8_t bus_width);
2015-12-08 21:31:41 +01:00
2015-04-26 17:54:51 +02:00
int main() {
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
__DSB();
GPIOD->MODER |= OUTPUT(12);
2015-04-26 17:54:51 +02:00
SysTick_Config(8*1680000);
// f_mount(&SDfs, "0:/", 1);
2015-04-26 17:54:51 +02:00
while(1);
}
2015-12-08 21:31:41 +01:00
2015-04-26 17:54:51 +02:00
void SysTick_Handler()
{
GPIOD->ODR ^= (1<<12);
w++;
2015-04-26 17:54:51 +02:00
}