chore(hal): remove StdPeriph (#5023)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Malte Langermann <malte@langermann.net> Co-authored-by: 3djc <3djc@gh.com> Co-authored-by: Richard Li <richard.li@ces.hk>
This commit is contained in:
co-authored by
raphaelcoeffic
Malte Langermann
3djc
Richard Li
parent
fea402a6e3
commit
6579905088
@@ -19,63 +19,72 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "hal/gpio.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
#include "board.h"
|
||||
|
||||
void ledInit()
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(LED_GPIO, &GPIO_InitStructure);
|
||||
#if defined(LED_GPIO)
|
||||
gpio_init(LED_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
#if defined(LED_RED_GPIO)
|
||||
gpio_init(LED_RED_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
#if defined(LED_GREEN_GPIO)
|
||||
gpio_init(LED_GREEN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
#if defined(LED_BLUE_GPIO)
|
||||
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#if defined(LED_GPIO)
|
||||
|
||||
// Single GPIO for dual color LED
|
||||
void ledOff()
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(LED_GPIO, &GPIO_InitStructure);
|
||||
gpio_init(LED_GPIO, GPIO_IN_PU, GPIO_PIN_SPEED_LOW);
|
||||
}
|
||||
|
||||
void ledRed()
|
||||
{
|
||||
ledInit();
|
||||
GPIO_SetBits(LED_GPIO, LED_GPIO_PIN);
|
||||
gpio_set(LED_GPIO);
|
||||
}
|
||||
|
||||
void ledBlue()
|
||||
{
|
||||
ledInit();
|
||||
GPIO_ResetBits(LED_GPIO, LED_GPIO_PIN);
|
||||
gpio_clear(LED_GPIO);
|
||||
}
|
||||
#elif defined(PCBX10)
|
||||
|
||||
#elif defined(LED_RED_GPIO) && defined(LED_GREEN_GPIO) && defined(LED_BLUE_GPIO)
|
||||
|
||||
void ledOff()
|
||||
{
|
||||
GPIO_ResetBits(LED_GPIO, LED_GPIO_PIN);
|
||||
gpio_clear(LED_RED_GPIO);
|
||||
gpio_clear(LED_GREEN_GPIO);
|
||||
gpio_clear(LED_BLUE_GPIO);
|
||||
}
|
||||
|
||||
void ledRed()
|
||||
{
|
||||
ledOff();
|
||||
GPIO_SetBits(LED_GPIO, LED_RED_GPIO_PIN);
|
||||
gpio_set(LED_RED_GPIO);
|
||||
}
|
||||
|
||||
void ledGreen()
|
||||
{
|
||||
ledOff();
|
||||
GPIO_SetBits(LED_GPIO, LED_GREEN_GPIO_PIN);
|
||||
gpio_set(LED_GREEN_GPIO);
|
||||
}
|
||||
|
||||
void ledBlue()
|
||||
{
|
||||
ledOff();
|
||||
GPIO_SetBits(LED_GPIO, LED_BLUE_GPIO_PIN);
|
||||
gpio_set(LED_BLUE_GPIO);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user