| BlueNRG-1 SDK drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

SDK_EVAL_Led.c
Go to the documentation of this file.
1
24 /* Includes ------------------------------------------------------------------*/
25 #include "SDK_EVAL_Led.h"
26
27
89 static uint32_t Get_LedGpioPin(SdkEvalLed xLed)
90 {
91 uint32_t led_pin;
92 switch (xLed)
93 {
94 case(LED1):
95 led_pin = SDK_EVAL_LED1_PIN;
96 break;
97 case(LED2):
98 led_pin = SDK_EVAL_LED2_PIN;
99 break;
100 case(LED3):
101 led_pin = SDK_EVAL_LED3_PIN;
102 break;
103 default:
104 led_pin = SDK_EVAL_LED1_PIN;
105 break;
106 }
107 return (led_pin);
108 }
109
131 void SdkEvalLedInit(SdkEvalLed xLed)
132 {
133 GPIO_InitType GPIO_InitStructure;
134
135 /* Enable the GPIO Clock */
136 SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_GPIO, ENABLE);
137
138 /* Configure the LED pin */
139 GPIO_InitStructure.GPIO_Pin = Get_LedGpioPin(xLed);
140 GPIO_InitStructure.GPIO_Mode = GPIO_Output;
141 GPIO_InitStructure.GPIO_Pull = ENABLE;
142 GPIO_InitStructure.GPIO_HighPwr = ENABLE;
143 GPIO_Init(&GPIO_InitStructure);
144
145 /* Put the LED off */
146 SdkEvalLedOff(xLed);
147 }
148
158 void SdkEvalLedOn(SdkEvalLed xLed)
159 {
160 GPIO_WriteBit(Get_LedGpioPin(xLed), LED_ON);
161 }
162
172 void SdkEvalLedOff(SdkEvalLed xLed)
173 {
174 GPIO_WriteBit(Get_LedGpioPin(xLed), LED_OFF);
175 }
176
186 void SdkEvalLedToggle(SdkEvalLed xLed)
187 {
188 GPIO_ToggleBits(Get_LedGpioPin(xLed));
189 }
190
201 FlagStatus SdkEvalLedGetState(SdkEvalLed xLed)
202 {
203 if(GPIO_ReadBit(Get_LedGpioPin(xLed)))
204 return RESET;
205 else
206 return SET;
207 }
208
209
224 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
LED1
Definition: SDK_EVAL_Led.h:54
SDK_EVAL_LED2_PIN
#define SDK_EVAL_LED2_PIN
Definition: USER_Platform_Configuration.h:79
SdkEvalLedOn
void SdkEvalLedOn(SdkEvalLed xLed)
Turns selected LED On.
Definition: SDK_EVAL_Led.c:158
SdkEvalLedGetState
FlagStatus SdkEvalLedGetState(SdkEvalLed xLed)
Returns the status of a specified led.
Definition: SDK_EVAL_Led.c:201
LED3
Definition: SDK_EVAL_Led.h:56
LED_ON
#define LED_ON
SDK Eval leds polarity.
Definition: SDK_EVAL_Led.h:73
LED_OFF
#define LED_OFF
Definition: SDK_EVAL_Led.h:74
SDK_EVAL_Led.h
This file provides all the low level API to manage LEDs for eval board.
SdkEvalLedToggle
void SdkEvalLedToggle(SdkEvalLed xLed)
Toggles the selected LED.
Definition: SDK_EVAL_Led.c:186
SDK_EVAL_LED3_PIN
#define SDK_EVAL_LED3_PIN
Definition: USER_Platform_Configuration.h:80
LED2
Definition: SDK_EVAL_Led.h:55
SdkEvalLed
SdkEvalLed
Enumeration of SDK EVAL LEDs.
Definition: SDK_EVAL_Led.h:53
SdkEvalLedInit
void SdkEvalLedInit(SdkEvalLed xLed)
Configures LEDs.
Definition: SDK_EVAL_Led.c:131
SDK_EVAL_LED1_PIN
#define SDK_EVAL_LED1_PIN
BlueNRG1 Eval Board (STEVAL-IDB007Vx) LEDs definitions.
Definition: USER_Platform_Configuration.h:78
SdkEvalLedOff
void SdkEvalLedOff(SdkEvalLed xLed)
Turns selected LED Off.
Definition: SDK_EVAL_Led.c:172