-
Notifications
You must be signed in to change notification settings - Fork 97
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
Can the ds18b20_device_t struct definition be moved from ds18b20.c to a header file ? (BSP-487) #323
Comments
@michal-olszanowski What information do you want to be exposed from the |
Yes, I'm looking for the device address. |
Related area
Component espressif/ds18b20
Hardware specification
esp32c3
Is your feature request related to a problem?
I'd like to use the ds18b20_device_hande_t type definition (the addr member) in my code, however, the struct is defined in .c and not .h:
ds18b20_device_handle_t sensor = ds18b20_sensors[i];
onewire_device_address_t address = sensor->addr;
ESP_LOGI( log_tag(), "Sensor %08" PRIx32 "%08" PRIx32 " (%s) reports %.3f°C",
(uint32_t)(address >> 32),
(uint32_t)address,
"DS18B20",
measured_temps[ i]);
The compiler is reporting:
C:/Users/m/Dev/esp/pump-driver/components/SensorService/SensorService.cpp:112:54: error: invalid use of incomplete type 'struct ds18b20_device_t'
112 | onewire_device_address_t address = sensor->addr;
| ^~
In file included from C:/Users/m/Dev/esp/pump-driver/components/SensorService/SensorService.h:14,
from C:/Users/m/Dev/esp/pump-driver/components/SensorService/SensorService.cpp:1:
C:/Users/m/Dev/esp/pump-driver/managed_components/espressif__ds18b20/include/ds18b20.h:19:16: note: forward declaration of 'struct ds18b20_device_t'
19 | typedef struct ds18b20_device_t *ds18b20_device_handle_t;
| ^~~~~~~~~~~~~~~~
Describe the solution you'd like
Add to ds18b20_types.h:
typedef struct ds18b20_device_t {
onewire_bus_handle_t bus;
onewire_device_address_t addr;
uint8_t th_user1;
uint8_t tl_user2;
ds18b20_resolution_t resolution;
} ds18b20_device_t;
Describe alternatives you've considered
I modifed the header locally in my project but would like to relay fully on the official ds18b20 component release. I do not know other workarounds, I'd appreciate any suggestions as an alternative.
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
The text was updated successfully, but these errors were encountered: