Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------------
- // Includes
- //-----------------------------------------------------------------------------
- #include "stm32F10x.h"
- #include "usart.h"
- #include "SD_card.h"
- #include <stdio.h>
- #include <stdlib.h>
- //-----------------------------------------------------------------------------
- // Private define
- //-----------------------------------------------------------------------------
- //#define USART1_IRQChannel USART1_IRQn
- #define BLUE_LED_ON() GPIO_SetBits(GPIOC, GPIO_Pin_8)
- #define BLUE_LED_OFF() GPIO_ResetBits(GPIOC, GPIO_Pin_8)
- #define GREEN_LED_ON() GPIO_SetBits(GPIOC, GPIO_Pin_9)
- #define GREEN_LED_OFF() GPIO_ResetBits(GPIOC, GPIO_Pin_9)
- //-----------------------------------------------------------------------------
- // Private variables
- //-----------------------------------------------------------------------------
- u8 bufe[82];
- //-----------------------------------------------------------------------------
- // Private function prototypes
- //-----------------------------------------------------------------------------
- void RCC_Configuration(void);
- void GPIO_Configuration(void);
- void NVIC_Configuration(void);
- void USART1_IRQHandler(void);
- void Delay(int nCount);
- //-----------------------------------------------------------------------------
- //
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // Main
- //-----------------------------------------------------------------------------
- int main(void)
- {
- // HW configuration
- RCC_Configuration();
- GPIO_Configuration();
- NVIC_Configuration();
- // Peripherials configuration
- USART1_Init();
- USART2_Init();
- printf("-----------------\r\n");
- BLUE_LED_ON();
- printf ("\r\nInit SD");
- while(SD_Init());
- printf(("\r\nSD initialize OK!"));
- printf(("\r\nDisk size is: %ld MB"),SD_ReadCapacity()/1024/2);
- printf("\r\n");
- while(1){
- }
- }
- void USART1_IRQHandler(void)
- {
- u8 data;
- data = USART_ReceiveData(USART1);
- USART_SendData(USART2, data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement