configs/nucleo-l452re: Add buttons example
This commit is contained in:
parent
2c94eb1188
commit
0275c8e9c7
@ -168,7 +168,8 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
ssize_t nbytes;
|
||||
struct adc_msg_s sample[ADC1_NCHANNELS] = { 0 };
|
||||
int nsamples;
|
||||
int fd, ret, errval;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/adc0", O_RDONLY);
|
||||
if (fd < 0)
|
||||
@ -245,6 +246,7 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
tsense = (110 - 30) * (sample[i].am_data - STM32_TSENSE_TSCAL1)
|
||||
/ (STM32_TSENSE_TSCAL2 - STM32_TSENSE_TSCAL1) + 30;
|
||||
ainfo("TSENSE: %d -> %d °C\n", sample[i].am_data, tsense);
|
||||
UNUSED(tsense);
|
||||
break;
|
||||
|
||||
case ADC1_INTERNAL_VBATDIV3_CHANNEL:
|
||||
|
@ -43,7 +43,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/input/buttons.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/leds/userled.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32l4_i2c.h"
|
||||
#include "nucleo-l452re.h"
|
||||
@ -92,6 +97,24 @@ int stm32_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
#ifdef CONFIG_BUTTONS_LOWER
|
||||
iinfo("Initializing button driver\n");
|
||||
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#else
|
||||
/* Enable BUTTON support for some other purpose */
|
||||
|
||||
board_button_initialize();
|
||||
#endif
|
||||
#endif /* CONFIG_BUTTONS */
|
||||
|
||||
#ifdef HAVE_I2C_DRIVER
|
||||
/* Get the I2C lower half instance */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user