Vladimir N. Shilov před 2 roky
rodič
revize
b3246ff24e
1 změnil soubory, kde provedl 8 přidání a 19 odebrání
  1. 8 19
      Src/board.c

+ 8 - 19
Src/board.c

@@ -24,7 +24,6 @@ static const uint16_t nixieCathodeMap[4][11] = {
   {0x0800, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0000},
   {0x0200, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0000}
 };
-//static const uint8_t nixieCathodeMask[4][2] = {{0x00, 0x3f}, {0xc0, 0x0f}, {0xf0, 0x03}, {0xc0, 0x00}};
 static uint8_t tubesBuffer[SPI_BUFFER_SIZE] = {0};
 
 /* private typedef */
@@ -108,9 +107,6 @@ void showDigits(tube4_t dig)
   static uint32_t old_dig = 0;
   uint8_t st = 0, ov = FADE_START;
 
-//  if (old_dig == dig.u32) {
-//    _show_digits(dig.u32);
-//  } else {
   if (old_dig != dig.u32) {
     while (ov < FADE_STOP) {
       if (st == 0) {
@@ -226,10 +222,8 @@ static void _show_digits(const uint32_t digits)
   /* check values range */
   int i;
   for (i=0; i<4; i++) {
-    if (dig.ar[i] > 9) {
-      if (dig.ar[i] != TUBE_BLANK) {
-        dig.ar[i] = 0;
-      }
+    if (dig.ar[i] > TUBE_BLANK) {
+      dig.ar[i] = TUBE_BLANK;
     }
   }
 
@@ -344,7 +338,6 @@ void SystemClock_Config(void)
   while((RCC->CR & RCC_CR_HSIRDY) == 0);
 
   /* Main PLL configuration and activation */
-  //RCC->PLLCFGR &= ~(RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR);
   RCC->PLLCFGR = (RCC_PLLCFGR_PLLSRC_HSI | RCC_PLLCFGR_PLLM_0 | (9 << RCC_PLLCFGR_PLLN_Pos) | RCC_PLLCFGR_PLLR_1);
   RCC->PLLCFGR |= RCC_PLLCFGR_PLLREN; // RCC_PLL_EnableDomain_SYS
   RCC->CR |= RCC_CR_PLLON; // RCC_PLL_Enable
@@ -642,7 +635,7 @@ static void TIM3_Init(void)
   * @brief TIM14 Initialization Function
   * @param None
   * @retval None
-  * @desc   "Блинкование" разрядами - 0,75/0,25 сек вкл/выкл.
+  * @desc   "Блинкование" разрядами.
   */
 static void TIM14_Init(void)
 {
@@ -657,21 +650,20 @@ static void TIM14_Init(void)
   TIM14->PSC = TIM14_PSC;
   TIM14->ARR = TIM14_ARR;
 
-  /* Enable:  Auto-reload preload, no One-pulse mode, */
-  TIM14->CR1 = (TIM_CR1_ARPE); // | TIM_CR1_OPM);
+  /* Enable:  Auto-reload preload */
+  TIM14->CR1 = (TIM_CR1_ARPE);
 
-  /* OC or PWM? (for pwm - (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) ) , Output compare 1 preload */
+  /* Output compare 1 preload */
   TIM14->CCMR1 = (TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1PE);
 
-  /* Enable Channel_1 or no needed ??? */
+  /* Enable Channel_1 */
   TIM14->CCER = TIM_CCER_CC1E;
 
   /* Impulse value in msek */
   TIM14->CCR1 = TIM14_PULSE_VAL;
 
-  /* Enable IRQ for Update end CaptureCompare envents or only CC ??? */
+  /* Enable IRQ for Update end CaptureCompare envents */
   TIM14->DIER = (TIM_DIER_UIE | TIM_DIER_CC1IE);
-  //TIM14->DIER = TIM_DIER_CC1IE;
 }
 
 /**
@@ -679,9 +671,6 @@ static void TIM14_Init(void)
  */
 void Blink_Start(void)
 {
-  /* enable all channels */
-  //TUBE_ALL_ON;
-
   /* clear IRQ flags */
   TIM14->SR |= TIM_SR_UIF;
   TIM14->SR |= TIM_SR_CC1IF;