adding CTCSS and example

This commit is contained in:
Morgan Redfield
2018-08-11 20:30:09 -07:00
parent 73f8cb3d93
commit 96d02c3bd9
3 changed files with 190 additions and 4 deletions

View File

@@ -827,7 +827,10 @@ uint8_t HamShield::getCtcssDetThreshOut() {
return (uint8_t) radio_i2c_buf[0];
}
bool HamShield::getCtcssToneDetected() {
HSreadBitW(devAddr, A1846S_FLAG_REG, A1846S_CTCSS1_FLAG_BIT, radio_i2c_buf);
return (radio_i2c_buf[0] != 0);
}
// cdcss codes
void HamShield::setCdcssCode(uint16_t code) {
@@ -1133,6 +1136,13 @@ uint16_t HamShield::getFMCssDeviation(){
}
// RX voice range
void HamShield::setMute() {
HSwriteBitW(devAddr, A1846S_CTL_REG, A1846S_MUTE_BIT, 1);
}
void HamShield::setUnmute() {
HSwriteBitW(devAddr, A1846S_CTL_REG, A1846S_MUTE_BIT, 0);
}
void HamShield::setVolume1(uint16_t volume){
HSwriteBitsW(devAddr, A1846S_RX_VOLUME_REG, A1846S_RX_VOL_1_BIT, A1846S_RX_VOL_1_LENGTH, volume);
}

View File

@@ -51,7 +51,6 @@
#define A1846S_SQ_OUT_SEL_REG 0x54 // see sq
#define A1846S_FILTER_REG 0x58
#define A1846S_CTCSS_THRESH_REG 0x5B
#define A1846S_FLAG_REG 0x5C // holds flags for different statuses
#define A1846S_RSSI_REG 0x1B // holds RSSI (unit 1dB)
#define A1846S_VSSI_REG 0x1A // holds VSSI (unit mV)
@@ -171,8 +170,8 @@
#define A1846S_CTCSS_FILTER_BYPASS 3
// Bitfields for A1846S_FLAG_REG
#define A1846S_RXON_RF_FLAG_BIT 10 // 1 when rxon is enabled
#define A1846S_TXON_RF_FLAG_BIT 9 // 1 when txon is enabled
#define A1846S_CTCSS1_FLAG_BIT 9 // 1 when rxon is enabled
#define A1846S_CTCSS2_FLAG_BIT 8 // 1 when txon is enabled
#define A1846S_INVERT_DET_FLAG_BIT 7 // ctcss phase shift detect
#define A1846S_CSS_CMP_FLAG_BIT 2 // ctcss/cdcss compared
#define A1846S_SQ_FLAG_BIT 1 // sq final signal out from dsp
@@ -310,6 +309,7 @@ class HamShield {
uint8_t getCtcssDetThreshIn();
void setCtcssDetThreshOut(uint8_t thresh);
uint8_t getCtcssDetThreshOut();
bool getCtcssToneDetected();
// Ctcss_sel
// 1 = ctcss_cmp/cdcss_cmp out via gpio
@@ -413,6 +413,8 @@ class HamShield {
uint16_t getFMCssDeviation();
// RX voice range
void setMute();
void setUnmute();
void setVolume1(uint16_t volume);
uint16_t getVolume1();
void setVolume2(uint16_t volume);