@@ -157,16 +157,16 @@ struct StatusFlags
157
157
{
158
158
// starting with bit 0 at the top...
159
159
// / Signifies that the TX FIFO is fully occupied.
160
- bool tx_full () const ;
160
+ const bool tx_full () const ;
161
161
// / @brief Represents the pipe number that received the first available payload in the RX FIFO.
162
162
// / @remark This data shall be considered invalid if the @ref StatusFlags::rx_dr flag is `false`.
163
- uint8_t rx_pipe () const ;
163
+ const uint8_t rx_pipe () const ;
164
164
// / Represents an event where TX Data Failed to send.
165
- bool tx_df () const ;
165
+ const bool tx_df () const ;
166
166
// / Represents an event where TX Data Sent successfully.
167
- bool tx_ds () const ;
167
+ const bool tx_ds () const ;
168
168
// / Represents an event where RX Data is Ready to `RF24::read()`.
169
- bool rx_dr () const ;
169
+ const bool rx_dr () const ;
170
170
171
171
/* *
172
172
* @brief Convert this struct to a human understandable string.
@@ -208,8 +208,7 @@ struct StatusFlags
208
208
StatusFlags (uint8_t bits) : value(bits) {};
209
209
210
210
private:
211
- friend class RF24 ;
212
- uint8_t value;
211
+ const uint8_t value;
213
212
};
214
213
215
214
/* *
@@ -1263,51 +1262,36 @@ class RF24
1263
1262
void whatHappened (bool & tx_ok, bool & tx_fail, bool & rx_ready);
1264
1263
1265
1264
/* *
1266
- * Clear all of the StatusFlags that caused an interrupt event.
1265
+ * Clear the StatusFlags that caused an interrupt event.
1267
1266
*
1268
1267
* @remark This function is similar to `whatHappened()` because it also returns the
1269
1268
* StatusFlags that caused the interrupt event. However, this function returns
1270
- * a 1-byte bit-field struct (@ref StatusFlags) instead of bit-banging 3 1-byte booleans
1269
+ * a 1-byte struct (@ref StatusFlags) instead of bit-banging 3 1-byte booleans
1271
1270
* passed by reference.
1272
1271
*
1273
1272
* @note When used in an ISR (Interrupt Service routine), there is a chance that the
1274
- * @ref StatusFlags::rx_pipe information is inaccurate. See available(uint8_t*) (or the
1273
+ * @ref StatusFlags::rx_pipe() information is inaccurate. See available(uint8_t*) (or the
1275
1274
* datasheet) for more detail.
1276
1275
*
1277
- * @ingroup StatusFlags
1278
- */
1279
- StatusFlags clearStatusFlags ();
1280
-
1281
- /* *
1282
- * Clear the specified flags.
1283
- *
1284
- * If any of the following flags are `true`, then the flag will be reset:
1285
- *
1286
- * - @ref StatusFlags::rx_dr
1287
- * - @ref StatusFlags::tx_ds
1288
- * - @ref StatusFlags::tx_df
1276
+ * @param flags The IRQ flags to clear. Default value is all of them (@ref RF24_IRQ_ALL).
1277
+ * Multiple flags can be cleared by OR-ing @ref rf24_irq_flags_e values together.
1289
1278
*
1290
1279
* @ingroup StatusFlags
1291
1280
*/
1292
- void clearStatusFlags (StatusFlags& flags);
1281
+ uint8_t clearStatusFlags (uint8_t flags = RF24_IRQ_ALL );
1293
1282
1294
1283
/* *
1295
1284
* Set which flags shall be reflected on the radio's IRQ pin.
1296
1285
*
1297
- * This is similar to maskIRQ(), but with a more intuitive API.
1298
- *
1299
- * @param flags The configuration of the StatusFlags to influence the radio's IRQ pin.
1300
- *
1301
- * If any of the following `flags` are `true`, then the flag's corresponding event will
1302
- * trigger the IRQ pin active HIGH:
1286
+ * This is similar to maskIRQ(), but with less confusing parameters.
1303
1287
*
1304
- * - @ref StatusFlags::rx_dr
1305
- * - @ref StatusFlags::tx_ds
1306
- * - @ref StatusFlags::tx_df
1288
+ * @param flags The value of @ref rf24_irq_flags_e to influence the radio's IRQ pin.
1289
+ * The default value `0` will disable the radio's IRQ pin.
1290
+ * Multiple events can be enabled by OR-ing @ref rf24_irq_flags_e values together.
1307
1291
*
1308
1292
* @ingroup StatusFlags
1309
1293
*/
1310
- void setStatusFlags (StatusFlags flags);
1294
+ void setStatusFlags (uint8_t flags = 0 );
1311
1295
1312
1296
/* *
1313
1297
* Get the latest STATUS byte returned from the last SPI transaction.
@@ -1323,7 +1307,7 @@ class RF24
1323
1307
*
1324
1308
* @ingroup StatusFlags
1325
1309
*/
1326
- void getStatusFlags (StatusFlags& flags );
1310
+ uint8_t getStatusFlags ();
1327
1311
1328
1312
/* *
1329
1313
* Get an updated STATUS byte from the radio.
@@ -1332,7 +1316,7 @@ class RF24
1332
1316
*
1333
1317
* @ingroup StatusFlags
1334
1318
*/
1335
- StatusFlags update ();
1319
+ uint8_t update ();
1336
1320
1337
1321
/* *
1338
1322
* Non-blocking write to the open writing pipe used for buffered writes
0 commit comments