20 #if defined(BSP_IO_EXPANDER)
24 #if defined( BSP_GPIO_LEDS ) || defined( BSP_IO_EXPANDER )
27 #if !defined( BSP_IO_EXPANDER )
35 #if !defined( BSP_IO_EXPANDER )
36 static const tLedArray ledArray[ BSP_NO_OF_LEDS ] = BSP_GPIO_LEDARRAY_INIT;
44 #if !defined(BSP_IO_EXPANDER)
49 for ( i=0; i<BSP_NO_OF_LEDS; i++ )
59 #if defined(BSP_IO_EXPANDER)
63 ioexpReadReg(BSP_IOEXP_REG_LED_CTRL, &value);
64 retVal = value & BSP_IOEXP_REG_LED_CTRL_LED_MASK;
68 uint32_t retVal, mask;
70 for ( i=0, retVal=0, mask=0x1; i<BSP_NO_OF_LEDS; i++, mask <<= 1 )
81 #if defined(BSP_IO_EXPANDER)
84 value = (leds & BSP_IOEXP_REG_LED_CTRL_LED_MASK)
85 | BSP_IOEXP_REG_LED_CTRL_DIRECT;
86 return ioexpWriteReg(BSP_IOEXP_REG_LED_CTRL, value);
92 for ( i=0, mask=0x1; i<BSP_NO_OF_LEDS; i++, mask <<= 1 )
105 if ((ledNo >= 0) && (ledNo < BSP_NO_OF_LEDS))
107 #if defined(BSP_IO_EXPANDER)
108 return ioexpRegBitsSet(BSP_IOEXP_REG_LED_CTRL,
false, 1 << ledNo);
119 #if defined(BSP_IO_EXPANDER)
124 if ((ledNo >= 0) && (ledNo < BSP_NO_OF_LEDS))
126 #if defined(BSP_IO_EXPANDER)
127 ioexpReadReg(BSP_IOEXP_REG_LED_CTRL, &value);
128 retVal = (value & BSP_IOEXP_REG_LED_CTRL_LED_MASK) >> ledNo;
130 retVal = (int)
GPIO_PinOutGet(ledArray[ledNo].port, ledArray[ledNo].pin);
138 if ((ledNo >= 0) && (ledNo < BSP_NO_OF_LEDS))
140 #if defined(BSP_IO_EXPANDER)
141 return ioexpRegBitsSet(BSP_IOEXP_REG_LED_CTRL,
true, (1 << ledNo));
152 #if defined(BSP_IO_EXPANDER)
156 if ((ledNo >= 0) && (ledNo < BSP_NO_OF_LEDS))
158 #if defined(BSP_IO_EXPANDER)
159 ioexpReadReg(BSP_IOEXP_REG_LED_CTRL, &value);
160 value &= BSP_IOEXP_REG_LED_CTRL_LED_MASK;
161 value ^= (1 << ledNo);
162 value |= BSP_IOEXP_REG_LED_CTRL_DIRECT;
163 return ioexpWriteReg(BSP_IOEXP_REG_LED_CTRL, value);
Clock management unit (CMU) API.
Board support package API definitions.
Board support package API implementation for STK's.
__STATIC_INLINE void GPIO_PinOutToggle(GPIO_Port_TypeDef port, unsigned int pin)
Toggle a single pin in GPIO port data out register.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
int BSP_LedsInit(void)
Initialize LED drivers.
int BSP_LedsSet(uint32_t leds)
Update all LED's.
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
Set the mode for a GPIO pin.
General Purpose IO (GPIO) peripheral API.
int BSP_LedSet(int ledNo)
Turn on a single LED.
int BSP_LedToggle(int ledNo)
Toggle a single LED.
__STATIC_INLINE void GPIO_PinOutSet(GPIO_Port_TypeDef port, unsigned int pin)
Set a single pin in GPIO data out register to 1.
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
uint32_t BSP_LedsGet(void)
Get status of all LED's.
#define BSP_STATUS_ILLEGAL_PARAM
__STATIC_INLINE unsigned int GPIO_PinOutGet(GPIO_Port_TypeDef port, unsigned int pin)
Get current setting for a pin in a GPIO port data out register.
int BSP_LedGet(int ledNo)
Get current status of a single LED.
int BSP_LedClear(int ledNo)
Turn off a single LED.
__STATIC_INLINE void GPIO_PinOutClear(GPIO_Port_TypeDef port, unsigned int pin)
Set a single pin in GPIO data out port register to 0.