Skip to content

Commit

Permalink
AKC6955 Arduino Library
Browse files Browse the repository at this point in the history
  • Loading branch information
pu2clr committed Jul 30, 2021
1 parent 98db983 commit 927fbc8
Show file tree
Hide file tree
Showing 76 changed files with 1,007 additions and 919 deletions.
16 changes: 4 additions & 12 deletions AKC695X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ void AKC695X::setI2CBusAddress(int deviceAddress)
* @ingroup GA03
* @brief Receiver startup
* @details Use this method to define the MCU (Arduino) RESET pin and the crystal type you are using.
* @details The options for the crystal type is: CRYSTAL_32kHz (32.768kHz) or CRYSTAL_12MHZ (12MHz).
* @details The options for the crystal type is: CRYSTAL_32KHz (32.768kHz) or CRYSTAL_12MHZ (12MHz).
* @details If you omit the crystal type parameter, will be considered 32.768kHz. Example:
* @code
* #include <AKC695X.h>
* #define RESET_PIN 12 // set it to -1 if you want to use the RST pin of your MCU.
* AKC695X radio;
* void setup() {
* // Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32kHz or CRYSTAL_12MHZ
* // Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32KHz or CRYSTAL_12MHZ
* // radio.setup(RESET_PIN); Instead the line below, if you use this line, the crystal type considered will be 32.768kHz.
* radio.setup(RESET_PIN, CRYSTAL_12MHZ);
* radio.setFM(0, 870, 1080, 1039, 1); // Tunes on 103.9MHz, FM, band 0.
Expand Down Expand Up @@ -90,7 +90,7 @@ void AKC695X::setup(int resetPin, uint8_t crystal_type)
* #include <AKC695X.h>
* AKC695X radio;
* void setup() {
* // Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32kHz or CRYSTAL_12MHZ
* // Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32KHz or CRYSTAL_12MHZ
* // radio.setup(-1); Use this line if you are using RST pin of the Arduino. The crystal type considered will be 32.768kHz.
* radio.setup(12); // You ara usint Arduino Pin 12 to reset control. The crystal type considered will be 32.768kHz.
* radio.setFM(0, 870, 1080, 1039, 1); // Tunes on 103.9MHz, FM, band 0.
Expand All @@ -99,7 +99,7 @@ void AKC695X::setup(int resetPin, uint8_t crystal_type)
* @param resetPin if >= 0, then you control the RESET. if -1, you are using ths MCU RST pin.
*/
void AKC695X::setup(int resetPin) {
this->setup(resetPin, CRYSTAL_32kHz);
this->setup(resetPin, CRYSTAL_32KHz);
}

/**
Expand Down Expand Up @@ -490,12 +490,7 @@ void AKC695X::setCustomBand(uint16_t minimum_frequency, uint16_t maximum_frequen
*/
void AKC695X::setFM(uint8_t akc695x_fm_band, uint16_t minimum_freq, uint16_t maximum_freq, uint16_t default_frequency, uint8_t default_step)
{
uint16_t channel;
uint8_t high_bit, low_bit;

akc595x_reg1 reg1;
akc595x_reg2 reg2;

this->currentMode = 1;
this->currentBand = akc695x_fm_band;
this->currentBandMinimumFrequency = minimum_freq;
Expand Down Expand Up @@ -552,11 +547,8 @@ void AKC695X::setFM(uint8_t akc695x_fm_band, uint16_t minimum_freq, uint16_t max
*/
void AKC695X::setAM(uint8_t akc695x_am_band, uint16_t minimum_freq, uint16_t maximum_freq, uint16_t default_frequency, uint8_t default_step)
{
uint16_t channel;
uint8_t high_bit, low_bit;

akc595x_reg1 reg1;
akc595x_reg2 reg2;

this->currentMode = 0;
this->currentBand = akc695x_am_band;
Expand Down
11 changes: 8 additions & 3 deletions AKC695X.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
* Contact: [email protected]
*/

#ifndef _AKC6955_H // Prevent this file from being compiled more than once
#define _AKC6955_H

#include <Arduino.h>
#include <Wire.h>

#define DEFAUL_I2C_ADDRESS 0x10
#define CURRENT_MODE_FM 1
#define CURRENT_MODE_AM 0
#define CRYSTAL_12MHZ 0
#define CRYSTAL_32kHz 1
#define CRYSTAL_32KHz 1

#define MAX_SEEK_TIME 3000 // Maximum time have to be a seeking process (in ms).
#define AKC_SEEK_UP 1
Expand Down Expand Up @@ -450,7 +453,7 @@ class AKC695X
uint16_t currentStep; //!< Strore the current step
uint16_t currentFrequency; //!< Store the current frequency
uint8_t currentMode = 0; //!< Store the current mode: 1 = FM; 0 = AM
uint8_t currentCrystalType = CRYSTAL_32kHz; //!< Store the crystal type used: 0 = 12MHz; 1 = 32.768kHz
uint8_t currentCrystalType = CRYSTAL_32KHz; //!< Store the crystal type used: 0 = 12MHz; 1 = 32.768kHz
uint8_t currentMode3k = 0; //!< 1 = 3K; 0 = AM

// AM current band information
Expand Down Expand Up @@ -528,5 +531,7 @@ class AKC695X

void commitTune();

void convertToChar(uint16_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros = true)
void convertToChar(uint16_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros = true);
};

#endif // _AKC6955_H
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ void setup() {

showHelp();
// You can select the RESET pin and Crystal type you are using in your circuit.
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32kHz or CRYSTAL_12MHZ
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32KHz or CRYSTAL_12MHZ
// radio.setup(RESET_PIN, CRYSTAL_12MHZ);
radio.setup(RESET_PIN, CRYSTAL_12MHZ);
// radio.setup(RESET_PIN, CRYSTAL_32kHz);
// radio.setup(RESET_PIN, CRYSTAL_32KHz);
delay(500);
currentFrequency = currentFM = 1039;
radio.setFM(0, 870, 1080, currentFrequency, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void setup() {
while (!Serial);

// You can select the RESET pin and Crystal type you are using in your circuit.
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32kHz or CRYSTAL_12MHZ
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32KHz or CRYSTAL_12MHZ
// radio.setup(RESET_PIN, CRYSTAL_12MHZ);
radio.setup(RESET_PIN);

Expand Down
4 changes: 2 additions & 2 deletions examples/AKC_02_OLED/AKC_02_OLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ void setup()
splash();

// You can select the RESET pin and Crystal type you are using in your circuit.
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32kHz or CRYSTAL_12MHZ
radio.setup(RESET_PIN, CRYSTAL_32kHz);
// Set RESET_PIN to -1 if you are using the Arduino RST pin; Select CRYSTAL_32KHz or CRYSTAL_12MHZ
radio.setup(RESET_PIN, CRYSTAL_32KHz);

radio.setFM(band[bandIdx].band, band[bandIdx].minimum_frequency, band[bandIdx].maximum_frequency,band[bandIdx].default_frequency, band[bandIdx].step);
radio.setAudio(); // Sets the audio output behaviour (default configuration).
Expand Down
4 changes: 2 additions & 2 deletions examples/AKC_03_LCD16x2/AKC_03_LCD16x2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ void setup()
attachInterrupt(digitalPinToInterrupt(ENCODER_PIN_A), rotaryEncoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(ENCODER_PIN_B), rotaryEncoder, CHANGE);

// rx.setup(RESET_PIN,CRYSTAL_12MHZ);
rx.setup(RESET_PIN, CRYSTAL_32KHZ);
// rx.setup(RESET_PIN,CRYSTAL_12MHZ);
rx.setup(RESET_PIN, CRYSTAL_32KHz);
delay(500);

// rx.setFM(band[bandIdx].band, band[bandIdx].minimum_frequency, band[bandIdx].maximum_frequency,band[bandIdx].currentFreq, band[bandIdx].step);
Expand Down
10 changes: 5 additions & 5 deletions extras/docs/html/_a_k_c695_x_8h.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@
<tr class="separator:a2edf821051a85e58efeb2ff3a8e31f21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74c62040d9bf060c6281703c49412772"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_a_k_c695_x_8h.html#a74c62040d9bf060c6281703c49412772">CRYSTAL_12MHZ</a>&#160;&#160;&#160;0</td></tr>
<tr class="separator:a74c62040d9bf060c6281703c49412772"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ada86af6106ecfd6ac5468385d2ee00"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_a_k_c695_x_8h.html#a5ada86af6106ecfd6ac5468385d2ee00">CRYSTAL_32kHz</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:a5ada86af6106ecfd6ac5468385d2ee00"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72a6e3b9ddd0b55253043143e0f4f2d4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_a_k_c695_x_8h.html#a72a6e3b9ddd0b55253043143e0f4f2d4">CRYSTAL_32KHz</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:a72a6e3b9ddd0b55253043143e0f4f2d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc98e8d3badddd21bc528451bb718f82"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_a_k_c695_x_8h.html#acc98e8d3badddd21bc528451bb718f82">MAX_SEEK_TIME</a>&#160;&#160;&#160;3000</td></tr>
<tr class="separator:acc98e8d3badddd21bc528451bb718f82"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a09d8f38980499b49afa6a01221d4d827"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_a_k_c695_x_8h.html#a09d8f38980499b49afa6a01221d4d827">AKC_SEEK_UP</a>&#160;&#160;&#160;1</td></tr>
Expand Down Expand Up @@ -324,14 +324,14 @@ <h2 class="memtitle"><span class="permalink"><a href="#a74c62040d9bf060c6281703c

</div>
</div>
<a id="a5ada86af6106ecfd6ac5468385d2ee00"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ada86af6106ecfd6ac5468385d2ee00">&#9670;&nbsp;</a></span>CRYSTAL_32kHz</h2>
<a id="a72a6e3b9ddd0b55253043143e0f4f2d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a72a6e3b9ddd0b55253043143e0f4f2d4">&#9670;&nbsp;</a></span>CRYSTAL_32KHz</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CRYSTAL_32kHz&#160;&#160;&#160;1</td>
<td class="memname">#define CRYSTAL_32KHz&#160;&#160;&#160;1</td>
</tr>
</table>
</div><div class="memdoc">
Expand Down
2 changes: 1 addition & 1 deletion extras/docs/html/_a_k_c695_x_8h.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _a_k_c695_x_8h =
[ "CURRENT_MODE_FM", "_a_k_c695_x_8h.html#a375ba4a968253cd1628914e7e6ebc40e", null ],
[ "CURRENT_MODE_AM", "_a_k_c695_x_8h.html#a2edf821051a85e58efeb2ff3a8e31f21", null ],
[ "CRYSTAL_12MHZ", "_a_k_c695_x_8h.html#a74c62040d9bf060c6281703c49412772", null ],
[ "CRYSTAL_32kHz", "_a_k_c695_x_8h.html#a5ada86af6106ecfd6ac5468385d2ee00", null ],
[ "CRYSTAL_32KHz", "_a_k_c695_x_8h.html#a72a6e3b9ddd0b55253043143e0f4f2d4", null ],
[ "MAX_SEEK_TIME", "_a_k_c695_x_8h.html#acc98e8d3badddd21bc528451bb718f82", null ],
[ "AKC_SEEK_UP", "_a_k_c695_x_8h.html#a09d8f38980499b49afa6a01221d4d827", null ],
[ "AKC_SEEK_DOWN", "_a_k_c695_x_8h.html#a88095b3908de87ed8f63d7142ecaefcb", null ],
Expand Down
Loading

0 comments on commit 927fbc8

Please sign in to comment.