Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stm32f10x.h>
- #define LLG (1 << 0)
- #define LG (1 << 1)
- #define RG (1 << 2)
- #define RRG (1 << 3)
- #define LY (1 << 4)
- #define RY (1 << 5)
- #define LR (1 << 6)
- #define RR (1 << 7)
- #define OFF 8
- void Delay(u32 uiTDel)
- {
- while (uiTDel--) {}
- }
- // ===== Function main() =================================================
- int main(void)
- { // ?????????? ???????????? ????? ? ? ????? ?
- // (? (??????)??????? ???? ?????? ?? ?????? ?????????? ?????? User ? ???????)
- RCC->APB2ENR |= RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPCEN;
- // ????????? ?????? "?????" ??? ??????????
- GPIOA->CRL = 0x33333333; // ????? PC8 - ??? ?????????? USER ?? Discovery
- char arr =
- {
- (LG|RR),
- (LY|RY),
- (LR|RG),
- (LY|RY),
- };
- char pos = 0;
- char prev = 0;
- while(1)
- {
- GPIOA->BSRR ^= arr[prev] << OFF;
- GPIOA->BSRR ^= arr[pos];
- Delay(1000000);
- prev = pos;
- pos = (++pos) % arr.size();
- }
- // return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement