diff options
Diffstat (limited to 'zephyr/test')
-rw-r--r-- | zephyr/test/drivers/src/temp_sensor.c | 4 | ||||
-rw-r--r-- | zephyr/test/drivers/src/thermistor.c | 14 | ||||
-rw-r--r-- | zephyr/test/i2c_dts/src/main.c | 10 |
3 files changed, 14 insertions, 14 deletions
diff --git a/zephyr/test/drivers/src/temp_sensor.c b/zephyr/test/drivers/src/temp_sensor.c index 2e25bab67a..7cfc40b9d5 100644 --- a/zephyr/test/drivers/src/temp_sensor.c +++ b/zephyr/test/drivers/src/temp_sensor.c @@ -19,7 +19,7 @@ #define GPIO_PG_EC_DSW_PWROK_PATH DT_PATH(named_gpios, pg_ec_dsw_pwrok) #define GPIO_PG_EC_DSW_PWROK_PORT DT_GPIO_PIN(GPIO_PG_EC_DSW_PWROK_PATH, gpios) -#define ADC_DEVICE_NAME DT_LABEL(DT_NODELABEL(adc0)) +#define ADC_DEVICE_NODE DT_NODELABEL(adc0) #define ADC_CHANNELS_NUM DT_PROP(DT_NODELABEL(adc0), nchannels) /** Test error code when invalid sensor is passed to temp_sensor_read() */ @@ -96,7 +96,7 @@ static void check_valid_temperature(const struct device *adc_dev, int sensor) /** Test if temp_sensor_read() returns temperature on success */ static void test_temp_sensor_read(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); int chan; zassert_not_null(adc_dev, "Cannot get ADC device"); diff --git a/zephyr/test/drivers/src/thermistor.c b/zephyr/test/drivers/src/thermistor.c index 621cdfaa68..f6e3b5f732 100644 --- a/zephyr/test/drivers/src/thermistor.c +++ b/zephyr/test/drivers/src/thermistor.c @@ -17,7 +17,7 @@ #define GPIO_PG_EC_DSW_PWROK_PATH DT_PATH(named_gpios, pg_ec_dsw_pwrok) #define GPIO_PG_EC_DSW_PWROK_PORT DT_GPIO_PIN(GPIO_PG_EC_DSW_PWROK_PATH, gpios) -#define ADC_DEVICE_NAME DT_LABEL(DT_NODELABEL(adc0)) +#define ADC_DEVICE_NODE DT_NODELABEL(adc0) #define TEMP_3V3_13K7_47K_4050B_INST DT_INST(0, temp_3v3_13k7_47k_4050b) #define ADC_CHANNEL_3V3_13K7_47K_4050B \ @@ -46,7 +46,7 @@ static void test_thermistor_power_pin(void) { const struct device *gpio_dev = DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_PG_EC_DSW_PWROK_PATH, gpios)); - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); int temp; zassert_not_null(gpio_dev, "Cannot get GPIO device"); @@ -122,7 +122,7 @@ static int adc_error_func(const struct device *dev, unsigned int channel, /** Test if get temp function return expected error on ADC malfunction */ static void test_thermistor_adc_read_error(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); int temp; zassert_not_null(adc_dev, "Cannot get ADC device"); @@ -230,7 +230,7 @@ static int adc_temperature_func(const struct device *dev, unsigned int channel, /** Test conversion from ADC raw value to temperature */ static void test_thermistor_3v3_13k7_47k_4050b(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); struct thermistor_state state = { .v = 3300, .r = 13700, @@ -281,7 +281,7 @@ static void test_thermistor_3v3_13k7_47k_4050b(void) /** Test conversion from ADC raw value to temperature */ static void test_thermistor_3v3_30k9_47k_4050b(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); struct thermistor_state state = { .v = 3300, .r = 30900, @@ -332,7 +332,7 @@ static void test_thermistor_3v3_30k9_47k_4050b(void) /** Test conversion from ADC raw value to temperature */ static void test_thermistor_3v3_51k1_47k_4050b(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); struct thermistor_state state = { .v = 3300, .r = 51100, @@ -383,7 +383,7 @@ static void test_thermistor_3v3_51k1_47k_4050b(void) /** Test conversion from ADC raw value to temperature */ static void test_thermistor_3v0_22k6_47k_4050b(void) { - const struct device *adc_dev = device_get_binding(ADC_DEVICE_NAME); + const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE); struct thermistor_state state = { .v = 3000, .r = 22600, diff --git a/zephyr/test/i2c_dts/src/main.c b/zephyr/test/i2c_dts/src/main.c index 359808776b..ccd58dde67 100644 --- a/zephyr/test/i2c_dts/src/main.c +++ b/zephyr/test/i2c_dts/src/main.c @@ -9,11 +9,11 @@ static void test_i2c_get_device(void) { - const struct device *accel0 = device_get_binding( - DT_PROP_BY_PHANDLE(DT_PATH(named_i2c_ports, accel_0), i2c_port, - label)); - const struct device *bmi_i2c = device_get_binding( - DT_LABEL(DT_NODELABEL(bmi_i2c))); + const struct device *accel0 = DEVICE_DT_GET( + DT_PHANDLE(DT_PATH(named_i2c_ports, accel_0), + i2c_port)); + const struct device *bmi_i2c = DEVICE_DT_GET( + DT_NODELABEL(bmi_i2c)); zassert_not_null(accel0, "accel0 was NULL"); zassert_not_null(bmi_i2c, "bmi_i2c was NULL"); |