EFM32 Gecko Software Documentation
efm32g-doc-5.1.2
|
BOARD driver and support functions.
DO_NOT_INCLUDE_WITH_DOXYGEN
Functions | |
uint32_t | BOARD_envSensEnable (bool enable) |
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors) More... | |
uint32_t | BOARD_envSensEnableIRQ (bool enable) |
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors) GPIO interrupts. More... | |
void | BOARD_flashDeepPowerDown (void) |
Puts the Flash chip in deep power down mode. More... | |
uint32_t | BOARD_gasSensorEnable (bool enable) |
Enables or disables the Air Quality / Gas Sensor. More... | |
uint32_t | BOARD_gasSensorEnableIRQ (bool enable) |
Enables or disables the Air Quality / Gas Sensor GPIO interrupt. More... | |
uint32_t | BOARD_gasSensorWake (bool wake) |
Wakes up the Air Quality / Gas Sensor. More... | |
uint32_t | BOARD_imuEnable (bool enable) |
Enables or disables the accelerometer and gyroscope sensor. More... | |
uint32_t | BOARD_imuEnableIRQ (bool enable) |
Enables or disables the accelerometer and gyroscope GPIO interrupt. More... | |
uint32_t | BOARD_init (void) |
Initializes the Thunderboard Sense board. More... | |
void | BOARD_ledSet (uint8_t leds) |
Turns on or off the red and/or green LED. More... | |
uint32_t | BOARD_micEnable (bool enable) |
Enables or disables the MEMS microphone. More... | |
uint32_t | BOARD_picGetDeviceId (void) |
Reads the device ID of the IO expander. More... | |
uint32_t | BOARD_picGetFwRevision (uint8_t *major, uint8_t *minor, uint8_t *patch) |
Reads the firmware revision of the IO expander. More... | |
uint8_t | BOARD_picGetHwRevision (void) |
Reads the hardware revision of the IO expander. More... | |
uint32_t | BOARD_picIntClear (uint8_t flags) |
Clears the interrupt status flags in the interrupt controller. More... | |
uint32_t | BOARD_picIntGet (uint8_t *flags) |
Reads the interrupt status flags from the interrupt controller. More... | |
bool | BOARD_picIsLegacyIntCtrl (void) |
Checks if the legacy interrupt control method should be used. More... | |
uint32_t | BOARD_picReadReg (uint8_t reg, uint8_t *result) |
Reads a register in the IO expander. More... | |
uint32_t | BOARD_picRegBitsSet (uint8_t addr, bool set, uint8_t bitMask) |
Sets the given bit(s) in a register in the IO expander. More... | |
uint32_t | BOARD_picWriteReg (uint8_t reg, uint8_t value) |
Writes a register in the IO expander. More... | |
void | BOARD_pushButtonEnableIRQ (bool enable) |
Enables or disables the pushbutton GPIO interrupt. More... | |
uint8_t | BOARD_pushButtonGetState (void) |
Gets the state of the pushbuttons. More... | |
void | BOARD_rgbledEnable (bool enable, uint8_t mask) |
Enables or disables the RGB LED power supply line. More... | |
void | BOARD_rgbledPowerEnable (bool enable) |
Enables or disables the RGB LED power supply line. More... | |
void | BOARD_rgbledSetColor (uint8_t red, uint8_t green, uint8_t blue) |
Sets the color of the RGB LEDs. The brightness of the LEDs is almost linear to the color value. More... | |
void | BOARD_rgbledSetRawColor (uint16_t red, uint16_t green, uint16_t blue) |
Sets the raw color of the RGB LEDs. The brightness is non-linear function of the raw color value. More... | |
uint32_t BOARD_envSensEnable | ( | bool | enable | ) |
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors)
[in] | enable | Set true to enable, false to disable |
Definition at line 492 of file board.c.
References BOARD_PIC_REG_ENV_SENSOR_CTRL, and BOARD_picWriteReg().
Referenced by BMP_init(), SI1133_init(), SI7021_init(), SI7210_deInit(), and SI7210_init().
uint32_t BOARD_envSensEnableIRQ | ( | bool | enable | ) |
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors) GPIO interrupts.
[in] | enable | Set true to enable, false to disable |
Definition at line 514 of file board.c.
References BOARD_PIC_REG_INT_ENABLE, BOARD_PIC_REG_INT_ENABLE_UV_ALS, and BOARD_picRegBitsSet().
void BOARD_flashDeepPowerDown | ( | void | ) |
Puts the Flash chip in deep power down mode.
Definition at line 219 of file board.c.
References BOARD_FLASH_PIN_SPI_CS, BOARD_FLASH_PORT_SPI_CS, BOARD_FLASH_USART, GPIO_PinModeSet(), GPIO_PinOutClear(), GPIO_PinOutSet(), gpioModeDisabled, USART_Reset(), USART_SpiTransfer(), and UTIL_delay().
uint32_t BOARD_gasSensorEnable | ( | bool | enable | ) |
Enables or disables the Air Quality / Gas Sensor.
[in] | enable | Set true to enable, false to disable |
Definition at line 557 of file board.c.
References BOARD_PIC_REG_CCS_CTRL, BOARD_PIC_REG_CCS_CTRL_EN, and BOARD_picWriteReg().
Referenced by CCS811_deInit(), and CCS811_init().
uint32_t BOARD_gasSensorEnableIRQ | ( | bool | enable | ) |
Enables or disables the Air Quality / Gas Sensor GPIO interrupt.
[in] | enable | Set true to enable, false to disable |
Definition at line 609 of file board.c.
References BOARD_PIC_REG_INT_ENABLE, BOARD_PIC_REG_INT_ENABLE_CCS811, and BOARD_picRegBitsSet().
uint32_t BOARD_gasSensorWake | ( | bool | wake | ) |
Wakes up the Air Quality / Gas Sensor.
[in] | wake | Set true to wake up, false otherwise |
Definition at line 583 of file board.c.
References BOARD_PIC_REG_CCS_CTRL, BOARD_PIC_REG_CCS_CTRL_EN, BOARD_PIC_REG_CCS_CTRL_WAKE, and BOARD_picWriteReg().
Referenced by CCS811_deInit(), CCS811_getMeasurement(), CCS811_getRawData(), CCS811_init(), CCS811_readMailbox(), CCS811_setEnvData(), CCS811_setMeasureMode(), and CCS811_softwareReset().
uint32_t BOARD_imuEnable | ( | bool | enable | ) |
Enables or disables the accelerometer and gyroscope sensor.
[in] | enable | Set true to enable, false to disable |
Definition at line 448 of file board.c.
References BOARD_PIC_REG_IMU_CTRL, and BOARD_picWriteReg().
Referenced by ICM20648_deInit(), and ICM20648_init().
uint32_t BOARD_imuEnableIRQ | ( | bool | enable | ) |
Enables or disables the accelerometer and gyroscope GPIO interrupt.
[in] | enable | Set true to enable, false to disable |
Definition at line 469 of file board.c.
References BOARD_PIC_REG_INT_ENABLE, BOARD_PIC_REG_INT_ENABLE_IMU, and BOARD_picRegBitsSet().
Referenced by IMU_config().
uint32_t BOARD_init | ( | void | ) |
Initializes the Thunderboard Sense board.
Push button config
PIC Config
Wait for IO-expander to boot up
PIC default register content
RGBLED / LED config
Definition at line 90 of file board.c.
References BOARD_BUTTON_LEFT_PIN, BOARD_BUTTON_LEFT_PORT, BOARD_BUTTON_RIGHT_PIN, BOARD_BUTTON_RIGHT_PORT, BOARD_ERROR_PIC_ID_MISMATCH, BOARD_OK, BOARD_PIC_DEVICE_ID, BOARD_PIC_INT_WAKE_PIN, BOARD_PIC_INT_WAKE_PORT, BOARD_PIC_NUM_APP_REGS, BOARD_picGetDeviceId(), BOARD_picGetFwRevision(), BOARD_picWriteReg(), BOARD_RGBLED_BLUE_CCLOC, BOARD_RGBLED_BLUE_PIN, BOARD_RGBLED_BLUE_PORT, BOARD_RGBLED_CMU_CLK, BOARD_RGBLED_GREEN_CCLOC, BOARD_RGBLED_GREEN_PIN, BOARD_RGBLED_GREEN_PORT, BOARD_RGBLED_RED_CCLOC, BOARD_RGBLED_RED_PIN, BOARD_RGBLED_RED_PORT, BOARD_RGBLED_TIMER, CMU_ClockEnable(), cmuClock_GPIO, cmuClock_PRS, TIMER_Init_TypeDef::debugRun, GPIO_IntConfig(), GPIO_PinModeSet(), gpioModeInput, gpioModePushPull, gpioModeWiredAnd, I2CSPM_Init(), I2CSPM_INIT_DEFAULT, TIMER_InitCC_TypeDef::mode, I2CSPM_Init_TypeDef::port, TIMER_Init_TypeDef::prescale, PRS, PRS_CH_CTRL_SIGSEL_GPIOPIN10, PRS_CH_CTRL_SOURCESEL_GPIOH, PRS_SourceSignalSet(), prsEdgeOff, TIMER_Init(), TIMER_INIT_DEFAULT, TIMER_InitCC(), TIMER_INITCC_DEFAULT, TIMER_TopSet(), timerCCModePWM, timerPrescale2, and UTIL_delay().
void BOARD_ledSet | ( | uint8_t | leds | ) |
Turns on or off the red and/or green LED.
[in] | leds | The two LSB bits determine the state of the green and red LED. If the bit is 1 then the LED will be turned on. |
Definition at line 343 of file board.c.
References BOARD_RGBLED_GREEN_PIN, BOARD_RGBLED_RED_PIN, BOARD_RGBLED_RED_PORT, BOARD_rgbledEnable(), BOARD_rgbledSetRawColor(), GPIO_PinOutClear(), and GPIO_PinOutSet().
Referenced by BOARD_rgbledSetRawColor().
uint32_t BOARD_micEnable | ( | bool | enable | ) |
Enables or disables the MEMS microphone.
[in] | enable | Set true to enable, false to disable |
Definition at line 536 of file board.c.
References BOARD_PIC_REG_MIC_CTRL, and BOARD_picWriteReg().
Referenced by MIC_deInit(), and MIC_init().
uint32_t BOARD_picGetDeviceId | ( | void | ) |
Reads the device ID of the IO expander.
Definition at line 766 of file board.c.
References BOARD_PIC_REG_DEVICE_ID0, BOARD_PIC_REG_DEVICE_ID1, BOARD_PIC_REG_DEVICE_ID2, BOARD_PIC_REG_DEVICE_ID3, and BOARD_picReadReg().
Referenced by BOARD_init().
uint32_t BOARD_picGetFwRevision | ( | uint8_t * | major, |
uint8_t * | minor, | ||
uint8_t * | patch | ||
) |
Reads the firmware revision of the IO expander.
[out] | major | The major version number of the firmware |
[out] | minor | The minor version number of the firmware |
[out] | patch | The patch version number of the firmware |
Definition at line 817 of file board.c.
References BOARD_OK, BOARD_PIC_INT_WAKE_PIN, BOARD_PIC_INT_WAKE_PORT, BOARD_PIC_REG_VERSION_MAJOR, BOARD_PIC_REG_VERSION_MINOR, BOARD_PIC_REG_VERSION_PATCH, GPIO_IntClear(), GPIO_IntDisable(), GPIO_IntEnable(), GPIO_PinOutClear(), and GPIO_PinOutSet().
Referenced by BOARD_init().
uint8_t BOARD_picGetHwRevision | ( | void | ) |
Reads the hardware revision of the IO expander.
Definition at line 790 of file board.c.
References BOARD_PIC_REG_BOARD_REV, and BOARD_picReadReg().
uint32_t BOARD_picIntClear | ( | uint8_t | flags | ) |
Clears the interrupt status flags in the interrupt controller.
[out] | flags | Holds the flags that indicate which events have taken place |
Definition at line 652 of file board.c.
References BOARD_PIC_REG_INT_CLEAR, and BOARD_picWriteReg().
uint32_t BOARD_picIntGet | ( | uint8_t * | flags | ) |
Reads the interrupt status flags from the interrupt controller.
[out] | flags | Holds the flags that indicate which events have taken place |
Definition at line 631 of file board.c.
References BOARD_PIC_REG_INT_FLAG, and BOARD_picReadReg().
bool BOARD_picIsLegacyIntCtrl | ( | void | ) |
Checks if the legacy interrupt control method should be used.
Definition at line 857 of file board.c.
Referenced by IMU_clearDataReadyFlag(), and IMU_isDataReadyFlag().
uint32_t BOARD_picReadReg | ( | uint8_t | reg, |
uint8_t * | result | ||
) |
Reads a register in the IO expander.
[in] | reg | The register address to read |
[out] | result | The data read from the device |
Definition at line 702 of file board.c.
Referenced by BOARD_picGetDeviceId(), BOARD_picGetHwRevision(), and BOARD_picIntGet().
uint32_t BOARD_picRegBitsSet | ( | uint8_t | addr, |
bool | set, | ||
uint8_t | bitMask | ||
) |
Sets the given bit(s) in a register in the IO expander.
[in] | addr | The address of the register |
[in] | set | Specifies whether the bits selected by the mask should be set or cleared |
[in] | bitMask | The mask specifies which bits should be changed |
Definition at line 731 of file board.c.
References BOARD_OK.
Referenced by BOARD_envSensEnableIRQ(), BOARD_gasSensorEnableIRQ(), BOARD_imuEnableIRQ(), BOARD_rgbledEnable(), and BOARD_rgbledPowerEnable().
uint32_t BOARD_picWriteReg | ( | uint8_t | reg, |
uint8_t | value | ||
) |
Writes a register in the IO expander.
[in] | reg | The register address to write |
[in] | value | The data to write to the register |
Definition at line 676 of file board.c.
Referenced by BOARD_envSensEnable(), BOARD_gasSensorEnable(), BOARD_gasSensorWake(), BOARD_imuEnable(), BOARD_init(), BOARD_micEnable(), BOARD_picIntClear(), IMU_clearDataReadyFlag(), and IMU_config().
void BOARD_pushButtonEnableIRQ | ( | bool | enable | ) |
Enables or disables the pushbutton GPIO interrupt.
[in] | enable | Set true to enable, false to disable the pushbutton interrupts |
Definition at line 277 of file board.c.
References BOARD_BUTTON_LEFT_PIN, BOARD_BUTTON_PORT, BOARD_BUTTON_RIGHT_PIN, and GPIO_IntConfig().
uint8_t BOARD_pushButtonGetState | ( | void | ) |
Gets the state of the pushbuttons.
Definition at line 252 of file board.c.
References BOARD_BUTTON_MASK, BOARD_BUTTON_PORT, BOARD_BUTTON_SHIFT, and GPIO_PortInGet().
void BOARD_rgbledEnable | ( | bool | enable, |
uint8_t | mask | ||
) |
Enables or disables the RGB LED power supply line.
[in] | enable | Set true to enable, false to disable |
[in] | mask | Mask indicating which bits to modify |
Definition at line 317 of file board.c.
References BOARD_PIC_REG_LED_CTRL, BOARD_PIC_REG_LED_CTRL_LED_MASK, BOARD_PIC_REG_LED_CTRL_LED_SHIFT, BOARD_picRegBitsSet(), and BOARD_rgbledPowerEnable().
Referenced by BOARD_ledSet().
void BOARD_rgbledPowerEnable | ( | bool | enable | ) |
Enables or disables the RGB LED power supply line.
[in] | enable | Set true to enable, false to disable |
Definition at line 295 of file board.c.
References BOARD_PIC_REG_LED_CTRL, BOARD_PIC_REG_LED_CTRL_PWR_EN, and BOARD_picRegBitsSet().
Referenced by BOARD_rgbledEnable().
void BOARD_rgbledSetColor | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue | ||
) |
Sets the color of the RGB LEDs. The brightness of the LEDs is almost linear to the color value.
[in] | red | An 8-bit value, which determines the brightness of the red channel |
[in] | green | An 8-bit value, which determines the brightness of the green channel |
[in] | blue | An 8-bit value, which determines the brightness of the blue channel |
Definition at line 427 of file board.c.
References BOARD_rgbledSetRawColor().
void BOARD_rgbledSetRawColor | ( | uint16_t | red, |
uint16_t | green, | ||
uint16_t | blue | ||
) |
Sets the raw color of the RGB LEDs. The brightness is non-linear function of the raw color value.
[in] | red | A 16-bit value, which determines the PWM value of the red channel |
[in] | green | A 16-bit value, which determines the PWM value of the green channel |
[in] | blue | A 16-bit value, which determines the PWM value of the blue channel |
Definition at line 384 of file board.c.
References BOARD_ledSet(), TIMER_CompareBufSet(), and TIMER_Enable().
Referenced by BOARD_ledSet(), and BOARD_rgbledSetColor().