Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pu2clr committed Jan 23, 2025
1 parent 9a3810f commit 67a0838
Show file tree
Hide file tree
Showing 25 changed files with 11,785 additions and 11,125 deletions.
5 changes: 3 additions & 2 deletions examples/SI4844_00_POC/SI4844_00_POC.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* It is a Proof of Concept (POC) of using Si4844 with the Arduino Library for rx.
*
* It is a Proof of Concept (POC) of using Si4844 with the Arduino Library for rx.
* This example uses the band selection method via programming.
*
* SI4844 and Arduino Pro Mini, Arduino Nano, Uno or LGT8F328 connections
*
* | SI4844 pin | Arduino pin | Description |
Expand Down
64 changes: 64 additions & 0 deletions examples/SI4844_00_POC_CUSTOM_BAND/SI4844_00_POC_CUSTOM_BAND.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* SI4844 custom band example
*
* SI4844 and Arduino Pro Mini connections
*
* | SI4844 pin | Arduino pin | Description |
* | --------- | ------------ | ------------------------------------------------- |
* | 2 | 2 | Arduino interrupt pin |
* | 15 | 12 | Regurlar arduino digital pin used to RESET control |
* | 16 | A4 (SDA) | I2C bus (Data) |
* | 17 | A5 (SCL) | I2C bus (Clocl) |
*
* By Ricardo Lima Caratti (PU2CLR), Oct, 2019.
*/
#include <SI4844.h>
// Tested on Arduino Pro Mini
#define INTERRUPT_PIN 2
#define RESET_PIN 12
// Pages 17 and 18 from Si48XX ATDD PROGRAMMING GUIDE

SI4844 si4844;

void setup() {
Serial.begin(9600);
delay(500);

Serial.print("\nStarting...\n");
si4844.setCrystalOscillatorStabilizationWaitTime(0);
si4844.setup(RESET_PIN, INTERRUPT_PIN, -1);

// See Si48XX ATDD PROGRAMMING GUIDE, pages 17,18,19 and 20.

// Legacy Method
// si4844.setCustomBand(40, 27000, 27500, 5); // Defines and immediately selects Band 40 to operate between 27.0 and 27.5 MHz

// New Method
si4844.addCustomBand(40, 27000, 27500, 5); // Adds Band 40 with a frequency range of 27.0 to 27.5 MHz
si4844.setBand(40); // Selects Band 40 for operation

Serial.print("\nRunning...\n");
showStatus();

}

void showStatus() {
Serial.print("[Band..: ");
Serial.print(si4844.getBandMode());
Serial.print(" - Frequency: ");
Serial.print(si4844.getFrequency(),0);
Serial.print(" KHz");
if (si4844.getStatusBandMode() == 0) {
Serial.print(" - Stereo ");
Serial.print(si4844.getStereoIndicator());
}
Serial.println("]");
}

void loop() {
// If you move the tuner, hasStatusChanged returns true
if (si4844.hasStatusChanged())
{
showStatus();
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file modified examples/TEST/.DS_Store
Binary file not shown.
92 changes: 0 additions & 92 deletions examples/TEST/01_SLIDE_SWITCH_POC/01_SLIDE_SWITCH_POC.ino

This file was deleted.

1 change: 0 additions & 1 deletion examples/TEST/01_SLIDE_SWITCH_POC/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,17 @@
* | 17 | A5 (SCL) | I2C bus (Clocl) |
*
* ATTENTION: Arduino Nano and Uno are 5V based board. Check the board voltage you are using
* If you are using the LGT8F328 see: https://blog.eletrogate.com/tutorial-pro-mini-evb-lgt8f328p-arduino-ide/
*
* Author: Ricardo Lima Caratti (PU2CLR)
* September, 2019
*/
#include <SI4844.h>
#include <EEPROM.h>

// Arduino Pin (tested on pro mini)
#define INTERRUPT_PIN 2
#define RESET_PIN 12
#define DEFAULT_BAND 1

#define STORE_TIME 10000 // Time of inactivity to make the current receiver status writable (10s / 10000 milliseconds).

// EEPROM - Stroring control variables
const uint8_t app_id = 31; // Useful to check the EEPROM content before processing useful data
const int eeprom_address = 0;
long storeTime = millis();


SI4844 rx;

void setup() {
Expand All @@ -39,35 +30,16 @@ void setup() {

Serial.print(F("\nBegin...\n"));

EEPROM.begin();

instructions();
// Some crystal oscillators may need more time to stabilize. Uncomment the following line if you are experiencing issues starting the receiver.
// rx.setCrystalOscillatorStabilizationWaitTime(1);
rx.setup(RESET_PIN, INTERRUPT_PIN, DEFAULT_BAND, 400000); // 400kHz I2C Clock Speed
if (EEPROM.read(eeprom_address) == app_id)
{
readAllReceiverInformation();
} else
rx.setVolume(48);

rx.setCrystalOscillatorStabilizationWaitTime(1);
// rx.setup(RESET_PIN, INTERRUPT_PIN, DEFAULT_BAND, 400000); // if you want to use 400kHz I2C speed
rx.setup(RESET_PIN, INTERRUPT_PIN, DEFAULT_BAND);
showStatus();
delay(200);
rx.setVolume(48);
showStatus();
}

void saveAllReceiverInformation()
{
EEPROM.update(eeprom_address, app_id); // stores the app id;
EEPROM.update(eeprom_address + 1, rx.getVolume()); // stores the current Volume
EEPROM.update(eeprom_address + 2, rx.getStatusBandIndex()); // Stores the current band

}

void readAllReceiverInformation()
{
rx.setVolume(EEPROM.read(eeprom_address + 1));
rx.setBand(EEPROM.read(eeprom_address + 2));
}

// Shows instruções
void instructions() {
Serial.println(F("---------------------------------------------------"));
Expand All @@ -76,11 +48,11 @@ void instructions() {
Serial.println(F("Type h - Custom FM - from 101 to 104 MHz - Step 200kHz"));
Serial.println(F("Type + or - to sound volume"));
Serial.println(F("Type B to Bass; T to Treeble and N to Normal"));
Serial.println(F("Type M to Mute"));
Serial.println(F("Type c - custom band 5.7 to 6.2 MHz"));
Serial.println(F("Type C - CB (custom Band 27.0 to 27.5 MHz"));
Serial.println(F("Type o to Power Down"));
Serial.println(F("Type I to Firmware Information"));
Serial.println(F("Type R to RESET the EEPROM"));
Serial.println(F("---------------------------------------------------"));
delay(500);
}
Expand All @@ -104,25 +76,27 @@ void show_firmware_information() {
}

void showStatus() {

char str[80];
char aux[15];
char* unt;
Serial.print(F("Band Index: "));
Serial.print(rx.getStatusBandIndex());
Serial.print(F(" - "));
Serial.print(rx.getBandMode());
Serial.print(F(" - Frequency: "));
Serial.print(rx.getFrequencyInteger());
Serial.print(F(" KHz"));
if (rx.getStatusBandMode() == 0) {
strcpy(aux,"Stereo ");
strcat(aux, rx.getStereoIndicator() );
unt = (char *) "MHZ";
} else {
strcpy(aux,"AM MONO");
unt = (char *) "kHz";
Serial.print(F(" - Stereo "));
Serial.print(rx.getStereoIndicator());
}
sprintf(str,"\nMode: %d - Idx: %2.2d %s - Freq.: %s %s - %s - Vol.: %d", rx.getStatusBandMode(), rx.getStatusBandIndex(), rx.getBandMode(), rx.getFormattedFrequency(2), unt, aux, rx.getVolume() );
Serial.print(str);

Serial.print(F(" - Volume: "));
Serial.print(rx.getVolume());
Serial.println("");
}

// Control
void loop() {

bool bMute = false;

// Read from keyboar (Arduino Serial Monitor)
// Band switch and sound volume control
// It can be replaced by your keyboar, encoder or push button device.
Expand All @@ -135,11 +109,11 @@ void loop() {
rx.setBand(1); // FM band
break;
case 'f':
Serial.println(F("\nCustom FM Band: from to 77 to 109 MHz - Step 200 kHz"));
Serial.println(F("Custom FM Band: from to 77 to 109 MHz - Step 200 kHz"));
rx.setCustomBand(3,7700,10900,20);
break;
case 'h':
Serial.println(F("\nCustom FM Band: from to 101 to 104 MHz - Step 200 kHz"));
Serial.println(F("Custom FM Band: from to 101 to 104 MHz - Step 200 kHz"));
rx.setCustomBand(3,10100,10400,20);
break;
case 'a':
Expand Down Expand Up @@ -174,20 +148,20 @@ void loop() {
rx.volumeDown();
break;
case 'o':
Serial.println(F("\nPower Down"));
Serial.println(F("Power Down"));
delay(500);
rx.powerDown();
break;
case 'c':
// Configure the Pre-defined Band (band index 26) to work between 5.7 to 6.2 MHz
// See Si48XX ATDD PROGRAMMING GUIDE, pages 17,18,19 and 20.
Serial.println(F("\nCustom Band: 5.7 to 6.2 MHz"));
Serial.println(F("Custom Band: 5.7 to 6.2 MHz"));
rx.setCustomBand(26,5700,6200,5);
break;
case 'C':
// Configure the Pre-defined Band (band index 40) to work between 27.0 to 27.5 MHz
// See Si48XX ATDD PROGRAMMING GUIDE, pages 17,18,19 and 20.
Serial.println(F("\nCustom Band: 27.0 to 27.5 MHz"));
Serial.println(F("Custom Band: 27.0 to 27.5 MHz"));
rx.setCustomBand(40,27000,27500,5);
break;
case 'I':
Expand All @@ -196,24 +170,25 @@ void loop() {
break;
case 'B':
case 'b':
rx.bassTrebleDown();
rx.bassTrebleUp();
break;
case 'T':
case 't':
rx.bassTrebleUp();
break;
case 'R':
EEPROM.update(eeprom_address, 0);
Serial.println(F("\nEEPROM RESET..."));
break;
rx.bassTrebleDown();
break;
case 'N':
case 'n':
rx.setBassTreble(4);
break;
case 'M':
case 'm':
bMute = !bMute;
rx.setAudioMute(bMute);
break;
}
}
if (rx.hasStatusChanged())
{
showStatus();
if ( (millis() - storeTime) > STORE_TIME ) {
storeTime = millis();
saveAllReceiverInformation();
}
}
}
Loading

0 comments on commit 67a0838

Please sign in to comment.