SHARE
TWEET

Untitled

a guest Aug 30th, 2011 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-----------------------------------------------------------------------------
  2. // Includes
  3. //-----------------------------------------------------------------------------
  4. #include "stm32F10x.h"
  5.  
  6. #include "usart.h"
  7. #include "SD_card.h"
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12.  
  13. //-----------------------------------------------------------------------------
  14. // Private define
  15. //-----------------------------------------------------------------------------
  16. //#define USART1_IRQChannel   USART1_IRQn
  17.  
  18. #define BLUE_LED_ON()           GPIO_SetBits(GPIOC, GPIO_Pin_8)
  19. #define BLUE_LED_OFF()          GPIO_ResetBits(GPIOC, GPIO_Pin_8)
  20. #define GREEN_LED_ON()          GPIO_SetBits(GPIOC, GPIO_Pin_9)
  21. #define GREEN_LED_OFF()         GPIO_ResetBits(GPIOC, GPIO_Pin_9)      
  22.  
  23.  
  24. //-----------------------------------------------------------------------------
  25. // Private variables
  26. //-----------------------------------------------------------------------------
  27.  
  28. u8 bufe[82];
  29.  
  30. //-----------------------------------------------------------------------------
  31. // Private function prototypes
  32. //-----------------------------------------------------------------------------
  33. void RCC_Configuration(void);
  34. void GPIO_Configuration(void);
  35. void NVIC_Configuration(void);
  36.  
  37.  
  38. void USART1_IRQHandler(void);
  39.  
  40. void Delay(int nCount);
  41.  
  42.  
  43.  
  44. //-----------------------------------------------------------------------------
  45. //
  46. //-----------------------------------------------------------------------------
  47.  
  48.  
  49.  
  50. //-----------------------------------------------------------------------------
  51. // Main
  52. //-----------------------------------------------------------------------------
  53. int main(void)
  54. {      
  55.                
  56.         // HW configuration
  57.         RCC_Configuration();
  58.         GPIO_Configuration();
  59.         NVIC_Configuration();
  60.  
  61.         // Peripherials configuration
  62.         USART1_Init();
  63.         USART2_Init();
  64.  
  65.         printf("-----------------\r\n");
  66.  
  67.         BLUE_LED_ON();
  68.  
  69.  
  70.         printf ("\r\nInit SD");
  71.         while(SD_Init());
  72.         printf(("\r\nSD initialize OK!"));
  73.  
  74.         printf(("\r\nDisk size is: %ld MB"),SD_ReadCapacity()/1024/2);
  75.  
  76.         printf("\r\n");
  77.                
  78.         while(1){
  79.         }
  80. }
  81.  
  82. void USART1_IRQHandler(void)
  83. {
  84.   u8 data;
  85.  
  86.  
  87.   data = USART_ReceiveData(USART1);
  88.        
  89.   USART_SendData(USART2, data);
  90.                  
  91. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top