From ed36f02455418bdbbbdd8cc45c3cc528ebadf3f5 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 8 Dec 2025 21:38:49 +0100 Subject: [PATCH] add Icom ID-52A/E Plus (cherry picked from commit d997bbd7b1f9057ad44fe99631f708ed15c352d6) --- include/hamlib/riglist.h | 1 + rigs/icom/Makefile.am | 2 +- rigs/icom/icom.c | 1 + rigs/icom/icom.h | 1 + rigs/icom/id52plus.c | 237 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 rigs/icom/id52plus.c diff --git a/include/hamlib/riglist.h b/include/hamlib/riglist.h index 3c59390e4..3a70ad854 100644 --- a/include/hamlib/riglist.h +++ b/include/hamlib/riglist.h @@ -348,6 +348,7 @@ #define RIG_MODEL_IC905 RIG_MAKE_MODEL(RIG_ICOM, 90) #define RIG_MODEL_X6200 RIG_MAKE_MODEL(RIG_ICOM, 91) /* Xiegu X6200 */ #define RIG_MODEL_IC7760 RIG_MAKE_MODEL(RIG_ICOM, 92) +#define RIG_MODEL_ID52PLUS RIG_MAKE_MODEL(RIG_ICOM, 93) /* * Optoelectronics (CI-V) diff --git a/rigs/icom/Makefile.am b/rigs/icom/Makefile.am index 38b3fd7e9..598581017 100644 --- a/rigs/icom/Makefile.am +++ b/rigs/icom/Makefile.am @@ -6,7 +6,7 @@ ICOMSRC = icom.c icom.h icom_defs.h icom_alt_agc.c icom_alt_agc.h frame.c frame. ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \ ic765.c ic781.c ic471.c icr9000.c icr9500.c \ icr10.c icr20.c icr30.c icr6.c icr71.c icr72.c icr75.c icrx7.c icr8600.c \ - id1.c id31.c id51.c id4100.c id5100.c perseus.c ic2730.c \ + id1.c id31.c id51.c id52plus.c id4100.c id5100.c perseus.c ic2730.c \ ic707.c ic728.c ic751.c ic761.c \ ic78.c ic7800.c ic785x.c \ ic7000.c ic7100.c ic7200.c ic7300.c ic7600.c ic7610.c ic7700.c ic7760.c icf8101.c \ diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 85686a68b..9c8d104e1 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -10168,6 +10168,7 @@ DECLARE_INITRIG_BACKEND(icom) rig_register(&id1_caps); rig_register(&id31_caps); rig_register(&id51_caps); + rig_register(&id52plus_caps); rig_register(&id4100_caps); rig_register(&id5100_caps); rig_register(&ic2730_caps); diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index e9636a1db..2740ddf35 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -509,6 +509,7 @@ extern struct rig_caps ic92d_caps; extern struct rig_caps id1_caps; extern struct rig_caps id31_caps; extern struct rig_caps id51_caps; +extern struct rig_caps id52plus_caps; extern struct rig_caps id4100_caps; extern struct rig_caps id5100_caps; extern struct rig_caps ic2730_caps; diff --git a/rigs/icom/id52plus.c b/rigs/icom/id52plus.c new file mode 100644 index 000000000..9acd00c6b --- /dev/null +++ b/rigs/icom/id52plus.c @@ -0,0 +1,237 @@ +/* + * Hamlib CI-V backend - description of ID-52A/E PLUS and variations + * Copyright (c) 2015 by Stephane Fillod + * Copyright (c) 2019 by Malcolm Herring + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "hamlib/rig.h" +#include "token.h" +#include "icom.h" +#include "idx_builtin.h" +#include "icom_defs.h" +#include "tones.h" + +/* + * Specs and protocol details from ID-52A_E_PLUS_ENG_CI-V_0.pdf + * + * The ID-52A/E PLUS connects via USB Type-C which provides a serial port. + * CI-V address is 0xB4 (from PDF data format section). + * + * Operating modes: FM (05 01), FM-N (05 02), DV (17 01), AM (02 01), AM-N (02 02) + * Power levels: S-Low, Low1, Low2, Mid, High (5 levels) + * Attenuator: OFF, 10dB (375-479 MHz), 30dB (108-374.995 MHz) + */ + +#define ID52PLUS_MODES (RIG_MODE_FM|RIG_MODE_DSTAR) +#define ID52PLUS_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_AMN|ID52PLUS_MODES) + +#define ID52PLUS_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB) + +#define ID52PLUS_SCAN_OPS RIG_SCAN_NONE + +#define ID52PLUS_VFO_OPS RIG_OP_NONE + +#define ID52PLUS_FUNC_ALL ( \ + RIG_FUNC_TONE| \ + RIG_FUNC_TSQL| \ + RIG_FUNC_CSQL| \ + RIG_FUNC_DSQL| \ + RIG_FUNC_VOX) + +#define ID52PLUS_LEVEL_ALL (RIG_LEVEL_AF| \ + RIG_LEVEL_SQL| \ + RIG_LEVEL_RAWSTR| \ + RIG_LEVEL_RFPOWER| \ + RIG_LEVEL_MICGAIN| \ + RIG_LEVEL_VOXGAIN| \ + RIG_LEVEL_ATT) + +#define ID52PLUS_PARM_ALL RIG_PARM_NONE + +int id52plus_tokens[] = { TOK_DSTAR_DSQL, TOK_DSTAR_CALL_SIGN, TOK_DSTAR_MESSAGE, TOK_DSTAR_STATUS, + TOK_DSTAR_GPS_DATA, TOK_DSTAR_GPS_MESS, TOK_DSTAR_CODE, TOK_DSTAR_TX_DATA, + TOK_DSTAR_MY_CS, TOK_DSTAR_TX_CS, TOK_DSTAR_TX_MESS, + TOK_BACKEND_NONE + }; + +/* + * S-meter calibration from CI-V command 15 02: + * Response range: 00 00 to 02 55 (S0 to S9) + */ +#define ID52PLUS_STR_CAL UNKNOWN_IC_STR_CAL + + + +/* + * ID-52A/E PLUS private capabilities + * CI-V Address: 0xB4 (from PDF: "FE FE B4 E0...") + */ +static struct icom_priv_caps id52plus_priv_caps = +{ + 0xB4, /* default address */ + 0, /* 731 mode */ + 1, /* no XCHG */ +}; + +struct rig_caps id52plus_caps = +{ + RIG_MODEL(RIG_MODEL_ID52PLUS), + .model_name = "ID-52A/E PLUS", + .mfg_name = "Icom", + .version = BACKEND_VER ".0", + .copyright = "LGPL", + .status = RIG_STATUS_BETA, + .rig_type = RIG_TYPE_HANDHELD, + .ptt_type = RIG_PTT_RIG, + .dcd_type = RIG_DCD_RIG, + .port_type = RIG_PORT_SERIAL, + .serial_rate_min = 4800, + .serial_rate_max = 19200, + .serial_data_bits = 8, + .serial_stop_bits = 1, + .serial_parity = RIG_PARITY_NONE, + .serial_handshake = RIG_HANDSHAKE_NONE, + .write_delay = 0, + .post_write_delay = 0, + .timeout = 1000, + .retry = 3, + .has_get_func = ID52PLUS_FUNC_ALL, + .has_set_func = ID52PLUS_FUNC_ALL, + .has_get_level = ID52PLUS_LEVEL_ALL, + .has_set_level = RIG_LEVEL_SET(ID52PLUS_LEVEL_ALL), + .has_get_parm = ID52PLUS_PARM_ALL, + .has_set_parm = ID52PLUS_PARM_ALL, + .level_gran = { + [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, + [LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/40.0f } }, + [LVL_SQL] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/11.0f } }, + [LVL_RFPOWER] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/5.0f } }, + [LVL_MICGAIN] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/4.0f } }, + [LVL_VOXGAIN] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/11.0f } }, + }, + .ext_tokens = id52plus_tokens, + .extparms = icom_ext_parms, + .parm_gran = {}, + .ctcss_list = common_ctcss_list, + .dcs_list = full_dcs_list, + .preamp = { RIG_DBLST_END, }, + .attenuator = { 10, 30, RIG_DBLST_END, }, + .max_rit = Hz(0), + .max_xit = Hz(0), + .max_ifshift = Hz(0), + .targetable_vfo = 0, + .vfo_ops = ID52PLUS_VFO_OPS, + .scan_ops = ID52PLUS_SCAN_OPS, + .transceive = RIG_TRN_RIG, + .bank_qty = 0, + .chan_desc_sz = 0, + + .chan_list = { + // There's no memory support through CI-V, + // but there is a clone mode apart. + RIG_CHAN_END, + }, + + /* Europe version - rx_range_list1, tx_range_list1 */ + .rx_range_list1 = { + {MHz(108), MHz(174), ID52PLUS_ALL_RX_MODES, -1, -1, ID52PLUS_VFO_ALL}, + {MHz(375), MHz(550), ID52PLUS_ALL_RX_MODES, -1, -1, ID52PLUS_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list1 = { + {MHz(144), MHz(146), ID52PLUS_MODES, W(0.5), W(5), ID52PLUS_VFO_ALL}, + {MHz(430), MHz(440), ID52PLUS_MODES, W(0.5), W(5), ID52PLUS_VFO_ALL}, + RIG_FRNG_END, + }, + + /* USA version - rx_range_list2, tx_range_list2 */ + .rx_range_list2 = { + {MHz(108), MHz(174), ID52PLUS_ALL_RX_MODES, -1, -1, ID52PLUS_VFO_ALL}, + {MHz(375), MHz(550), ID52PLUS_ALL_RX_MODES, -1, -1, ID52PLUS_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list2 = { + {MHz(144), MHz(148), ID52PLUS_MODES, W(0.5), W(5), ID52PLUS_VFO_ALL}, + {MHz(430), MHz(450), ID52PLUS_MODES, W(0.5), W(5), ID52PLUS_VFO_ALL}, + RIG_FRNG_END, + }, + + .tuning_steps = { + // Rem: no support for changing tuning step + {RIG_MODE_ALL, 1}, + RIG_TS_END, + }, + + /* mode/filter list, remember: order matters! */ + .filters = { + {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, + {RIG_MODE_FM | RIG_MODE_AM, kHz(6)}, + {RIG_MODE_AMN, kHz(6)}, + {RIG_MODE_DSTAR, kHz(6)}, + RIG_FLT_END, + }, + .str_cal = ID52PLUS_STR_CAL, + + .cfgparams = icom_cfg_params, + .set_conf = icom_set_conf, + .get_conf = icom_get_conf, + + .priv = (void *)& id52plus_priv_caps, + .rig_init = icom_init, + .rig_cleanup = icom_cleanup, + .rig_open = icom_rig_open, + .rig_close = icom_rig_close, + .set_powerstat = icom_set_powerstat, +// .get_powerstat = icom_get_powerstat, // not capable + + .set_freq = icom_set_freq, + .get_freq = icom_get_freq, + .set_mode = icom_set_mode, + .get_mode = icom_get_mode, + .set_vfo = icom_set_vfo, + + .decode_event = icom_decode_event, + + .set_func = icom_set_func, + .get_func = icom_get_func, + .set_level = icom_set_level, + .get_level = icom_get_level, + .set_parm = icom_set_parm, + .get_parm = icom_get_parm, + .set_ext_parm = icom_set_ext_parm, + .get_ext_parm = icom_get_ext_parm, + + .set_ptt = icom_set_ptt, + .get_ptt = icom_get_ptt, + .get_dcd = icom_get_dcd, + + .set_rptr_shift = icom_set_rptr_shift, + .get_rptr_shift = icom_get_rptr_shift, + .set_rptr_offs = icom_set_rptr_offs, + .get_rptr_offs = icom_get_rptr_offs, + .set_ctcss_tone = icom_set_ctcss_tone, + .get_ctcss_tone = icom_get_ctcss_tone, + .set_dcs_code = icom_set_dcs_code, + .get_dcs_code = icom_get_dcs_code, + .set_ctcss_sql = icom_set_ctcss_sql, + .get_ctcss_sql = icom_get_ctcss_sql, + .set_dcs_sql = icom_set_dcs_sql, + .get_dcs_sql = icom_get_dcs_sql, + .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS +};