forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LTD noup] sensor: add stub STM32F401x temperature driver
The next patch will fill in the necessary functionality. Signed-off-by: Marti Bolivar <[email protected]>
- Loading branch information
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Kconfig - STM32F401x temperature sensor configuration options | ||
|
||
# | ||
# Copyright (c) 2016 ARM Ltd. | ||
# Copyright (c) 2017 Linaro Limited. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
menuconfig TEMP_STM32F401X | ||
bool | ||
prompt "STM32F401x Temperature Sensor" | ||
depends on SENSOR && SOC_SERIES_STM32F4X | ||
default n | ||
help | ||
Enable driver for STM32F401x temperature sensor. | ||
|
||
config TEMP_STM32F401X_NAME | ||
string | ||
prompt "Driver name" | ||
default "TEMP_0" | ||
depends on TEMP_STM32F401X | ||
help | ||
Device name with which the STM32F401x temperature sensor is identified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
obj-$(CONFIG_TEMP_STM32F401X) += temp_stm32f401x.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2017 Linaro Limited | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Temperature sensor driver for STM32F401x chips. | ||
* | ||
* @warning Temperature readings should be use for RELATIVE | ||
* TEMPERATURE CHANGES ONLY. | ||
* | ||
* Inter-chip temperature sensor readings may vary by as much | ||
* as 45 degrees C. | ||
*/ | ||
|
||
#include <device.h> | ||
#include <sensor.h> | ||
|
||
/* TODO */ | ||
static int temp_stm32f401x_sample_fetch(struct device *dev, | ||
enum sensor_channel chan) | ||
{ | ||
return 0; | ||
} | ||
|
||
/* TODO */ | ||
static int temp_stm32f401x_channel_get(struct device *dev, | ||
enum sensor_channel chan, | ||
struct sensor_value *val) | ||
{ | ||
val->val1 = 0; | ||
val->val2 = 0; | ||
return 0; | ||
} | ||
|
||
static const struct sensor_driver_api temp_stm32f401x_driver_api = { | ||
.sample_fetch = temp_stm32f401x_sample_fetch, | ||
.channel_get = temp_stm32f401x_channel_get, | ||
}; | ||
|
||
/* TODO */ | ||
static int temp_stm32f401x_init(struct device *dev) | ||
{ | ||
return 0; | ||
} | ||
|
||
DEVICE_AND_API_INIT(temp_stm32f401x, CONFIG_TEMP_STM32F401X_NAME, | ||
temp_stm32f401x_init, NULL, NULL, POST_KERNEL, | ||
CONFIG_SENSOR_INIT_PRIORITY, &temp_stm32f401x_driver_api); |