CJMCU - Add support for LED2. Swap usage of LED0 and LED1.
Currently the LED2 (blue) is just enabled after the main board initialisation is complete and then it stays on.
This commit is contained in:
parent
3e4bf46f1e
commit
83a5c319b5
|
@ -48,4 +48,20 @@
|
|||
#define LED1_ON
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LED2
|
||||
#define LED2_TOGGLE digitalToggle(LED2_GPIO, LED2_PIN);
|
||||
#ifndef LED2_INVERTED
|
||||
#define LED2_OFF digitalHi(LED2_GPIO, LED2_PIN);
|
||||
#define LED2_ON digitalLo(LED2_GPIO, LED2_PIN);
|
||||
#else
|
||||
#define LED2_OFF digitalLo(LED2_GPIO, LED2_PIN);
|
||||
#define LED2_ON digitalHi(LED2_GPIO, LED2_PIN);
|
||||
#endif // inverted
|
||||
#else
|
||||
#define LED2_TOGGLE
|
||||
#define LED2_OFF
|
||||
#define LED2_ON
|
||||
#endif
|
||||
|
||||
void ledInit(void);
|
||||
|
|
|
@ -46,6 +46,12 @@ void ledInit(void)
|
|||
{
|
||||
.gpio = LED1_GPIO,
|
||||
.cfg = { LED1_PIN, Mode_Out_PP, Speed_2MHz }
|
||||
},
|
||||
#endif
|
||||
#ifdef LED2
|
||||
{
|
||||
.gpio = LED2_GPIO,
|
||||
.cfg = { LED2_PIN, Mode_Out_PP, Speed_2MHz }
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
@ -58,9 +64,13 @@ void ledInit(void)
|
|||
#ifdef LED1
|
||||
RCC_APB2PeriphClockCmd(LED1_PERIPHERAL, ENABLE);
|
||||
#endif
|
||||
#ifdef LED2
|
||||
RCC_APB2PeriphClockCmd(LED2_PERIPHERAL, ENABLE);
|
||||
#endif
|
||||
|
||||
LED0_OFF;
|
||||
LED1_OFF;
|
||||
LED2_OFF;
|
||||
|
||||
for (i = 0; i < gpio_count; i++) {
|
||||
gpioInit(gpio_setup[i].gpio, &gpio_setup[i].cfg);
|
||||
|
|
|
@ -390,6 +390,10 @@ void init(void)
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CJMCU
|
||||
LED2_ON;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SOFTSERIAL_LOOPBACK
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
#define FLASH_PAGE_SIZE ((uint16_t)0x400)
|
||||
|
||||
#define LED0_GPIO GPIOC
|
||||
#define LED0_PIN Pin_13 // PC13 (LED)
|
||||
#define LED0_PIN Pin_14 // PC14 (LED)
|
||||
#define LED0
|
||||
#define LED0_PERIPHERAL RCC_APB2Periph_GPIOC
|
||||
#define LED1_GPIO GPIOC
|
||||
#define LED1_PIN Pin_14 // PC14 (LED)
|
||||
#define LED1_PIN Pin_13 // PC13 (LED)
|
||||
#define LED1
|
||||
#define LED1_PERIPHERAL RCC_APB2Periph_GPIOC
|
||||
#define LED2_GPIO GPIOC
|
||||
|
|
Loading…
Reference in New Issue