PU2CLR KT0915 Arduino Library  1.0.1
This is an Arduino Library to control the KT0915 device
Basic Methods

PU2CLR KT0915 Arduino Library. More...

Functions

void KT0915::setI2CBusAddress (int deviceAddress)
 Set I2C bus address. More...
 
void KT0915::setRegister (uint8_t reg, uint16_t parameter)
 Sets the a value to a given KT09XX register. More...
 
uint16_t KT0915::getRegister (uint8_t reg)
 Gets a given KT09XX register content. More...
 
uint16_t KT0915::getDeviceId ()
 Gets the Device Id. More...
 
void KT0915::setReferenceClockType (uint8_t crystal, uint8_t ref_clock=0)
 Sets the Crystal Type. More...
 
void KT0915::enable (uint8_t on_off)
 Sets the enable pin (9) of the KT0915 high or low. More...
 
void KT0915::setTuneDialModeOn (uint32_t minimu_frequency, uint32_t maximum_frequency)
 Sets Tune Dial Mode Interface On
More...
 
void KT0915::setTuneDialModeOff ()
 Turns the Tune Dial Mode interface Off. More...
 
void KT0915::setVolumeDialModeOn ()
 Sets Volume Dial Mode Interface On. More...
 
void KT0915::setVolumeDialModeOff ()
 Turns the Volume Dial Mode interface Off. More...
 
void KT0915::setup (int enable_pin, uint8_t oscillator_type=OSCILLATOR_32KHZ, uint8_t ref_clock=REF_CLOCK_DISABLE)
 Receiver startup. More...
 

Detailed Description

PU2CLR KT0915 Arduino Library.

KT0915 Arduino Library implementation. This is an Arduino library for the KT0915, BROADCAST RECEIVER.

It works with I2C protocol and can provide an easier interface to control the KT0915 device.

This library was built based on KT0915 Datasheet from KTMicro (Monolithic Digital FM/MW/SW/LW Receiver Radio-on-a-Chip TM).

This library can be freely distributed using the MIT Free Software model.

Author
Ricardo LIma Caratti (pu2cl.nosp@m.r@gm.nosp@m.ail.c.nosp@m.om)

Basic

Low level functions used to operate with the KT09XX registers

Function Documentation

◆ setI2CBusAddress()

void KT0915::setI2CBusAddress ( int  deviceAddress)

Set I2C bus address.

Todo:
check the real i2c address
Parameters
deviceAddressI2C address

Definition at line 26 of file KT0915.cpp.

References KT0915::deviceAddress.

◆ setRegister()

void KT0915::setRegister ( uint8_t  reg,
uint16_t  parameter 
)

Sets the a value to a given KT09XX register.

Parameters
regregister number to be written (0x1 ~ 0x3C) - See #define REG_ in KT0915.h
parametercontent you want to store

Definition at line 38 of file KT0915.cpp.

◆ getRegister()

uint16_t KT0915::getRegister ( uint8_t  reg)

Gets a given KT09XX register content.

It is a basic function to get a value from a given KT0915 device register

Parameters
regregister number to be read (0x1 ~ 0x3C) - See #define REG_ in KT0915.h
Returns
the register content

Definition at line 61 of file KT0915.cpp.

◆ getDeviceId()

uint16_t KT0915::getDeviceId ( )

Gets the Device Id.

Returns
uint16_t 16 bits word with the device id number

Definition at line 82 of file KT0915.cpp.

◆ setReferenceClockType()

void KT0915::setReferenceClockType ( uint8_t  crystal,
uint8_t  ref_clock = 0 
)

Sets the Crystal Type.

Configures the Crystal or reference clock you are using in your circuit.

For a low frequency crystal oscillator, selects 32.768KHz or 38KHz crystals.

Alternatively, you can use a CMOS level external reference clock may be used by setting

the parameter ref_clock to 1 (REF_CLOCK_ENABLE) and setting the reference clock according to the table below.

  • Crystal type table
    Dec binary Description defined constant
    0 0000 32.768KHz OSCILLATOR_32KHZ
    1 0001 6.5MHz OSCILLATOR_6_5MHZ
    2 0010 7.6MHz OSCILLATOR_7_6MHZ
    3 0011 12MHz OSCILLATOR_12MHZ
    4 0100 13MHz OSCILLATOR_13MHZ
    5 0101 15.2MHz OSCILLATOR_15_2MHZ
    6 0110 19.2MHz OSCILLATOR_19_2MHZ
    7 0111 24MHz OSCILLATOR_24MHZ
    8 1000 26MHz OSCILLATOR_26MHZ
    9 1001 ?? 38KHz ?? OSCILLATOR_38KHz
Parameters
crystalReference Clock Selection. See table above.
ref_clock0 = Crystal (default); 1 = Reference clock enabled.

Definition at line 125 of file KT0915.cpp.

◆ enable()

void KT0915::enable ( uint8_t  on_off)

Sets the enable pin (9) of the KT0915 high or low.

This function can be used to enable (1) and disable (0) the KT0915 device. You have to select a MCU (Arduino) pin for this function.

Also, you can set -1 to used this control via circuit.

See also
setup
Parameters
on_off1 = enable; 0 = disable

Definition at line 148 of file KT0915.cpp.

References KT0915::enablePin.

◆ setTuneDialModeOn()

void KT0915::setTuneDialModeOn ( uint32_t  minimu_frequency,
uint32_t  maximum_frequency 
)

Sets Tune Dial Mode Interface On

Todo:
You need to check mechanical Tune features

This method sets the KT0915 to deal with a mechanical tuning via an external 100K resistor.

KT0915 supports a unique Dial Mode (mechanical tuning wheel with a variable resistor) which is

enabled by GPIO1 to 2 (10). The dial can be a variable resistor with the tap connected to CH (pin 1).

See also
KT0915; Monolithic Digital FM/MW/SW/LW Receiver Radio on a Chip(TM); pages 19 and 20.
Parameters
minimu_frequencyStart frequency for the user band
maximum_frequencyFinal frequency for the user band

Definition at line 169 of file KT0915.cpp.

◆ setTuneDialModeOff()

void KT0915::setTuneDialModeOff ( )

Turns the Tune Dial Mode interface Off.

See also
setTuneDialModeOn
KT0915; Monolithic Digital FM/MW/SW/LW Receiver Radio on a Chip(TM); page 20.

Definition at line 209 of file KT0915.cpp.

◆ setVolumeDialModeOn()

void KT0915::setVolumeDialModeOn ( )

Sets Volume Dial Mode Interface On.

This method sets the KT0915 to deal with a mechanical volume control via an external 100K resistor.

KT0915 supports a unique Dial Mode which is enabled by GPIO2 to 2 (10).

The dial can be a variable resistor with the tap connected to VOL (pin 16).

See also
KT0915; Monolithic Digital FM/MW/SW/LW Receiver Radio on a Chip(TM); page 20.

Definition at line 231 of file KT0915.cpp.

◆ setVolumeDialModeOff()

void KT0915::setVolumeDialModeOff ( )

Turns the Volume Dial Mode interface Off.

See also
setVolumeDialModeOn
KT0915; Monolithic Digital FM/MW/SW/LW Receiver Radio on a Chip(TM); page 20.

Definition at line 245 of file KT0915.cpp.

◆ setup()

void KT0915::setup ( int  enable_pin,
uint8_t  oscillator_type = OSCILLATOR_32KHZ,
uint8_t  ref_clock = REF_CLOCK_DISABLE 
)

Receiver startup.

You have to use this method to configure the way that the device will work. For example: enable and disable device control; oscillator type and reference clock type (crystal or external)

The tabe below shows the oscillator frequencies supported by the device.

If you omit the crystal type parameter, will be considered 0 (32.768KHz).

For a low frequency crystal oscillator, selects 32.768KHz or 38KHz crystals.

Alternatively, you can use a CMOS level external reference clock may be used by setting

the parameter ref_clock to 1 (REF_CLOCK_ENABLE) and setting the reference clock according to the table below.

The code below shows how to use the setup function.

the enable_pin parameter sets the way you are controlling the KT0915 pin 9.

#include <KT0915.h>
#define RESET_PIN 12 // set it to -1 if you want to use the RST pin of your MCU.
KT0915 radio;
void setup() {
// Set the parameter enablePin to -1 if you are controlling the enable status via circuit; Select OSCILLATOR_32KHZ, OSCILLATOR_12MHZ etc
// radio.setup(RESET_PIN); Instead the line below, if you use this line, the crystal type considered will be 32.768KHz.
}

Oscillator frequencies supported

Dec binary Description defined constant
0 0000 32.768KHz OSCILLATOR_32KHZ
1 0001 6.5MHz OSCILLATOR_6_5MHZ
2 0010 7.6MHz OSCILLATOR_7_6MHZ
3 0011 12MHz OSCILLATOR_12MHZ
4 0100 13MHz OSCILLATOR_13MHZ
5 0101 15.2MHz OSCILLATOR_15_2MHZ
6 0110 19.2MHz OSCILLATOR_19_2MHZ
7 0111 24MHz OSCILLATOR_24MHZ
8 1000 26MHz OSCILLATOR_26MHZ
9 1001 38KHz OSCILLATOR_38KHz
See also
KT0915; Monolithic Digital FM/MW/SW/LW Receiver Radio on a Chip(TM); 3.6 Crystal and reference clock; page 9.
setReferenceClockType
Parameters
enablePinif >= 0, then you control the device enable or disable status. if -1, you are using the circuit to crontole that.
oscillator_typeoscillator type. You can use crystal or external clock. See comments and table above.
ref_clockset to 0 if you are using crystal (Reference clock disabled - default); set to 1 if you are using an external reference clock.

Definition at line 322 of file KT0915.cpp.

References KT0915::enablePin.

OSCILLATOR_12MHZ
#define OSCILLATOR_12MHZ
Definition: KT0915.h:31
KT0915.h
KT0915
KT0915 Class.
Definition: KT0915.h:513
REF_CLOCK_DISABLE
#define REF_CLOCK_DISABLE
Definition: KT0915.h:40
KT0915::setup
void setup(int enable_pin, uint8_t oscillator_type=OSCILLATOR_32KHZ, uint8_t ref_clock=REF_CLOCK_DISABLE)
Receiver startup.
Definition: KT0915.cpp:322