2022/10/20 append Radio Module SR-FRS1W Change Frequency Memo

Intallation
$ git clone https://github.com/jumbo5566/SRFRS
$cd SRFRS
Example
[root@allstar ~]# python srfrs.py version
SRFRS: INFO: Firmware version: 110U-V223

[root@alarmpi SRFRS]# python srfrs.py radio --frequency 438.500
SRFRS: INFO: +DMOSETGROUP:0, RX frequency: 438.5000, TX frequency: 438.5000, squelch: 4, OK

[root@alarmpi SRFRS]# python srfrs.py radio --frequency 438.500 --offset -5
SRFRS: INFO: +DMOSETGROUP:0, RX frequency: 438.5000, TX frequency: 433.5000, squelch: 4, OK

[root@allstar ~]# python srfrs.py radio --frequency 145.230 --offset -.6 --ctcss 100
SRFRS: INFO: +DMOSETGROUP:0, RX frequency: 145.2300, TX frequency: 144.6300, ctcss: 100.0, squelch: 4, OK

[root@allstar ~]# python srfrs.py volume --level 5
SRFRS: INFO: +DMOSETVOLUME:0 Volume level: 5
If you use an FTDI dongle to program the SRFRS module the USB port can be specified with the --port argument
[root@allstar ~]# python srfrs.py --port /dev/ttyAMA0 volume --level 5
SRFRS: INFO: +DMOSETVOLUME:0 Volume level: 5
Usage
This program has for sections:
radio: Program the radio's frequency, tone and squelch level
volume: Set the volume level
version: display the firmware version of the SR-FRS module
usage: srfrs [-h] [--port PORT] [--debug]

            {radio,volume,filters,version} ...

generate configuration for switch port

positional arguments:
{radio,volume,filters,version}

radio               Program the radio (frequency/tome/squelch)
volume              Set the volume level
filters             Set filters
version             Show the firmware version of the SA818

optional arguments:
-h, --help show this help message and exit
--port PORT Serial port [default: linux console port]
--debug

change SI4735 libraries on aresq aq1 si4732 sdr radio fix the SPEAKER no sound bug

1.jpg
First change C:UsersAdministratorDocumentsArduinolibrariesSI4735-masterSI4735.h

/**
 * @ingroup group18 MCU External Audio Mute 
 * 
 * @brief Sets the Hardware Audio Mute
 * @details Turns the Hardware audio mute on or off
 * 
 * @see setAudioMuteMcuPin
 * 
 * @param on  True or false
 */
inline void setHardwareAudioMute(bool on)
{
    if(on){
    digitalWrite(audioMuteMcuPin, LOW);//Reverse the 27 MUTE pin connect PAM8406
    }else{
    digitalWrite(audioMuteMcuPin, HIGH);//Reverse the 27 MUTE pin connect PAM8406
    }
    delayMicroseconds(300);
}

then change SI4735_2.8_TFT_SI5351_V4.0_AQ1's code you like the SPEAKER work now
https://www.mmdvm.club/index.php/aq1.html

CHH552 DAP Link

https://github.com/posystorage/CH55x_HS_DAP-Link-v2

CH55x_HS_DAP-Link-v2
基于CH55x低成本USB单片机实现的汇编级优化高速DAP-Link-v2

介绍见:开源CH551/2实现的汇编优化高速DAP-Link (CMSIS-DAP v2)https://whycan.com/t_7786.html

SWD引脚 P1.5和P1.6需并联

SWC引脚 P1.5

串口引脚 P3.0 P3.1

5V下使用应该接1T45电平转换芯片 SWC-DIR P3.4 SWD-DIR P3.2

LED P1.1

复位1.4(接三极管)

拉高RST重新进ISP

使用3.3V供电时需要将两个供电脚短接(CH55xG的15和16脚)一坨锡

基于新唐M0的XXTEA加密解密算法源码

/*---------------------------------------------------------------------------------------------------------

在数据的加解密领域,算法分为对称密钥与非对称密钥两种。对称密钥与非对称密钥由于各自的特点,所应用的领域是不尽相

同的。对称密钥加密算法由于其速度快,一般用于整体数据的加密,而非对称密钥加密算法的安全性能佳,在数字签名领域得到广
泛的应用。

TEA算法是由剑桥大学计算机实验室的David Wheeler和Roger Needham于1994年发明,TEA是Tiny Encryption Algorithm的缩写,

以加密解密速度快,实现简单著称。TEA算法每一次可以操作64bit(8byte),采用128bit(16byte)作为key,算法采用迭代的形式,
推荐的迭代轮数是64轮,最少32轮。为解决TEA算法密钥表攻击的问题,TEA算法先后经历了几次改进,从XTEA到BLOCK TEA,直至
最新的XXTEA。XTEA也称做TEAN,它使用与TEA相同的简单运算,但四个子密钥采取不正规的方式进行混合以阻止密钥表攻击。

Block TEA算法可以对32位的任意整数倍长度的变量块进行加解密的操作,该算法将XTEA轮循函数依次应用于块中的每个字,并且

将它附加于被应用字的邻字。XXTEA使用跟Block TEA相似的结构,但在处理块中每个字时利用了相邻字,且用拥有两个输入量的
MX函数代替了XTEA轮循函数。本文所描述的安全机制采用的加密算法就是TEA算法中安全性能最佳的改进版本-XXTEA算法。

XXTEA算法的结构非常简单,只需要执行加法、异或和寄存的硬件即可,且软件实现的代码非常短小,具有可移植性,非常适合

嵌入式系统应用。由于XXTEA算法的以上优点,可以很好地应用于嵌入式RFID系统当中。

---------------------------------------------------------------------------------------------------------*/

include <string.h>

include <stdio.h>

define MX (z>>5^y<<2) + (y>>3^z<<4)^(sum^y) + (k[p&3^e]^z)

//注意:delta的取值是随机的,但是为了避免不良的取值,采取的是
//黄金分割数(根号5-2)/2与2的32次方的乘积。为0x9e3779b9。
//在解密中,sum=delta×round,如:delta×32=13C6EF3720

//v表示为运算的长整型数据的首地址
//k为长整型的密钥的首地址
//n表示以32bit为基本单位的要运算的组元个数,正表示加密,负表示解密

long xxtea(long v, long n, long k);

long xxtea(long v, long n, long k)
{
unsigned long z=v[n-1], y=v[0], sum=0, e, DELTA=0x9e3779b9;
long p, q;

if(n > 1)
{/ 加密过程 /
q = 6 + 52/n;
while(q-- > 0)
{
sum += DELTA; e = (sum >> 2) & 3;
for (p=0; p<n-1; p++) y = v[p+1], z = v[p] += MX;
y = v[0]; z = v[n-1] += MX;
}
return 0;
}
else
if(n < -1)
{/ 解密过程 /
n = -n; q = 6 + 52/n; sum = q*DELTA;
while(sum != 0)
{
e = (sum >> 2) & 3;
for (p=n-1; p>0; p--) z = v[p-1], y = v[p] -= MX;
z = v[n-1]; y = v[0] -= MX; sum -= DELTA;
}
return 0;
}
return 1;
}

void xxtea_test(void)
{
unsigned long buff[4];
unsigned long test[4]={0x11223344,0x55667788,0x99AABBCC,0xDDEEFF00};
unsigned long keys[4]={0x12345678,0x9ABCDEF0,0x12345678,0x9ABCDEF0};

while(1)
{
printf("nrxxtea test: nr");
memcpy(buff,test,16); printf("0x%08x,0x%08x,0x%08x,0x%08xnr",buff[0],buff[1],buff[2],buff[3]);
xxtea( buff, 4,keys); printf("0x%08x,0x%08x,0x%08x,0x%08xnr",buff[0],buff[1],buff[2],buff[3]);
xxtea( buff,-4,keys); printf("0x%08x,0x%08x,0x%08x,0x%08xnr",buff[0],buff[1],buff[2],buff[3]);

while(1);
}
}