-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: sensor: tmp1075: Add tmp1075 sensor driver and sample #75324
base: main
Are you sure you want to change the base?
drivers: sensor: tmp1075: Add tmp1075 sensor driver and sample #75324
Conversation
Hello @Paplewski, and thank you very much for your first pull request to the Zephyr project! |
26bf12a
to
d9d4f86
Compare
d9d4f86
to
05dca23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Please use the existing samples/sensor/thermometer
instead of introducing a driver-specific sample.
drivers/sensor/ti/tmp1075/tmp1075.c
Outdated
const struct gpio_dt_spec *alert_gpio = &config->alert_gpio; | ||
int result; | ||
|
||
if (!device_is_ready(alert_gpio->port)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use gpio_is_ready_dt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
drivers/sensor/ti/tmp1075/tmp1075.c
Outdated
} | ||
#endif | ||
|
||
int tmp1075_init(const struct device *dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int tmp1075_init(const struct device *dev) | |
static int tmp1075_init(const struct device *dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
drivers/sensor/ti/tmp1075/tmp1075.c
Outdated
const struct tmp1075_config *cfg = dev->config; | ||
struct tmp1075_data *data = dev->data; | ||
|
||
if (!device_is_ready(cfg->bus.bus)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use i2c_is_ready_dt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
if (trig->type == SENSOR_TRIG_THRESHOLD) { | ||
drv_data->temp_alert_handler = handler; | ||
drv_data->temp_alert_trigger = *trig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save the address of the trigger, not a copy of the trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
dts/bindings/sensor/ti,tmp1075.yaml
Outdated
conversion-rate: | ||
description: Conversion rate in ms. | ||
type: int | ||
default: 220 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explain in the description why the default value was selected
https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#dt-bindings-default-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed default value and updated overlay file
dts/bindings/sensor/ti,tmp1075.yaml
Outdated
type: int | ||
default: 220 | ||
enum: | ||
- 275 # 27.5ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to microseconds
dts/bindings/sensor/ti,tmp1075.yaml
Outdated
consecutive-fault-measurements: | ||
description: Number of consecutive measured faults that will trigger the alert. | ||
type: int | ||
default: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explain in the description why the default value was selected
https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#dt-bindings-default-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed default value and updated overlay file
dts/bindings/sensor/ti,tmp1075.yaml
Outdated
lower-threshold: | ||
description: Lower threshold for alert interrupt. Expressed in degrees C. | ||
type: int | ||
default: 28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explain in the description why the default value was selected
https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#dt-bindings-default-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed default value and updated overlay file
dts/bindings/sensor/ti,tmp1075.yaml
Outdated
upper-threshold: | ||
description: Upper threshold for alert interrupt. Expressed in degrees C. | ||
type: int | ||
default: 29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explain in the description why the default value was selected
https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#dt-bindings-default-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed default value and updated overlay file
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
9c8c2a9
to
56d2a04
Compare
TI tmp1075 driver implemented based on tmp108 driver. The driver initializes the sensor based on the DTS. Added tmp1075 example overlay file to thermometer sample. All you need to do to use the sensor is to connect the I2C and optionally interrupt line. To see default DTS configuration option inspect `ti,tmp1075.yaml` bindings file and sensor spec. Signed-off-by: Paweł Czaplewski <[email protected]>
56d2a04
to
b0f64dd
Compare
@@ -1113,3 +1113,14 @@ test_i2c_mmc56x3: mmc56x3@92 { | |||
magn-odr = <0>; | |||
auto-self-reset; | |||
}; | |||
|
|||
test_i2c_tmp1075: tmp1075@91 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The address should be 0x98. The previous node is incorrect and should be 0x97, but that can be fixed in a separate patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated both addresses in a separate commit
Fixed incorrect I2C register definitions in the test file tests/drivers/build_all/sensor/i2c.dtsi. Signed-off-by: Paweł Czaplewski <[email protected]>
5e0cf57
to
9883b24
Compare
TI tmp1075 driver implemented based on tmp108 driver. The driver initializes the sensor based on the DTS. See sample app.overlay.
Added sample to show example driver usage.
To see default DTS configuration option inspect
ti,tmp1075.yaml
bindings file.