"encourage" people to check the status return value

This commit is contained in:
Kilian Bracher 2024-06-27 16:27:21 +02:00
parent 67983c1c98
commit 79ec05479d
Signed by: k.bracher
SSH Key Fingerprint: SHA256:mXpyZkK7RDiJ7qeHCKJX108woM0cl5TrCvNBJASu6lM
2 changed files with 16 additions and 12 deletions

View File

@ -252,14 +252,14 @@ static uint8_t crc8;
//
static bool OWReset() {
bool presence;
ds2482_1w_reset(&presence);
(void)ds2482_1w_reset(&presence);
return presence;
}
//--------------------------------------------------------------------------
// Send 8 bits of data to the 1-Wire bus
//
static inline void OWWriteByte(uint8_t byte_value) { ds2482_1w_write_byte(byte_value); }
static inline void OWWriteByte(uint8_t byte_value) { (void)ds2482_1w_write_byte(byte_value); }
//--------------------------------------------------------------------------
// Send 1 bit of data to teh 1-Wire bus

View File

@ -17,16 +17,20 @@
#define DS2482_TIMEOUT_1W 100
#define DS2482_TIMEOUT_I2C 100
HAL_StatusTypeDef ds2482_init(I2C_HandleTypeDef* handle);
HAL_StatusTypeDef ds2482_reset();
HAL_StatusTypeDef ds2482_write_config(uint8_t config);
HAL_StatusTypeDef ds2482_set_read_ptr(uint8_t read_ptr);
HAL_StatusTypeDef ds2482_1w_reset(bool* presence);
HAL_StatusTypeDef ds2482_1w_write_byte(uint8_t byte);
HAL_StatusTypeDef ds2482_1w_read_byte(uint8_t* byte);
HAL_StatusTypeDef ds2482_1w_triplet(uint8_t dir);
HAL_StatusTypeDef ds2482_1w_search(uint16_t max_devices, uint64_t devices[static max_devices]);
HAL_StatusTypeDef ds2482_1w_verify_device(uint64_t device, bool* present);
#define nag_attr [[nodiscard("Check status for errors!")]]
nag_attr HAL_StatusTypeDef ds2482_init(I2C_HandleTypeDef* handle);
nag_attr HAL_StatusTypeDef ds2482_reset();
nag_attr HAL_StatusTypeDef ds2482_write_config(uint8_t config);
nag_attr HAL_StatusTypeDef ds2482_set_read_ptr(uint8_t read_ptr);
nag_attr HAL_StatusTypeDef ds2482_1w_reset(bool* presence);
nag_attr HAL_StatusTypeDef ds2482_1w_write_byte(uint8_t byte);
nag_attr HAL_StatusTypeDef ds2482_1w_read_byte(uint8_t* byte);
nag_attr HAL_StatusTypeDef ds2482_1w_triplet(uint8_t dir);
nag_attr HAL_StatusTypeDef ds2482_1w_search(uint16_t max_devices, uint64_t devices[static max_devices]);
nag_attr HAL_StatusTypeDef ds2482_1w_verify_device(uint64_t device, bool* present);
#endif // DS2482_HAL_H