소스 검색

It works! :-)

Vladimir N. Shilov 8 년 전
부모
커밋
673f989768
1개의 변경된 파일11개의 추가작업 그리고 7개의 파일을 삭제
  1. 11 7
      src/main.c

+ 11 - 7
src/main.c

@@ -48,7 +48,7 @@
 #define BTN_PINS  (GPIO_PIN_2)
 
 #define LED_OUT_OFF   {LED_SEG1_PORT->ODR |= LED_SEG1_PINS; LED_SEG2_PORT->ODR |= LED_SEG2_PINS; LED_SEG3_PORT->ODR |= LED_SEG3_PINS;}
-#define LED_OUT_DP    GPIOC->ODR &= 0xFD;
+#define LED_OUT_DP    GPIOC->ODR &= (~GPIO_PIN_5);
 #define LED_OUT_MM    GPIOC->ODR &= 0xF7;
 #define LED_OUT_0     GPIOA->ODR &= 0xFD; GPIOB->ODR &= 0xCF; GPIOC->ODR &= 0x29;
 #define LED_OUT_1     GPIOB->ODR &= 0xEF; GPIOC->ODR &= 0xE9;
@@ -80,18 +80,22 @@ static void PrepareForLed(void);
 __IO uint16_t ConversionBuffer[ADC_SMPLS];
 __IO uint8_t BufferIndex = 0;
 static uint16_t Current = 0;
-static uint8_t LedDigits[3] = {1, 2, 3};
-static uint8_t LedPoint = 4;
+static uint8_t LedDigits[3] = {0, 0, 0};
+static uint8_t LedPoint = 3;
 
 void main(void)
 {
-  /* Initialization of the clock */
-  /* Clock divider to HSI/1, CPU/1 */
+  /* Initialization of the clock to 16MHz */
   CLK->CKDIVR = 0x00;
 
   /* Disable clock of unused perephireal */
-  /* UART, SPI, I2C*/
+  /* UART, SPI, I2C */
   CLK->PCKENR1 = 0xF0;
+  /* CAN */
+  CLK->PCKENR2 = 0x0F;
+
+  /* SWIM clock */
+  CLK->SWIMCCR = 0x00;
 
   /* GPIO configuration ------------------------------------------*/
   GPIO_Config();
@@ -105,7 +109,7 @@ void main(void)
   /* Initialize dispatcher */
   RTOS_Init();
   RTOS_SetTask(OutputToLed, 0, 5);
-  //RTOS_SetTask(PrepareForLed, 210, 200);
+  RTOS_SetTask(PrepareForLed, 210, 200);
 
   /* Infinite loop */
   while (1)