diff options
Diffstat (limited to 'os/hal/include/hal_i2s.h')
-rw-r--r-- | os/hal/include/hal_i2s.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/os/hal/include/hal_i2s.h b/os/hal/include/hal_i2s.h index 9811423f5..1dccaaa1e 100644 --- a/os/hal/include/hal_i2s.h +++ b/os/hal/include/hal_i2s.h @@ -76,10 +76,8 @@ typedef struct hal_i2s_config I2SConfig; * @brief I2S notification callback type.
*
* @param[in] i2sp pointer to the @p I2SDriver object
- * @param[in] offset offset in buffers of the data to read/write
- * @param[in] n number of samples to read/write
*/
-typedef void (*i2scallback_t)(I2SDriver *i2sp, size_t offset, size_t n);
+typedef void (*i2scallback_t)(I2SDriver *i2sp);
/* Including the low level driver header, it exports information required
for completing types.*/
@@ -136,6 +134,21 @@ struct hal_i2s_config { * @{
*/
/**
+ * @brief Buffer state.
+ * @note This function is meant to be called from the SPI callback only.
+ *
+ * @param[in] i2sp pointer to the @p I2SDriver object
+ * @return The buffer state.
+ * @retval false if the driver filled/sent the first half of the
+ * buffer.
+ * @retval true if the driver filled/sent the second half of the
+ * buffer.
+ *
+ * @special
+ */
+#define i2sIsBufferComplete(i2sp) ((bool)((i2sp)->state == I2S_COMPLETE))
+
+/**
* @brief Starts a I2S data exchange.
*
* @param[in] i2sp pointer to the @p I2SDriver object
@@ -175,7 +188,7 @@ struct hal_i2s_config { */
#define _i2s_isr_half_code(i2sp) { \
if ((i2sp)->config->end_cb != NULL) { \
- (i2sp)->config->end_cb(i2sp, 0, (i2sp)->config->size / 2); \
+ (i2sp)->config->end_cb(i2sp); \
} \
}
@@ -195,9 +208,7 @@ struct hal_i2s_config { #define _i2s_isr_full_code(i2sp) { \
if ((i2sp)->config->end_cb) { \
(i2sp)->state = I2S_COMPLETE; \
- (i2sp)->config->end_cb(i2sp, \
- (i2sp)->config->size / 2, \
- (i2sp)->config->size / 2); \
+ (i2sp)->config->end_cb(i2sp); \
if ((i2sp)->state == I2S_COMPLETE) { \
(i2sp)->state = I2S_ACTIVE; \
} \
|