Il y avait des problèmes dans la libraire...
Fork of ST_I2S by
Diff: drivers/I2S.h
- Revision:
- 4:21603d68bcf7
- Parent:
- 1:f90318e0923b
- Child:
- 9:c4c2240e06d6
--- a/drivers/I2S.h Wed Dec 14 14:23:12 2016 +0100 +++ b/drivers/I2S.h Wed Dec 21 20:24:16 2016 +0100 @@ -164,6 +164,17 @@ */ int set_dma_priority(i2s_dma_prio_t prio); + /** Harmonize the frequencies of the given I2S objects so that they are + * exact multiple one of the other. It can be useful whenever two I2S + * peripherals have to work together and no drift is allowed between them. + * + * @param dev_i2s_1 reference to the first I2S object. + * @param dev_i2s_2 reference to the second I2S object. + * @return Zero if the frequencies have been harmonized correctly, -1 + * otherwise. + */ + static int harmonize(I2S *dev_i2s_1, I2S *dev_i2s_2); + protected: /** I2S TX DMA IRQ handler * @@ -229,6 +240,31 @@ /* betzw - WAS : static */ CircularBuffer<Transaction<I2S>, TRANSACTION_QUEUE_SIZE_I2S> _transaction_buffer; #endif // TRANSACTION_QUEUE_SIZE_I2S + /** Compute the real frequency of a given I2S objects. + * + * @param dev_i2s reference to the I2S object. + * @return the computed real frequency. + */ + static float compute_real_frequency(I2S *dev_i2s); + + /** Computes the two-div-plus-odd factor of a given I2S objects + * on a desired frequency. + * + * @param dev_i2s reference to the I2S object. + * @frequency the desired frequency. + * @return the computed two-div-plus-odd factor. + */ + static float compute_magic_factor(I2S *dev_i2s, float f); + + /** Compute the desired frequency of a given I2S objects, given the magic + * factor. + * + * @param dev_i2s reference to the I2S object. + * @param mf the two-div-plus-odd factor. + * @return the computed desired frequency. + */ + static float compute_desired_frequency(I2S *dev_i2s, float mf); + public: virtual ~I2S() { /* betzw - TODO: cleanup has still to be revised completely! */