Mistři v programování na #hovnokod

C/C++ #4514

Zas nějaký takyprogramátor.

 // Init (for tests start out side of actual source code (sector 0...4) => Sector 5,6 and 7)
   Akt_Sektor    = 5;
        if (Akt_Sektor == 0) Update.SW.Ptr = (unsigned long*) 0x08000000;
   else if (Akt_Sektor == 1) Update.SW.Ptr = (unsigned long*) 0x08004000;
   else if (Akt_Sektor == 2) Update.SW.Ptr = (unsigned long*) 0x08008000;
   else if (Akt_Sektor == 3) Update.SW.Ptr = (unsigned long*) 0x0800C000;
   else if (Akt_Sektor == 4) Update.SW.Ptr = (unsigned long*) 0x08010000;
   else if (Akt_Sektor == 5) Update.SW.Ptr = (unsigned long*) 0x08020000;
   else if (Akt_Sektor == 6) Update.SW.Ptr = (unsigned long*) 0x08040000;
   else                      Update.SW.Ptr = (unsigned long*) 0x08060000;

   // Unlock Flash
   (*FLASH).KEYR = 0x45670123;
   (*FLASH).KEYR = 0xCDEF89AB;

   // Wait for the BSY bit to be cleared
   while ( ((*FLASH).SR & (0x01 << 16)) == (0x01 << 16) )
         { __NOP; }

Anonymous,