Arduino Radio Library
0.9
A set of Arduino libraries to control diverse FM radio receiver chips in Arduino projects.
|
Radio implementation including LCD output. More...
#include <Wire.h>
#include <RADIO.h>
#include <RDA5807M.h>
#include <SI4703.h>
#include <TEA5767.h>
#include <RDSParser.h>
#include <LiquidCrystal_PCF8574.h>
#include <RotaryEncoder.h>
#include <OneButton.h>
Enumerations | |
enum | RADIO_STATE { STATE_PARSECOMMAND, STATE_PARSEINT, STATE_EXEC, STATE_NONE = 0, STATE_PARSECOMMAND, STATE_PARSEINT, STATE_EXEC, STATE_FREQ, STATE_VOL, STATE_MONO, STATE_SMUTE, STATE_PARSECOMMAND, STATE_PARSEINT, STATE_EXEC, STATE_NONE = 0, STATE_PARSECOMMAND, STATE_PARSEINT, STATE_EXEC, STATE_FREQ, STATE_VOL, STATE_MONO, STATE_SMUTE } |
State definition for this radio implementation. More... | |
Functions | |
RotaryEncoder | encoder (A9, A8) |
Setup a RoraryEncoder for pins A2 and A3: More... | |
LiquidCrystal_PCF8574 | lcd (0x27) |
get a LCD instance More... | |
OneButton | menuButton (A10, true) |
OneButton | seekButton (A11, true) |
void | DisplayFrequency (RADIO_FREQ f) |
Update the Frequency on the LCD display. More... | |
void | DisplayServiceName (char *name) |
Update the ServiceName text on the LCD display when in RDS mode. More... | |
void | DisplayTime (uint8_t hour, uint8_t minute) |
void | DisplayVolume (uint8_t v) |
Display the current volume. More... | |
void | DisplayMono (uint8_t v) |
Display the current mono switch. More... | |
void | DisplaySoftMute (uint8_t v) |
Display the current soft mute switch. More... | |
void | RDS_process (uint16_t block1, uint16_t block2, uint16_t block3, uint16_t block4) |
void | doMenuClick () |
void | doSeekClick () |
ISR (PCINT2_vect) | |
void | setup () |
Setup a FM only radio configuration with I/O for commands and debugging on the Serial port. More... | |
void | runCommand (char cmd, int16_t value) |
void | loop () |
Constantly check for serial input commands and trigger command execution. More... | |
Variables | |
RADIO_FREQ | preset [] |
int | i_sidx =5 |
int | i_smax =14 |
int | encoderLastPos |
unsigned long | encoderLastTime |
SI4703 | radio |
RDSParser | rds |
get a RDS parser More... | |
RADIO_STATE | state |
The state variable is used for parsing input characters. More... | |
RADIO_STATE | rot_state |
Radio implementation including LCD output.
This is a full function radio implementation that uses a LCD display to show the current station information.
It can be used with various chips after adjusting the radio object definition.
Open the Serial console with 57600 baud to see current radio information and change various settings.
The necessary wiring of the various chips are described in the Testxxx example sketches. The boards have to be connected by using the following connections:
Arduino port | SI4703 signal | RDA5807M signal |
---|---|---|
GND (black) | GND | GND |
3.3V (red) | VCC | VCC |
5V (red) | - | - |
A5 (yellow) | SCLK | SCLK |
A4 (blue) | SDIO | SDIO |
D2 | RST | - |
More documentation and source code is available at http://www.mathertel.de/Arduino
enum RADIO_STATE |
State definition for this radio implementation.
void DisplayFrequency | ( | RADIO_FREQ | f | ) |
Update the Frequency on the LCD display.
void DisplayMono | ( | uint8_t | v | ) |
Display the current mono switch.
void DisplayServiceName | ( | char * | name | ) |
Update the ServiceName text on the LCD display when in RDS mode.
void DisplaySoftMute | ( | uint8_t | v | ) |
Display the current soft mute switch.
void DisplayTime | ( | uint8_t | hour, |
uint8_t | minute | ||
) |
void DisplayVolume | ( | uint8_t | v | ) |
Display the current volume.
void doMenuClick | ( | ) |
void doSeekClick | ( | ) |
RotaryEncoder encoder | ( | A9 | , |
A8 | |||
) |
Setup a RoraryEncoder for pins A2 and A3:
ISR | ( | PCINT2_vect | ) |
LiquidCrystal_PCF8574 lcd | ( | 0x27 | ) |
get a LCD instance
The lcd object has to be defined by using a LCD library that supports the standard functions When using a I2C->LCD library ??? the I2C bus can be used to control then radio chip and the lcd.
void loop | ( | ) |
Constantly check for serial input commands and trigger command execution.
OneButton menuButton | ( | A10 | , |
true | |||
) |
void RDS_process | ( | uint16_t | block1, |
uint16_t | block2, | ||
uint16_t | block3, | ||
uint16_t | block4 | ||
) |
void runCommand | ( | char | cmd, |
int16_t | value | ||
) |
Execute a command identified by a character and an optional number. See the "?" command for available commands.
cmd | The command character. |
value | An optional parameter for the command. |
OneButton seekButton | ( | A11 | , |
true | |||
) |
void setup | ( | ) |
Setup a FM only radio configuration with I/O for commands and debugging on the Serial port.
int encoderLastPos |
unsigned long encoderLastTime |
int i_sidx =5 |
int i_smax =14 |
RADIO_FREQ preset[] |
SI4703 radio |
The radio object has to be defined by using the class corresponding to the used chip. by uncommenting the right radio object definition.
RDSParser rds |
get a RDS parser
RADIO_STATE rot_state |
RADIO_STATE state |
The state variable is used for parsing input characters.