mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
[stm32] LED_ON is not necessarily gpio_clear
while here, replace GPIO_BSRR and GPIO_BRR with gpio_set|clear
This commit is contained in:
@@ -39,11 +39,15 @@
|
|||||||
#define _LED_GPIO_CLK(i) i
|
#define _LED_GPIO_CLK(i) i
|
||||||
#define _LED_GPIO(i) i
|
#define _LED_GPIO(i) i
|
||||||
#define _LED_GPIO_PIN(i) i
|
#define _LED_GPIO_PIN(i) i
|
||||||
|
#define _LED_GPIO_ON(i) i
|
||||||
|
#define _LED_GPIO_OFF(i) i
|
||||||
#define _LED_AFIO_REMAP(i) i
|
#define _LED_AFIO_REMAP(i) i
|
||||||
|
|
||||||
#define LED_GPIO_CLK(i) _LED_GPIO_CLK(LED_ ## i ## _GPIO_CLK)
|
#define LED_GPIO_CLK(i) _LED_GPIO_CLK(LED_ ## i ## _GPIO_CLK)
|
||||||
#define LED_GPIO(i) _LED_GPIO(LED_ ## i ## _GPIO)
|
#define LED_GPIO(i) _LED_GPIO(LED_ ## i ## _GPIO)
|
||||||
#define LED_GPIO_PIN(i) _LED_GPIO_PIN(LED_ ## i ## _GPIO_PIN)
|
#define LED_GPIO_PIN(i) _LED_GPIO_PIN(LED_ ## i ## _GPIO_PIN)
|
||||||
|
#define LED_GPIO_ON(i) _LED_GPIO_ON(LED_ ## i ## _GPIO_ON)
|
||||||
|
#define LED_GPIO_OFF(i) _LED_GPIO_OFF(LED_ ## i ## _GPIO_OFF)
|
||||||
#define LED_AFIO_REMAP(i) _LED_AFIO_REMAP(LED_ ## i ## _AFIO_REMAP)
|
#define LED_AFIO_REMAP(i) _LED_AFIO_REMAP(LED_ ## i ## _AFIO_REMAP)
|
||||||
|
|
||||||
/* set pin as output */
|
/* set pin as output */
|
||||||
@@ -69,9 +73,9 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LED_ON(i) { gpio_clear(LED_GPIO(i), LED_GPIO_PIN(i)); }
|
#define LED_ON(i) LED_GPIO_ON(i)(LED_GPIO(i), LED_GPIO_PIN(i))
|
||||||
#define LED_OFF(i) { gpio_set(LED_GPIO(i), LED_GPIO_PIN(i)); }
|
#define LED_OFF(i) LED_GPIO_OFF(i)(LED_GPIO(i), LED_GPIO_PIN(i))
|
||||||
#define LED_TOGGLE(i) { gpio_toggle(LED_GPIO(i), LED_GPIO_PIN(i)); }
|
#define LED_TOGGLE(i) gpio_toggle(LED_GPIO(i), LED_GPIO_PIN(i))
|
||||||
|
|
||||||
#define LED_PERIODIC() {}
|
#define LED_PERIODIC() {}
|
||||||
|
|
||||||
@@ -111,11 +115,11 @@ extern uint8_t led_status[NB_LED];
|
|||||||
#define LED_PERIODIC() { \
|
#define LED_PERIODIC() { \
|
||||||
for (uint8_t _cnt = 0; _cnt < NB_LED; _cnt++) { \
|
for (uint8_t _cnt = 0; _cnt < NB_LED; _cnt++) { \
|
||||||
if (led_status[_cnt]) \
|
if (led_status[_cnt]) \
|
||||||
GPIO_BSRR(GPIOC) = GPIO15; \
|
gpio_set(GPIOC, GPIO15); \
|
||||||
else \
|
else \
|
||||||
GPIO_BRR(GPIOC) = GPIO15; \
|
gpio_clear(GPIOC, GPIO15); \
|
||||||
GPIO_BSRR(GPIOA) = GPIO8; /* clock rising edge */ \
|
gpio_set(GPIOA, GPIO8); /* clock rising edge */ \
|
||||||
GPIO_BRR(GPIOA) = GPIO8; /* clock falling edge */ \
|
gpio_clear(GPIOA, GPIO8); /* clock falling edge */ \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#define LED_1_GPIO GPIOA
|
#define LED_1_GPIO GPIOA
|
||||||
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPAEN
|
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPAEN
|
||||||
#define LED_1_GPIO_PIN GPIO8
|
#define LED_1_GPIO_PIN GPIO8
|
||||||
#define LED_1_GPIO_ON GPIO_BRR
|
#define LED_1_GPIO_ON gpio_clear
|
||||||
#define LED_1_GPIO_OFF GPIO_BSRR
|
#define LED_1_GPIO_OFF gpio_set
|
||||||
#define LED_1_AFIO_REMAP ((void)0)
|
#define LED_1_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* green, shared with JTAG_TRST */
|
/* green, shared with JTAG_TRST */
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
#define LED_2_GPIO GPIOB
|
#define LED_2_GPIO GPIOB
|
||||||
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
||||||
#define LED_2_GPIO_PIN GPIO4
|
#define LED_2_GPIO_PIN GPIO4
|
||||||
#define LED_2_GPIO_ON GPIO_BRR
|
#define LED_2_GPIO_ON gpio_clear
|
||||||
#define LED_2_GPIO_OFF GPIO_BSRR
|
#define LED_2_GPIO_OFF gpio_set
|
||||||
#define LED_2_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
#define LED_2_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
||||||
|
|
||||||
/* green, shared with ADC12 (ADC_6 on connector ANALOG2) */
|
/* green, shared with ADC12 (ADC_6 on connector ANALOG2) */
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
#define LED_3_GPIO GPIOC
|
#define LED_3_GPIO GPIOC
|
||||||
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_3_GPIO_PIN GPIO2
|
#define LED_3_GPIO_PIN GPIO2
|
||||||
#define LED_3_GPIO_ON GPIO_BRR
|
#define LED_3_GPIO_ON gpio_clear
|
||||||
#define LED_3_GPIO_OFF GPIO_BSRR
|
#define LED_3_GPIO_OFF gpio_set
|
||||||
#define LED_3_AFIO_REMAP ((void)0)
|
#define LED_3_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* red, shared with ADC15 (ADC_4 on connector ANALOG2) */
|
/* red, shared with ADC15 (ADC_4 on connector ANALOG2) */
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
#define LED_4_GPIO GPIOC
|
#define LED_4_GPIO GPIOC
|
||||||
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_4_GPIO_PIN GPIO5
|
#define LED_4_GPIO_PIN GPIO5
|
||||||
#define LED_4_GPIO_ON GPIO_BRR
|
#define LED_4_GPIO_ON gpio_clear
|
||||||
#define LED_4_GPIO_OFF GPIO_BSRR
|
#define LED_4_GPIO_OFF gpio_set
|
||||||
#define LED_4_AFIO_REMAP ((void)0)
|
#define LED_4_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* green, on PC15 */
|
/* green, on PC15 */
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
#define LED_5_GPIO GPIOC
|
#define LED_5_GPIO GPIOC
|
||||||
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_5_GPIO_PIN GPIO15
|
#define LED_5_GPIO_PIN GPIO15
|
||||||
#define LED_5_GPIO_ON GPIO_BRR
|
#define LED_5_GPIO_ON gpio_clear
|
||||||
#define LED_5_GPIO_OFF GPIO_BSRR
|
#define LED_5_GPIO_OFF gpio_set
|
||||||
#define LED_5_AFIO_REMAP ((void)0)
|
#define LED_5_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,24 +75,24 @@
|
|||||||
#define LED_6_GPIO GPIOC
|
#define LED_6_GPIO GPIOC
|
||||||
#define LED_6_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_6_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_6_GPIO_PIN GPIO3
|
#define LED_6_GPIO_PIN GPIO3
|
||||||
#define LED_6_GPIO_ON GPIO_BRR
|
#define LED_6_GPIO_ON gpio_clear
|
||||||
#define LED_6_GPIO_OFF GPIO_BSRR
|
#define LED_6_GPIO_OFF gpio_set
|
||||||
#define LED_6_AFIO_REMAP ((void)0)
|
#define LED_6_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC0, ADC10 on ADC_2 */
|
/* PC0, ADC10 on ADC_2 */
|
||||||
#define LED_7_GPIO GPIOC
|
#define LED_7_GPIO GPIOC
|
||||||
#define LED_7_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_7_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_7_GPIO_PIN GPIO0
|
#define LED_7_GPIO_PIN GPIO0
|
||||||
#define LED_7_GPIO_ON GPIO_BRR
|
#define LED_7_GPIO_ON gpio_clear
|
||||||
#define LED_7_GPIO_OFF GPIO_BSRR
|
#define LED_7_GPIO_OFF gpio_set
|
||||||
#define LED_7_AFIO_REMAP ((void)0)
|
#define LED_7_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC1, ADC11 on ADC_3 */
|
/* PC1, ADC11 on ADC_3 */
|
||||||
#define LED_8_GPIO GPIOC
|
#define LED_8_GPIO GPIOC
|
||||||
#define LED_8_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_8_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_8_GPIO_PIN GPIO1
|
#define LED_8_GPIO_PIN GPIO1
|
||||||
#define LED_8_GPIO_ON GPIO_BRR
|
#define LED_8_GPIO_ON gpio_clear
|
||||||
#define LED_8_GPIO_OFF GPIO_BSRR
|
#define LED_8_GPIO_OFF gpio_set
|
||||||
#define LED_8_AFIO_REMAP ((void)0)
|
#define LED_8_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
@@ -104,16 +104,16 @@
|
|||||||
#define LED_BODY_GPIO GPIOB
|
#define LED_BODY_GPIO GPIOB
|
||||||
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
||||||
#define LED_BODY_GPIO_PIN GPIO1
|
#define LED_BODY_GPIO_PIN GPIO1
|
||||||
#define LED_BODY_GPIO_ON GPIO_BSRR
|
#define LED_BODY_GPIO_ON gpio_set
|
||||||
#define LED_BODY_GPIO_OFF GPIO_BRR
|
#define LED_BODY_GPIO_OFF gpio_clear
|
||||||
#define LED_BODY_AFIO_REMAP ((void)0)
|
#define LED_BODY_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC12, on GPIO connector*/
|
/* PC12, on GPIO connector*/
|
||||||
#define LED_12_GPIO GPIOC
|
#define LED_12_GPIO GPIOC
|
||||||
#define LED_12_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_12_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_12_GPIO_PIN GPIO12
|
#define LED_12_GPIO_PIN GPIO12
|
||||||
#define LED_1_GPIO_ON GPIO_BRR
|
#define LED_12_GPIO_ON gpio_clear
|
||||||
#define LED_1_GPIO_OFF GPIO_BSRR
|
#define LED_12_GPIO_OFF gpio_set
|
||||||
#define LED_12_AFIO_REMAP ((void)0)
|
#define LED_12_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
#define LED_1_GPIO GPIOB
|
#define LED_1_GPIO GPIOB
|
||||||
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
||||||
#define LED_1_GPIO_PIN GPIO4
|
#define LED_1_GPIO_PIN GPIO4
|
||||||
#define LED_1_GPIO_ON GPIO_BRR
|
#define LED_1_GPIO_ON gpio_clear
|
||||||
#define LED_1_GPIO_OFF GPIO_BSRR
|
#define LED_1_GPIO_OFF gpio_set
|
||||||
#define LED_1_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
#define LED_1_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
||||||
|
|
||||||
/* blue */
|
/* blue */
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
#define LED_2_GPIO GPIOC
|
#define LED_2_GPIO GPIOC
|
||||||
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_2_GPIO_PIN GPIO5
|
#define LED_2_GPIO_PIN GPIO5
|
||||||
#define LED_2_GPIO_ON GPIO_BRR
|
#define LED_2_GPIO_ON gpio_clear
|
||||||
#define LED_2_GPIO_OFF GPIO_BSRR
|
#define LED_2_GPIO_OFF gpio_set
|
||||||
#define LED_2_AFIO_REMAP ((void)0)
|
#define LED_2_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* blue */
|
/* blue */
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
#define LED_3_GPIO GPIOC
|
#define LED_3_GPIO GPIOC
|
||||||
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_3_GPIO_PIN GPIO2
|
#define LED_3_GPIO_PIN GPIO2
|
||||||
#define LED_3_GPIO_ON GPIO_BRR
|
#define LED_3_GPIO_ON gpio_clear
|
||||||
#define LED_3_GPIO_OFF GPIO_BSRR
|
#define LED_3_GPIO_OFF gpio_set
|
||||||
#define LED_3_AFIO_REMAP ((void)0)
|
#define LED_3_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
// GPIO pins
|
// GPIO pins
|
||||||
@@ -50,8 +50,8 @@
|
|||||||
#define LED_4_GPIO GPIOC
|
#define LED_4_GPIO GPIOC
|
||||||
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_4_GPIO_PIN GPIO12
|
#define LED_4_GPIO_PIN GPIO12
|
||||||
#define LED_4_GPIO_ON GPIO_BRR
|
#define LED_4_GPIO_ON gpio_clear
|
||||||
#define LED_4_GPIO_OFF GPIO_BSRR
|
#define LED_4_GPIO_OFF gpio_set
|
||||||
#define LED_4_AFIO_REMAP ((void)0)
|
#define LED_4_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
#ifndef USE_LED_5
|
#ifndef USE_LED_5
|
||||||
@@ -60,16 +60,16 @@
|
|||||||
#define LED_5_GPIO GPIOC
|
#define LED_5_GPIO GPIOC
|
||||||
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_5_GPIO_PIN GPIO10
|
#define LED_5_GPIO_PIN GPIO10
|
||||||
#define LED_5_GPIO_ON GPIO_BRR
|
#define LED_5_GPIO_ON gpio_clear
|
||||||
#define LED_5_GPIO_OFF GPIO_BSRR
|
#define LED_5_GPIO_OFF gpio_set
|
||||||
#define LED_5_AFIO_REMAP ((void)0)
|
#define LED_5_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PB1, DRDY on EXT SPI connector*/
|
/* PB1, DRDY on EXT SPI connector*/
|
||||||
#define LED_BODY_GPIO GPIOB
|
#define LED_BODY_GPIO GPIOB
|
||||||
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
||||||
#define LED_BODY_GPIO_PIN GPIO1
|
#define LED_BODY_GPIO_PIN GPIO1
|
||||||
#define LED_BODY_GPIO_ON GPIO_BSRR
|
#define LED_BODY_GPIO_ON gpio_set
|
||||||
#define LED_BODY_GPIO_OFF GPIO_BRR
|
#define LED_BODY_GPIO_OFF gpio_clear
|
||||||
#define LED_BODY_AFIO_REMAP ((void)0)
|
#define LED_BODY_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#define LED_1_GPIO GPIOA
|
#define LED_1_GPIO GPIOA
|
||||||
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPAEN
|
#define LED_1_GPIO_CLK RCC_APB2ENR_IOPAEN
|
||||||
#define LED_1_GPIO_PIN GPIO8
|
#define LED_1_GPIO_PIN GPIO8
|
||||||
#define LED_1_GPIO_ON GPIO_BRR
|
#define LED_1_GPIO_ON gpio_clear
|
||||||
#define LED_1_GPIO_OFF GPIO_BSRR
|
#define LED_1_GPIO_OFF gpio_set
|
||||||
#define LED_1_AFIO_REMAP ((void)0)
|
#define LED_1_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* green, shared with JTAG_TRST */
|
/* green, shared with JTAG_TRST */
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
#define LED_2_GPIO GPIOB
|
#define LED_2_GPIO GPIOB
|
||||||
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
#define LED_2_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
|
||||||
#define LED_2_GPIO_PIN GPIO4
|
#define LED_2_GPIO_PIN GPIO4
|
||||||
#define LED_2_GPIO_ON GPIO_BRR
|
#define LED_2_GPIO_ON gpio_clear
|
||||||
#define LED_2_GPIO_OFF GPIO_BSRR
|
#define LED_2_GPIO_OFF gpio_set
|
||||||
#define LED_2_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
#define LED_2_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
|
||||||
|
|
||||||
/* green, shared with ADC12 (ADC_6 on connector ANALOG2) */
|
/* green, shared with ADC12 (ADC_6 on connector ANALOG2) */
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
#define LED_3_GPIO GPIOC
|
#define LED_3_GPIO GPIOC
|
||||||
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_3_GPIO_PIN GPIO2
|
#define LED_3_GPIO_PIN GPIO2
|
||||||
#define LED_3_GPIO_ON GPIO_BRR
|
#define LED_3_GPIO_ON gpio_clear
|
||||||
#define LED_3_GPIO_OFF GPIO_BSRR
|
#define LED_3_GPIO_OFF gpio_set
|
||||||
#define LED_3_AFIO_REMAP ((void)0)
|
#define LED_3_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* red, shared with ADC15 (ADC_4 on connector ANALOG2) */
|
/* red, shared with ADC15 (ADC_4 on connector ANALOG2) */
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
#define LED_4_GPIO GPIOC
|
#define LED_4_GPIO GPIOC
|
||||||
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_4_GPIO_PIN GPIO5
|
#define LED_4_GPIO_PIN GPIO5
|
||||||
#define LED_4_GPIO_ON GPIO_BRR
|
#define LED_4_GPIO_ON gpio_clear
|
||||||
#define LED_4_GPIO_OFF GPIO_BSRR
|
#define LED_4_GPIO_OFF gpio_set
|
||||||
#define LED_4_AFIO_REMAP ((void)0)
|
#define LED_4_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* green, on PC15 */
|
/* green, on PC15 */
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
#define LED_5_GPIO GPIOC
|
#define LED_5_GPIO GPIOC
|
||||||
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_5_GPIO_PIN GPIO15
|
#define LED_5_GPIO_PIN GPIO15
|
||||||
#define LED_5_GPIO_ON GPIO_BRR
|
#define LED_5_GPIO_ON gpio_clear
|
||||||
#define LED_5_GPIO_OFF GPIO_BSRR
|
#define LED_5_GPIO_OFF gpio_set
|
||||||
#define LED_5_AFIO_REMAP ((void)0)
|
#define LED_5_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,24 +75,24 @@
|
|||||||
#define LED_6_GPIO GPIOC
|
#define LED_6_GPIO GPIOC
|
||||||
#define LED_6_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_6_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_6_GPIO_PIN GPIO3
|
#define LED_6_GPIO_PIN GPIO3
|
||||||
#define LED_6_GPIO_ON GPIO_BRR
|
#define LED_6_GPIO_ON gpio_clear
|
||||||
#define LED_6_GPIO_OFF GPIO_BSRR
|
#define LED_6_GPIO_OFF gpio_set
|
||||||
#define LED_6_AFIO_REMAP ((void)0)
|
#define LED_6_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC0, ADC10 on ADC_2 */
|
/* PC0, ADC10 on ADC_2 */
|
||||||
#define LED_7_GPIO GPIOC
|
#define LED_7_GPIO GPIOC
|
||||||
#define LED_7_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_7_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_7_GPIO_PIN GPIO0
|
#define LED_7_GPIO_PIN GPIO0
|
||||||
#define LED_7_GPIO_ON GPIO_BRR
|
#define LED_7_GPIO_ON gpio_clear
|
||||||
#define LED_7_GPIO_OFF GPIO_BSRR
|
#define LED_7_GPIO_OFF gpio_set
|
||||||
#define LED_7_AFIO_REMAP ((void)0)
|
#define LED_7_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC1, ADC11 on ADC_3 */
|
/* PC1, ADC11 on ADC_3 */
|
||||||
#define LED_8_GPIO GPIOC
|
#define LED_8_GPIO GPIOC
|
||||||
#define LED_8_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_8_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_8_GPIO_PIN GPIO1
|
#define LED_8_GPIO_PIN GPIO1
|
||||||
#define LED_8_GPIO_ON GPIO_BRR
|
#define LED_8_GPIO_ON gpio_clear
|
||||||
#define LED_8_GPIO_OFF GPIO_BSRR
|
#define LED_8_GPIO_OFF gpio_set
|
||||||
#define LED_8_AFIO_REMAP ((void)0)
|
#define LED_8_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
@@ -104,16 +104,16 @@
|
|||||||
#define LED_BODY_GPIO GPIOB
|
#define LED_BODY_GPIO GPIOB
|
||||||
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
#define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
|
||||||
#define LED_BODY_GPIO_PIN GPIO1
|
#define LED_BODY_GPIO_PIN GPIO1
|
||||||
#define LED_BODY_GPIO_ON GPIO_BSRR
|
#define LED_BODY_GPIO_ON gpio_set
|
||||||
#define LED_BODY_GPIO_OFF GPIO_BRR
|
#define LED_BODY_GPIO_OFF gpio_clear
|
||||||
#define LED_BODY_AFIO_REMAP ((void)0)
|
#define LED_BODY_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
/* PC12, on GPIO connector*/
|
/* PC12, on GPIO connector*/
|
||||||
#define LED_12_GPIO GPIOC
|
#define LED_12_GPIO GPIOC
|
||||||
#define LED_12_GPIO_CLK RCC_APB2ENR_IOPCEN
|
#define LED_12_GPIO_CLK RCC_APB2ENR_IOPCEN
|
||||||
#define LED_12_GPIO_PIN GPIO12
|
#define LED_12_GPIO_PIN GPIO12
|
||||||
#define LED_1_GPIO_ON GPIO_BRR
|
#define LED_12_GPIO_ON gpio_clear
|
||||||
#define LED_1_GPIO_OFF GPIO_BSRR
|
#define LED_12_GPIO_OFF gpio_set
|
||||||
#define LED_12_AFIO_REMAP ((void)0)
|
#define LED_12_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ int main(void) {
|
|||||||
gpio_set_mode(B_RX_PORT, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(B_RX_PORT, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, B_TX_PIN);
|
GPIO_CNF_OUTPUT_PUSHPULL, B_TX_PIN);
|
||||||
|
|
||||||
GPIO_BRR(A_TX_PORT) = A_TX_PIN;
|
gpio_clear(A_TX_PORT, A_TX_PIN);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -104,17 +104,17 @@ static inline void main_event( void ) {
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!(foo%2))
|
if (!(foo%2))
|
||||||
GPIO_BRR(A_TX_PORT) = A_TX_PIN;
|
gpio_clear(A_TX_PORT, A_TX_PIN);
|
||||||
else
|
else
|
||||||
GPIO_BSRR(A_TX_PORT) = A_TX_PIN;
|
gpio_set(A_TX_PORT, A_TX_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
/* passthrough B_RX to A_TX */
|
/* passthrough B_RX to A_TX */
|
||||||
if (GPIO_IDR(B_RX_PORT) & B_RX_PIN)
|
if (GPIO_IDR(B_RX_PORT) & B_RX_PIN)
|
||||||
GPIO_BSRR(A_TX_PORT) = A_TX_PIN;
|
gpio_set(A_TX_PORT, A_TX_PIN);
|
||||||
else
|
else
|
||||||
GPIO_BRR(A_TX_PORT) = A_TX_PIN;
|
gpio_clear(A_TX_PORT, A_TX_PIN);
|
||||||
#endif
|
#endif
|
||||||
/* passthrough A_RX to B_TX */
|
/* passthrough A_RX to B_TX */
|
||||||
if (gpio_get(A_RX_PORT, A_RX_PIN)) {
|
if (gpio_get(A_RX_PORT, A_RX_PIN)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user