15 #include "stm32f4xx_hal.h" 16 #include "stm32f4xx_hal_gpio.h" 22 __IO uint32_t OSPEEDR;
33 #define GPIO_LED1 (GPIOG) 34 #define RCC_AHBPeriph_GPIO_LED1 (RCC_AHB1ENR_GPIOGEN) 35 #define LED_D1 (GPIO_PIN_6) 36 #define LED1_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED1)->BSRR = x) 37 #define LED1_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED1)->BRR = x) 38 #define LED_D1_OFF() LED1_IO_HI(LED_D1) 39 #define LED_D1_ON() LED1_IO_LO(LED_D1) 41 #define GPIO_LED2 (GPIOD) 42 #define RCC_AHBPeriph_GPIO_LED2 (RCC_AHB1ENR_GPIODEN) 43 #define LED_D2 (GPIO_PIN_4) 44 #define LED2_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED2)->BSRR = x) 45 #define LED2_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED2)->BRR = x) 46 #define LED_D2_OFF() LED2_IO_HI(LED_D2) 47 #define LED_D2_ON() LED2_IO_LO(LED_D2) 49 #define GPIO_LED3 (GPIOD) 50 #define RCC_AHBPeriph_GPIO_LED3 (RCC_AHB1ENR_GPIODEN) 51 #define LED_D3 (GPIO_PIN_5) 52 #define LED3_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED3)->BSRR = x) 53 #define LED3_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED3)->BRR = x) 54 #define LED_D3_OFF() LED3_IO_HI(LED_D3) 55 #define LED_D3_ON() LED3_IO_LO(LED_D3) 57 #define GPIO_LED4 (GPIOK) 58 #define RCC_AHBPeriph_GPIO_LED4 (RCC_AHB1ENR_GPIOKEN) 59 #define LED_D4 (GPIO_PIN_3) 60 #define LED4_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED4)->BSRR = x) 61 #define LED4_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED4)->BRR = x) 62 #define LED_D4_OFF() LED4_IO_HI(LED_D4) 63 #define LED_D4_ON() LED4_IO_LO(LED_D4) 65 static unsigned char led_stat;
67 static void LED_Configuration(
void)
69 GPIO_InitTypeDef GPIO_InitStructure;
72 RCC->AHB1ENR |= (RCC_AHBPeriph_GPIO_LED1 | RCC_AHBPeriph_GPIO_LED2 | RCC_AHBPeriph_GPIO_LED4);
75 GPIO_InitStructure.Pin = LED_D1;
76 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
77 GPIO_InitStructure.Pull = GPIO_NOPULL;
78 GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
79 GPIO_InitStructure.Alternate = 0;
80 HAL_GPIO_Init(GPIO_LED1, &GPIO_InitStructure);
82 GPIO_InitStructure.Pin = LED_D2 | LED_D3;
83 HAL_GPIO_Init(GPIO_LED2, &GPIO_InitStructure);
85 GPIO_InitStructure.Pin = LED_D4;
86 HAL_GPIO_Init(GPIO_LED4, &GPIO_InitStructure);
157 led_stat = (ch & 0x0f);
163 .
name = DEF_DEV_NAME_LED,
164 .explan =
"32F469I-Discovery LED",
static int led_putc(struct st_device *dev, unsigned char ch)
LEDの状態を設定する
static int led_getc(struct st_device *dev, unsigned char *rd)
LEDの状態を取得する
static int led_register(struct st_device *dev, char *param)
LEDドライバの登録
char name[MAX_DEVNAMELRN]
デバイス名文字列