Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_dac

Driver for DAC. More...

Data Structures

struct  bc_dac_config_t
 DAC channel event. More...
 

Enumerations

enum  bc_dac_channel_t {
  BC_DAC_DAC0 = 0,
  BC_DAC_DAC1 = 1
}
 DAC channel. More...
 
enum  bc_dac_format_t {
  BC_DAC_FORMAT_8_BIT = 0,
  BC_DAC_FORMAT_16_BIT = 1,
  BC_DAC_FORMAT_VOLTAGE = 2
}
 Raw value format. More...
 
enum  bc_dac_sample_rate_t {
  BC_DAC_SAMPLE_RATE_8K = 0,
  BC_DAC_SAMPLE_RATE_16K = 1
}
 Sample rate. More...
 
enum  bc_dac_data_size_t {
  BC_DAC_DATA_SIZE_8 = 0,
  BC_DAC_DATA_SIZE_16 = 1
}
 Data size. More...
 
enum  bc_dac_mode_t {
  BC_DAC_MODE_SINGLE = 0,
  BC_DAC_MODE_CIRCULAR = 1
}
 Mode. More...
 
enum  bc_dac_event_t {
  BC_DAC_EVENT_HALF_DONE = 0,
  BC_DAC_EVENT_DONE = 1
}
 DAC channel event. More...
 

Functions

void bc_dac_init (bc_dac_channel_t channel)
 Initialize DAC channel. More...
 
void bc_dac_deinit (bc_dac_channel_t channel)
 Deitialize DAC channel. More...
 
void bc_dac_set_output (bc_dac_channel_t channel, const void *raw, bc_dac_format_t format)
 Set DAC channel output as raw value. More...
 
void bc_dac_set_event_handler (bc_dac_channel_t channel, void(*event_handler)(bc_dac_channel_t, bc_dac_event_t, void *), void *event_param)
 Set callback function. More...
 
bool bc_dac_async_config (bc_dac_channel_t channel, bc_dac_config_t *config)
 Configure image of DAC DMA channel. More...
 
bool bc_dac_async_run (bc_dac_channel_t channel)
 Start asynchronous DAC channel operation. More...
 
void bc_dac_async_stop (bc_dac_channel_t channel)
 Stop asynchronous DAC channel operation. More...
 

Detailed Description

Driver for DAC.

Enumeration Type Documentation

DAC channel.

Enumerator
BC_DAC_DAC0 

DAC channel DAC0.

BC_DAC_DAC1 

DAC channel DAC1.

Definition at line 13 of file bc_dac.h.

Data size.

Enumerator
BC_DAC_DATA_SIZE_8 

Data size is 8b.

BC_DAC_DATA_SIZE_16 

Data size is 16b.

Definition at line 52 of file bc_dac.h.

DAC channel event.

Enumerator
BC_DAC_EVENT_HALF_DONE 

Event is done.

BC_DAC_EVENT_DONE 

Event is done.

Definition at line 76 of file bc_dac.h.

Raw value format.

Enumerator
BC_DAC_FORMAT_8_BIT 

Raw value format is 8-bit.

BC_DAC_FORMAT_16_BIT 

Raw value format is 16-bit.

BC_DAC_FORMAT_VOLTAGE 

Raw value format is float.

Definition at line 25 of file bc_dac.h.

Mode.

Enumerator
BC_DAC_MODE_SINGLE 

Mode single.

BC_DAC_MODE_CIRCULAR 

Mode circular (repeate playing buffer)

Definition at line 64 of file bc_dac.h.

Sample rate.

Enumerator
BC_DAC_SAMPLE_RATE_8K 

Data sample-rate is 8kHz.

BC_DAC_SAMPLE_RATE_16K 

Data sample-rate is 16kHz.

Definition at line 40 of file bc_dac.h.

Function Documentation

bool bc_dac_async_config ( bc_dac_channel_t  channel,
bc_dac_config_t config 
)

Configure image of DAC DMA channel.

Parameters
[in]channelDMA channel
[in]bufferData buffer
[in]lengthData buffer length
[in]sample_rateData sample rate
[in]modeDAC channel DMA mode
Returns
true On success
false On failure (if DAC channel operation is in progress)

Definition at line 143 of file bc_dac.c.

bool bc_dac_async_run ( bc_dac_channel_t  channel)

Start asynchronous DAC channel operation.

Parameters
[in]channelDAC channel
Returns
true On success
false On failure

Definition at line 191 of file bc_dac.c.

Here is the call graph for this function:

void bc_dac_async_stop ( bc_dac_channel_t  channel)

Stop asynchronous DAC channel operation.

Parameters
[in]channelDAC channel

Definition at line 264 of file bc_dac.c.

Referenced by bc_dac_deinit().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_dac_deinit ( bc_dac_channel_t  channel)

Deitialize DAC channel.

Parameters
[in]channelDAC channel

Definition at line 73 of file bc_dac.c.

Here is the call graph for this function:

void bc_dac_init ( bc_dac_channel_t  channel)

Initialize DAC channel.

Parameters
[in]channelDAC channel

Definition at line 43 of file bc_dac.c.

void bc_dac_set_event_handler ( bc_dac_channel_t  channel,
void(*)(bc_dac_channel_t, bc_dac_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]channelDAC channel
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 137 of file bc_dac.c.

void bc_dac_set_output ( bc_dac_channel_t  channel,
const void *  raw,
bc_dac_format_t  format 
)

Set DAC channel output as raw value.

Parameters
[in]channelDAC channel
[out]rawPointer to desired raw value
[in]formatDesired raw value format

Definition at line 104 of file bc_dac.c.