fixed bug with LEDs

This commit is contained in:
2024-07-02 11:46:35 +03:00
parent c49e71c047
commit 9470b22c88
6 changed files with 140 additions and 46 deletions

View File

@@ -27,28 +27,23 @@
#define FORMUSART(X) CONCAT(USART, X)
#define USARTX FORMUSART(USARTNUM)
// LEDS: 0 - PB0, 1 - PB1
// LEDS: 0 - PB15, 1 - PA8
// LED0
#define LED0_port GPIOB
#define LED0_pin (1<<0)
#define LED0_pin (1<<15)
// LED1
#define LED1_port GPIOB
#define LED1_pin (1<<1)
#define LED1_port GPIOA
#define LED1_pin (1<<8)
#define LED_blink(x) do{if(ledsON) pin_toggle(x ## _port, x ## _pin);}while(0)
#define LED_on(x) do{if(ledsON) pin_clear(x ## _port, x ## _pin);}while(0)
#define LED_off(x) do{pin_set(x ## _port, x ## _pin);}while(0)
// CAN address - PB14(0), PB15(1), PA8(2)
#define READ_CAN_INV_ADDR() (((GPIOA->IDR & (1<<8))>>6)|((GPIOB->IDR & (3<<14))>>14))
extern volatile uint32_t Tms;
extern uint8_t ledsON;
void gpio_setup(void);
void iwdg_setup();
void pause_ms(uint32_t pause);
void Jump2Boot();