Add ability to debug clock with MCO1
This commit is contained in:
@@ -2055,6 +2055,19 @@ struct rcc {
|
||||
#define RCC_CFGR_PPRE_DIV_2 (0b100)
|
||||
|
||||
|
||||
#define RCC_CFGR_MCO1_HSE (0b10)
|
||||
#define RCC_CFGR_MCO1_PLL (0b11)
|
||||
|
||||
#define RCC_CFGR_MCO1_BIT 21
|
||||
#define RCC_CFGR_MCO1_MASK (0b11)
|
||||
|
||||
#define RCC_CFGR_MCO1PRE_DIV4 (0b110)
|
||||
#define RCC_CFGR_MCO1PRE_DIV2 (0b100)
|
||||
|
||||
#define RCC_CFGR_MCO1PRE_BIT 24
|
||||
#define RCC_CFGR_MCO1PRE_MASK (0b111)
|
||||
|
||||
|
||||
#define RCC_CFGR_PPRE2_BIT 13
|
||||
#define RCC_CFGR_PPRE2_MASK (0b111)
|
||||
|
||||
@@ -2124,6 +2137,7 @@ struct gpio {
|
||||
};
|
||||
|
||||
|
||||
#define GPIO_AF_MCO_1 (0b0000)
|
||||
#define GPIO_AF_USART2_RX (0b0111)
|
||||
#define GPIO_AF_USART2_TX (0b0111)
|
||||
|
||||
@@ -2150,9 +2164,9 @@ typedef enum {
|
||||
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
|
||||
void gpio_set_af(uint16_t pin, uint8_t af);
|
||||
void gpio_write(uint16_t pin,
|
||||
# 46 "src/gpio.h" 3 4
|
||||
# 47 "src/gpio.h" 3 4
|
||||
_Bool
|
||||
# 46 "src/gpio.h"
|
||||
# 47 "src/gpio.h"
|
||||
val);
|
||||
# 3 "src/usart.c" 2
|
||||
# 1 "src/usart.h" 1
|
||||
@@ -2218,16 +2232,14 @@ void usart2_init(void) {
|
||||
uint16_t rxPin = (((('A') - 'A') << 8) | 3);
|
||||
gpio_set_mode(rxPin, GPIO_MODE_AF);
|
||||
gpio_set_af(rxPin, (0b0111));
|
||||
|
||||
|
||||
|
||||
# 29 "src/usart.c"
|
||||
((struct rcc *) (0x40023800U))->APB1ENR |= (1 << 17);
|
||||
|
||||
|
||||
((struct usart *) (0x40004400U))->CR1 = 0;
|
||||
((struct usart *) (0x40004400U))->CR2 = 0;
|
||||
((struct usart *) (0x40004400U))->CR3 = 0;
|
||||
# 43 "src/usart.c"
|
||||
# 52 "src/usart.c"
|
||||
((struct usart *) (0x40004400U))->BRR &= ~((0b111111111111) << 4);
|
||||
((struct usart *) (0x40004400U))->BRR |= (0x1A << 4);
|
||||
((struct usart *) (0x40004400U))->BRR &= ~((0b111) << 0);
|
||||
|
||||
Reference in New Issue
Block a user