PU2CLR KT0915 Arduino Library
1.0.1
This is an Arduino Library to control the KT0915 device
|
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... | |
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.
Low level functions used to operate with the KT09XX registers
void KT0915::setI2CBusAddress | ( | int | deviceAddress | ) |
Set I2C bus address.
deviceAddress | I2C address |
Definition at line 26 of file KT0915.cpp.
References KT0915::deviceAddress.
void KT0915::setRegister | ( | uint8_t | reg, |
uint16_t | parameter | ||
) |
Sets the a value to a given KT09XX register.
reg | register number to be written (0x1 ~ 0x3C) - See #define REG_ in KT0915.h |
parameter | content you want to store |
Definition at line 38 of file KT0915.cpp.
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
reg | register number to be read (0x1 ~ 0x3C) - See #define REG_ in KT0915.h |
Definition at line 61 of file KT0915.cpp.
uint16_t KT0915::getDeviceId | ( | ) |
Gets the Device Id.
Definition at line 82 of file KT0915.cpp.
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.
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 |
crystal | Reference Clock Selection. See table above. |
ref_clock | 0 = Crystal (default); 1 = Reference clock enabled. |
Definition at line 125 of file KT0915.cpp.
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.
on_off | 1 = enable; 0 = disable |
Definition at line 148 of file KT0915.cpp.
References KT0915::enablePin.
void KT0915::setTuneDialModeOn | ( | uint32_t | minimu_frequency, |
uint32_t | maximum_frequency | ||
) |
Sets Tune Dial Mode Interface On
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).
minimu_frequency | Start frequency for the user band |
maximum_frequency | Final frequency for the user band |
Definition at line 169 of file KT0915.cpp.
void KT0915::setTuneDialModeOff | ( | ) |
Turns the Tune Dial Mode interface Off.
Definition at line 209 of file KT0915.cpp.
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).
Definition at line 231 of file KT0915.cpp.
void KT0915::setVolumeDialModeOff | ( | ) |
Turns the Volume Dial Mode interface Off.
Definition at line 245 of file KT0915.cpp.
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.
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 |
enablePin | if >= 0, then you control the device enable or disable status. if -1, you are using the circuit to crontole that. |
oscillator_type | oscillator type. You can use crystal or external clock. See comments and table above. |
ref_clock | set 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.