12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "ch.h"
- #include "hal.h"
- #define I2S_BUF_SIZE 256
- static uint16_t i2s_rx_buf[I2S_BUF_SIZE];
- static void i2scallback(I2SDriver *i2sp);
- static const I2SConfig i2scfg = {
- NULL,
- i2s_rx_buf,
- I2S_BUF_SIZE,
- i2scallback,
- 0,
- 16
- };
- static void i2scallback(I2SDriver *i2sp) {
- if (i2sIsBufferComplete(i2sp)) {
-
- }
- else {
-
- }
- }
- int main(void) {
-
- halInit();
- chSysInit();
-
- i2sStart(&I2SD2, &i2scfg);
- palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(5));
- palSetPadMode(GPIOC, 3, PAL_MODE_ALTERNATE(5));
-
- i2sStartExchange(&I2SD2);
-
- while (true) {
- if (palReadPad(GPIOA, GPIOA_BUTTON))
- i2sStopExchange(&I2SD2);
- chThdSleepMilliseconds(500);
- }
- return 0;
- }
|