PU2CLR AKC695X Arduino Library
1.0.2
This is an Arduino Library to control the AKC695X / M695X DSP radio devices
|
Functions | |
void | AKC695X::commitTune () |
Sets the STC bit to high when the tune operation completes. More... | |
void | AKC695X::setCustomBand (uint16_t minimum_frequency, uint16_t maximum_frequency) |
Sets the start and end frequencies for a custom band. More... | |
void | AKC695X::setFM (uint8_t akc695x_fm_band, uint16_t minimum_freq, uint16_t maximum_freq, uint16_t default_frequency, uint8_t default_step) |
Sets the AKC695X to FM mode. More... | |
void | AKC695X::setAM (uint8_t akc695x_am_band, uint16_t minimum_freq, uint16_t maximum_freq, uint16_t default_frequency, uint8_t default_step) |
Sets the AKC695X to AM mode and selects the band. More... | |
void | AKC695X::setStep (uint8_t step) |
Sets the step that will be used to increment and decrement the current frequency. More... | |
void | AKC695X::setFmSeekStep (uint8_t value) |
Sets FM step for seeking. More... | |
void | AKC695X::seekStation (uint8_t up_down, void(*showFunc)()=NULL) |
Seeks a FM station. More... | |
void | AKC695X::setFrequency (uint16_t frequency) |
Sets the the device to a given frequency. More... | |
uint16_t | AKC695X::getFrequency () |
Returns the current frequency value. More... | |
void | AKC695X::frequencyUp () |
Adds the current step to the current frequency and sets the new frequency. More... | |
void | AKC695X::frequencyDown () |
Subtracts the current step from the current frequency and assign the new frequency. More... | |
void | AKC695X::setAudio (uint8_t phase_inv, uint8_t line, uint8_t volume) |
Configures the audio output. More... | |
void | AKC695X::setAudio () |
Configures the audio output with default values. More... | |
void | AKC695X::setVolume (uint8_t volume) |
Sets the output audio volume. More... | |
void | AKC695X::setVolumeUp () |
Increments the audio volume. More... | |
void | AKC695X::setVolumeDown () |
Decrements the audio volume. More... | |
void | AKC695X::setVolumeControl (uint8_t type) |
Sets the kind of audio volume control will be used. More... | |
int | AKC695X::getRSSI () |
Gets the current RSSI. More... | |
float | AKC695X::getSupplyVoltage () |
Gets the supply voltage. More... | |
void AKC695X::commitTune | ( | ) |
Sets the STC bit to high when the tune operation completes.
Tells the device that the tune process is over.
Referenced by AKC695X::setFrequency().
void AKC695X::setCustomBand | ( | uint16_t | minimum_frequency, |
uint16_t | maximum_frequency | ||
) |
Sets the start and end frequencies for a custom band.
This method is used by setAM and setFM methods.
This will called when you set a band greater than 17 on AM mode or greater than 7 on FM mode.
You can use more than one band at a time.
band | if FM, a value greater than 7. If AM, a value greater than 17. You can use more than one. |
minimum_frequency | Start frequency |
maximum_frequency | Final frequency |
void AKC695X::setFM | ( | uint8_t | akc695x_fm_band, |
uint16_t | minimum_freq, | ||
uint16_t | maximum_freq, | ||
uint16_t | default_frequency, | ||
uint8_t | default_step | ||
) |
Sets the AKC695X to FM mode.
Sets the device to FM mode. You can configure a custom FM band by setting band number greater than 7.
FM band | N# | Description |
---|---|---|
000 | 0 | FM1,87 ~ 108, station search space specified intervals |
001 | 1 | FM2,76 ~ 108, station search space specified intervals |
010 | 2 | FM3,70 ~ 93, with a space station search interval set |
011 | 3 | FM4,76 ~ 90, Tuning predetermined space intervals |
100 | 4 | FM5,64 ~ 88, with a space station search interval set |
101 | 5 | TV1,56.25 ~ 91.75, station search space specified intervals |
110 | 6 | TV2, 174.75 ~ 222.25, found |
111 | 7 | sets predetermined space intervals, custom FM, station search space specified intervals |
akc695x_fm_band | FM band (see manual FM band table above). Set to a number greater than 7 if you want a custom FM band. |
minimum_freq | Minimal frequency of the band |
maximum_freq | Band maximum frequency |
default_frequency | default frequency |
default_step | increment and decrement step |
void AKC695X::setAM | ( | uint8_t | akc695x_am_band, |
uint16_t | minimum_freq, | ||
uint16_t | maximum_freq, | ||
uint16_t | default_frequency, | ||
uint8_t | default_step | ||
) |
Sets the AKC695X to AM mode and selects the band.
This method configures the AM band you want to use.
You must respect the frequency limits defined by the AKC595X device documentation.
You can configure a custom band by setting a band greater than 17
AM band | N# | Description |
---|---|---|
00000 | 0 | LW, 0.15 ~ 0.285, 3K station search |
00001 | 1 | MW1, 0.52 ~ 1.71, 5K station search |
00010 | 2 | MW2, 0.522 ~ 1.62, 9K station search |
00011 | 3 | MW3, 0.52 ~ 1.71, 10K station search |
00100 | 4 | SW1, 4.7 ~ 10, 5K station search |
00101 | 5 | SW2, 3.2 ~ 4.1, 5K station search |
00110 | 6 | SW3, 4.7 ~ 5.6, 5K station search |
00111 | 7 | SW4, 5.7 ~ 6.4, 5K station search |
01000 | 8 | SW5, 6.8 ~ 7.6, 5K station search |
01001 | 9 | SW6, 9.2 ~ 10, 5K station search |
01010 | 10 | SW7, 11.4 ~ 12.2, 5K station search |
01011 | 11 | SW8, 13.5 ~ 14.3 |
01100 | 12 | SW9, 15 ~ 15.9 |
01101 | 13 | SW10, 17.4 ~ 17.9 |
01110 | 14 | SW11, 18.9 ~ 19.7, 5K station search |
01111 | 15 | SW12, 21.4 ~ 21.9, 5K station search |
10000 | 16 | SW13, 11.4 ~ 17.9, 5K station search |
10010 | 17 | MW4, 0.52 to 1.73, 5K station search |
Other | 18+ | custom band, station search interval = 3K |
akc695x_am_band | AM band. Set to a value greater than 17 if you want a custom AM band (see manual AM band table above) |
minimum_freq | Minimal frequency of the band |
maximum_freq | Band maximum frequency |
default_frequency | default frequency |
default_step | increment and decrement step |
void AKC695X::setStep | ( | uint8_t | step | ) |
Sets the step that will be used to increment and decrement the current frequency.
The AKC695X has two possible steps (3kHz and 5kHz). The step value is important to calculate the frequenvy you want to set.
step | The valid values are 3 and 5. Other values will be ignored. |
void AKC695X::setFmSeekStep | ( | uint8_t | space | ) |
Sets FM step for seeking.
Sets FM seek step.
spece | N# | step |
---|---|---|
00 | 0 | 25 kHz |
01 | 1 | 50 kHz |
| 10 | 2 | 100 kHz | (default) | 11 | 3 | 200 kHz |
space | value betwenn 0 and 3 (see table above ). |
void AKC695X::seekStation | ( | uint8_t | up_down, |
void(*)() | showFunc = NULL |
||
) |
Seeks a FM station.
Seek a FM Station
up_down | if 0, seek down; if 1, seek up. |
showFunc | Optional. Point to the function in you sketch that shows the current frequency. If NULL, do nothing (default). |
void AKC695X::setFrequency | ( | uint16_t | frequency | ) |
Sets the the device to a given frequency.
This methods check the current mode (AM or FM), calculates the right channel to be setted.
Sets to reg2 structure the 5 most significan bist of the channel.
Sets to reg3 the 8 less significant bits of the channel.
frequency | frequency you want to set to |
References AKC695X::commitTune().
uint16_t AKC695X::getFrequency | ( | ) |
Returns the current frequency value.
Gets the current frequency.
void AKC695X::frequencyUp | ( | ) |
Adds the current step to the current frequency and sets the new frequency.
Goes to the next frequency channel
void AKC695X::frequencyDown | ( | ) |
Subtracts the current step from the current frequency and assign the new frequency.
Goes to the previous frequency channel
void AKC695X::setAudio | ( | uint8_t | phase_inv, |
uint8_t | line, | ||
uint8_t | volume | ||
) |
Configures the audio output.
This method sets the AKC695X device audio behaviour
phase_inv | if 0, audio output inphase; if 1, audio output inverted |
line | if 0, audio input mode; if 1, radio mode. |
volume | if 25 a 63, audio volume; if <= 24 mute |
void AKC695X::setAudio | ( | ) |
Configures the audio output with default values.
this method sets the audio phase_inv = 0; line = 1 and volume = 40;
Also, this set the audio controlled by MCU (Arduino)
void AKC695X::setVolume | ( | uint8_t | volume | ) |
Sets the output audio volume.
Values less than 24 mute the audio output.
Values between 25 and 63 set the output audio volume.
volume |
void AKC695X::setVolumeUp | ( | ) |
Increments the audio volume.
The maximum volume is 63
void AKC695X::setVolumeDown | ( | ) |
Decrements the audio volume.
The minimum volume is 25
void AKC695X::setVolumeControl | ( | uint8_t | type | ) |
Sets the kind of audio volume control will be used.
This method configures the kind of audio volume control will be used.
You can control the audio volume by potentiometer or by MCU (Arduino).
If you choose volume conttolled by Arduino (type 1), you can set the volume from 25 to 63 levels.
type | 0 = controlled by poteciometer; 1 controlled by the MCU |
int AKC695X::getRSSI | ( | ) |
Gets the current RSSI.
This method calculates the RSSI based on two register (24 and 27).
Actually, it is the Antenna aperture and can be calculated using signal levels rssi, pgalevel_rf, pgalevel_if.
The rssi is stored in the register 27 and the pgalevel_rf, pgalevel_if are stored in register 24.
On FM mode or SW band, the formula is: Pin (dBuV) = 103 - rssi - 6 * pgalevel_rf - 6 * pgalevel_if
On AM mode (LW or MW), the formula is: Pin (dBuV) = 123 - rssi - 6 * pgalevel_rf - 6 * pgalevel_if
float AKC695X::getSupplyVoltage | ( | ) |
Gets the supply voltage.
Gets the current supply voltage