Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "memorymap.h"
  2.  
  3.  
  4. __asm__(".word 0x20001000");
  5. __asm__(".word main");
  6.  
  7.  
  8. main()
  9. {
  10.        
  11.         RCC_CR = 0x11030003;
  12.         RCC_CFGR = 0x06000009;
  13.         RCC_APB2RSTR = 0x1001;
  14.         //RCC_AHBENR = 0x400;
  15.         RCC_APB2ENR = 0x1005;
  16.         //RCC_APB1ENR = 0x10200000;            
  17.         GPIOA_CRL = 0xB0B00000;                 // Alternate function Push Pull enable on PA7/5
  18.         GPIOA_CRH = 0xB;                        // MCO CLOCK ENABLE on PA8
  19.         //GPIOA_ODR = 0xA0;    
  20.         //GPIOA_LCKR = 0x00000000;
  21.  
  22.         //I2C1 setup
  23.         //I2C1_CR2 = 0x08;
  24.         //I2C1_CCR = 0x28;
  25.         //I2C1_TRISE = 0x09;
  26.         //I2C1_CR1 = 0x101;
  27.        
  28.         SPI1_CR1 = 0x947;                      
  29.         SPI1_CR2 = 0x0;
  30.         SPI1_SR = 2;
  31.        
  32.  
  33.         // SPI1 setup
  34.         SPI1_DR = 0x33;
  35.        
  36.         while(1)
  37.         {
  38.                 if(!(SPI1_SR & (1 << 7)))
  39.                         SPI1_DR = 0xFF;
  40.                        
  41.         }      
  42. }