samples: sensor: hts221: Convert to use DEVICE_DT_GET_ONE
Move to use DEVICE_DT_GET_ONE instead of device_get_binding. This is more generic than the hardcoded string that was being used. Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
parent
0f90e8ed58
commit
3a223bc45b
@ -48,10 +48,10 @@ static void hts221_handler(const struct device *dev,
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const struct device *dev = device_get_binding("HTS221");
|
||||
const struct device *dev = DEVICE_DT_GET_ONE(st_hts221);
|
||||
|
||||
if (dev == NULL) {
|
||||
printf("Could not get HTS221 device\n");
|
||||
if (!device_is_ready(dev)) {
|
||||
printk("sensor: device not ready.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user