First Publish. Works fine.

Dependents:   unzen_sample_lpcxpresso_4337_callbacks

Committer:
shorie
Date:
Sun Apr 10 12:37:10 2016 +0000
Revision:
0:5ac19c994288
Child:
1:9710fb328a08
HAL stable : considered STM32F4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shorie 0:5ac19c994288 1 #ifndef _UNZEN_HAL_H_
shorie 0:5ac19c994288 2 #define _UNZEN_HAL_H_
shorie 0:5ac19c994288 3
shorie 0:5ac19c994288 4 #include "mbed.h"
shorie 0:5ac19c994288 5
shorie 0:5ac19c994288 6 namespace unzen
shorie 0:5ac19c994288 7 {
shorie 0:5ac19c994288 8 // Set up I2S peripheral to ready to start.
shorie 0:5ac19c994288 9 // By this HAL, the I2S have to become :
shorie 0:5ac19c994288 10 // - slave mode
shorie 0:5ac19c994288 11 // - clock must be ready
shorie 0:5ac19c994288 12 // - pins must be configured.
shorie 0:5ac19c994288 13 // - Interrupt enable.
shorie 0:5ac19c994288 14 void hal_i2s_setup();
shorie 0:5ac19c994288 15
shorie 0:5ac19c994288 16 // Start I2S transfer. Interrupt starts
shorie 0:5ac19c994288 17 void hal_i2s_start();
shorie 0:5ac19c994288 18
shorie 0:5ac19c994288 19 IRQn_Type hal_get_i2s_irq_id();
shorie 0:5ac19c994288 20 IRQn_Type hal_get_process_irq_id();
shorie 0:5ac19c994288 21
shorie 0:5ac19c994288 22 // The returned value must be compatible with CMSIS NVIC_SetPriority() API.
shorie 0:5ac19c994288 23 unsigned int hal_get_lowest_priority_level();
shorie 0:5ac19c994288 24
shorie 0:5ac19c994288 25 // reutun the intenger value which tells how much data have to be transfered for each
shorie 0:5ac19c994288 26 // interrupt. For example, if the stereo 32bit data ( total 64 bit ) have to be sent,
shorie 0:5ac19c994288 27 // have to return 2.
shorie 0:5ac19c994288 28 // The special case is when the word needs to transmit by multiple interrupt,
shorie 0:5ac19c994288 29 // must return 0.
shorie 0:5ac19c994288 30 unsigned int hal_data_per_sample();
shorie 0:5ac19c994288 31
shorie 0:5ac19c994288 32 // return true when the sample parameter is ready to read.
shorie 0:5ac19c994288 33 // return false when the sample is not ready to read.
shorie 0:5ac19c994288 34 bool hal_get_i2s_rx_data( int & sample);
shorie 0:5ac19c994288 35
shorie 0:5ac19c994288 36 // return true when the sample was completely stored to send.
shorie 0:5ac19c994288 37 // return false when the same sample is required next time.
shorie 0:5ac19c994288 38 bool hal_set_i2s_tx_data( int sample );
shorie 0:5ac19c994288 39 }
shorie 0:5ac19c994288 40
shorie 0:5ac19c994288 41
shorie 0:5ac19c994288 42 #endif