@@ -175,20 +175,32 @@ struct lorawan_downlink_cb {
175175};
176176
177177/**
178- * @brief Add battery level callback function.
178+ * @brief Defines the battery level callback handler function signature.
179+ *
180+ * @retval 0 if the node is connected to an external power source
181+ * @retval 1..254 battery level, where 1 is the minimum and 254 is the maximum value
182+ * @retval 255 if the node was not able to measure the battery level
183+ */
184+ typedef uint8_t (* lorawan_battery_level_cb_t )(void );
185+
186+ /**
187+ * @brief Defines the datarate changed callback handler function signature.
188+ *
189+ * @param dr Updated datarate.
190+ */
191+ typedef void (* lorawan_dr_changed_cb_t )(enum lorawan_datarate dr );
192+
193+ /**
194+ * @brief Register a battery level callback function.
179195 *
180196 * Provide the LoRaWAN stack with a function to be called whenever a battery
181- * level needs to be read. As per LoRaWAN specification the callback needs to
182- * return "0: node is connected to an external power source,
183- * 1..254: battery level, where 1 is the minimum and 254 is the maximum
184- * value,
185- * 255: the node was not able to measure the battery level"
197+ * level needs to be read.
186198 *
187199 * Should no callback be provided the lorawan backend will report 255.
188200 *
189- * @param battery_lvl_cb Pointer to the battery level function
201+ * @param cb Pointer to the battery level function
190202 */
191- void lorawan_register_battery_level_callback (uint8_t ( * battery_lvl_cb )( void ) );
203+ void lorawan_register_battery_level_callback (lorawan_battery_level_cb_t cb );
192204
193205/**
194206 * @brief Register a callback to be run on downlink packets
@@ -203,12 +215,9 @@ void lorawan_register_downlink_callback(struct lorawan_downlink_cb *cb);
203215 * The callback is called once upon successfully joining a network and again
204216 * each time the datarate changes due to ADR.
205217 *
206- * The callback function takes one parameter:
207- * - dr - updated datarate
208- *
209- * @param dr_cb Pointer to datarate update callback
218+ * @param cb Pointer to datarate update callback
210219 */
211- void lorawan_register_dr_changed_callback (void ( * dr_cb )( enum lorawan_datarate ) );
220+ void lorawan_register_dr_changed_callback (lorawan_dr_changed_cb_t cb );
212221
213222/**
214223 * @brief Join the LoRaWAN network
0 commit comments