10 #include "stm32f7xx_hal.h" 11 #include "stm32f7xx_hal_gpio.h" 17 __IO uint32_t OSPEEDR;
28 #define GPIO_LED1 (GPIOJ) 29 #define GPIO_LED (GPIOJ) 30 #define RCC_AHBPeriph_GPIO_LED1 (RCC_AHB1ENR_GPIOJEN) 31 #define RCC_AHBPeriph_GPIO_LED (RCC_AHB1ENR_GPIOJEN) 32 #define LED_D1 (GPIO_PIN_13) 33 #define LED1_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED1)->BSRR = x) 34 #define LED1_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED1)->BRR = x) 35 #define LED_D1_OFF() LED1_IO_LO(LED_D1) 36 #define LED_D1_ON() LED1_IO_HI(LED_D1) 37 #define LED_OFF(x) LED1_IO_LO(LED_D1) 38 #define LED_ON(x) LED1_IO_HI(LED_D1) 40 #define GPIO_LED2 (GPIOJ) 41 #define RCC_AHBPeriph_GPIO_LED2 (RCC_AHB1ENR_GPIOJEN) 42 #define LED_D2 (GPIO_PIN_5) 43 #define LED2_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED2)->BSRR = x) 44 #define LED2_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED2)->BRR = x) 45 #define LED_D2_OFF() LED2_IO_LO(LED_D2) 46 #define LED_D2_ON() LED2_IO_HI(LED_D2) 48 #define GPIO_LED3 (GPIOA) 49 #define RCC_AHBPeriph_GPIO_LED3 (RCC_AHB1ENR_GPIOAEN) 50 #define LED_D3 (GPIO_PIN_12) 51 #define LED3_IO_HI(x) (((GPIO_LegacyTypeDef *)GPIO_LED3)->BSRR = x) 52 #define LED3_IO_LO(x) (((GPIO_LegacyTypeDef *)GPIO_LED3)->BRR = x) 53 #define LED_D3_OFF() LED3_IO_LO(LED_D3) 54 #define LED_D3_ON() LED3_IO_HI(LED_D3) 56 static unsigned char led_stat;
58 static void LED_Configuration(
void)
60 GPIO_InitTypeDef GPIO_InitStructure;
63 RCC->AHB1ENR |= (RCC_AHBPeriph_GPIO_LED | RCC_AHBPeriph_GPIO_LED3);
66 GPIO_InitStructure.Pin = LED_D1 | LED_D2;
67 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
68 GPIO_InitStructure.Pull = GPIO_NOPULL;
69 GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
70 GPIO_InitStructure.Alternate = 0;
71 HAL_GPIO_Init(GPIO_LED, &GPIO_InitStructure);
73 GPIO_InitStructure.Pin = LED_D3;
74 HAL_GPIO_Init(GPIO_LED3, &GPIO_InitStructure);
138 led_stat = (ch & 0x07);
143 static int led_suspend(
struct st_device *dev)
148 static int led_resume(
struct st_device *dev)
154 .
name = DEF_DEV_NAME_LED,
155 .explan =
"STM32F769I-Discovery LED",
159 .suspend = led_suspend,
160 .resume = led_resume,
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]
デバイス名文字列