kopia lustrzana https://github.com/F5OEO/rpidatv
Merge pull request #51 from davecrump/master
All contributions from Dave - Major updates in install/gui/configmaster
commit
4522fc3724
109
README.md
109
README.md
|
@ -1,81 +1,48 @@
|
|||
![rpidatv banner](/doc/img/spectreiq.jpg)
|
||||
# rpidatv
|
||||
**rpidatv** is a digital television transmitter for Raspberry Pi (B,B+,PI2,PI3,Pizero) which output directly to GPIO.
|
||||
**rpidatv** is a digital television transmitter for Raspberry Pi (B,B+,PI2,PI3,Pizero) which outputs directly to GPIO. This version has been developed for use with an external synthesized oscillaotor and modulator/filter board.
|
||||
*(Created by Evariste Courjaud F5OEO. Code is GPL)*
|
||||
|
||||
# Installation
|
||||
Install a Raspbian Lite : ([Raspbian Lite](http://www.raspberrypi.org/downloads/raspbian/))
|
||||
# Installation for BATC Version
|
||||
|
||||
The preferred installation method only needs a Windows PC connected to the same (inetrnet-connected) network as your Raspberry Pi.
|
||||
|
||||
- First download the March 2016 release of Raspbian Jessie Lite on to your Windows PC from here http://downloads.raspberrypi.org/raspbian_lite/images//raspbian_lite-2016-03-18/. Evariste has not tested with later Raspbian images. There are some problems with the latest version of Raspbian, which Evariste and I are working to resolve.
|
||||
|
||||
- Unzip the image and then transfer it to a Micro-SD Card using Win32diskimager https://sourceforge.net/projects/win32diskimager/
|
||||
|
||||
- Power up the Pi with the new card inserted, and a network connection. No keyboard or display required.
|
||||
|
||||
- Find the IP address of your Raspberry Pi using an IP Scanner (such as Advanced IP Scanner http://filehippo.com/download_advanced_ip_scanner/ for Windows, or Fing on an iPhone) to get the Pi's IP address
|
||||
|
||||
- From your windows PC use Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) to log in to the IP address that you noted earlier.
|
||||
|
||||
- Log in (user: pi/password: raspberry), and type "sudo raspi-config" to open the configuration tool. Select option 1 to expand the file system to the whole disk.
|
||||
|
||||
- Exit raspi-config (press tab twice then press return), and reboot.
|
||||
|
||||
- Power-off, connect the camera, reconnect power and reboot. Log in again.
|
||||
|
||||
- Cut and paste the following code in, one line at a time:
|
||||
|
||||
```sh
|
||||
$ wget https://raw.githubusercontent.com/F5OEO/rpidatv/master/install.sh
|
||||
$ chmod +x install.sh
|
||||
$ ./install.sh
|
||||
wget https://raw.githubusercontent.com/davecrump/rpidatv/master/install.sh
|
||||
chmod +x install.sh
|
||||
./install.sh
|
||||
```
|
||||
|
||||
# Hardware
|
||||
Plug a wire on GPIO 12, means Pin 32 of the GPIO header : this act as the antenna. Length depend on transmit frequency, but with few centimeters it works for local testing.
|
||||
|
||||
# Modulator
|
||||
**rpidatv** is located in rpidatv/bin folder
|
||||
```
|
||||
rpidatv -2.0.0
|
||||
Usage:
|
||||
rpidatv -i File Input -s Symbolrate -c Fec [-o OutputMode] [-f frequency output] [-l] [-p Power] [-h]
|
||||
-i path to Transport File Input
|
||||
-s SymbolRate in KS (125-4000)
|
||||
-c Fec : 1/2 or 3/4 or 5/6 or 7/8
|
||||
-m OutputMode
|
||||
{RF(Modulate QSK in RF need -f option to set frequency)}
|
||||
{IQ(Output QPSK I/Q}
|
||||
{PARALLEL(Output parallel (DTX1,MINIMOD..)}
|
||||
{IQWITHCLK(Output I/Q with CLK (F5LGJ)}
|
||||
{DIGITHIN (Output I/Q for Digithin)}
|
||||
-f Frequency to output in RF Mode in MHZ
|
||||
-l loop file input
|
||||
-p Power on output 1..7
|
||||
-x GPIO Pin output for I or RF {12,18,40}
|
||||
-y GPIO Pin output for Q {13,19,41,45}
|
||||
-h help (print this help).
|
||||
Example : sudo ./rpidatv -i sample.ts -s 250 -c 1/2 -o RF -f 437.5 -l
|
||||
```
|
||||
# Transport stream
|
||||
**rpidatv** needs a DVB transport stream in input. In the past, ffmpeg was used to generate transport stream. Because ffmpeg is not completely DVB compliant and induces latency, an other tool is proposed : **avc2ts**
|
||||
|
||||
# H264 encoder and transport stream encapsulator
|
||||
**avc2ts** is located in rpidatv/bin folder
|
||||
```
|
||||
avc2ts -1.0.0
|
||||
Usage:
|
||||
rpi-avc2ts -o OutputFile -b BitrateVideo -m BitrateMux -x VideoWidth -y VideoHeight -f Framerate -n MulticastGroup [-d PTS/PCR][-v][-h]
|
||||
-o path to Transport File Output
|
||||
-b VideoBitrate in bit/s
|
||||
-m Multiplex Bitrate (should be around 1.4 VideoBitrate)
|
||||
-x VideoWidth (should be 16 pixel aligned)
|
||||
-y VideoHeight (should be 16 pixel aligned)
|
||||
-f Framerate (25 for example)
|
||||
-n Multicast group (optionnal) example 230.0.0.1:10000
|
||||
-d Delay PTS/PCR in ms
|
||||
-v Enable Motion vectors
|
||||
-i IDR Period
|
||||
-t TypeInput {0=Picamera,1=InternalPatern,2=USB Camera,3=Rpi Display,4=VNC}
|
||||
-e Extra Arg:
|
||||
- For usb camera name of device (/dev/video0)
|
||||
- For VNC : IP address of VNC Server. Password must be datv
|
||||
-p Set the PidStart: Set PMT=PIDStart,Pidvideo=PidStart+1,PidAudio=PidStart+2
|
||||
-s Set Servicename : Typically CALL
|
||||
-h help (print this help).
|
||||
Example : ./rpi-avc2ts -o result.ts -b 1000000 -m 1400000 -x 640 -y 480 -f 25 -n 230.0.0.1:1000
|
||||
```
|
||||
|
||||
# Console interface
|
||||
A console interface is provided under rpidatv/scripts
|
||||
- For French menus and keyboard, replace the last line above with
|
||||
```sh
|
||||
$ /home/pi/rpidatv/scripts/gbmenu.sh
|
||||
```
|
||||
# Touchscreen interface
|
||||
![Rpidatvgui](/doc/img/rpidatvgui.jpg)
|
||||
A graphical interface is provided under rpidatv/bin/ folder
|
||||
```sh
|
||||
$ /home/pi/rpidatv/bin/rpidatvgui
|
||||
./install.sh fr
|
||||
```
|
||||
|
||||
- When it has finished, accept the reboot offered or type "sudo reboot now", log in again and then start the software by typing:
|
||||
|
||||
```sh
|
||||
/home/pi/rpidatv/scripts/menu.sh menu
|
||||
```
|
||||
|
||||
You can now explore the menu options and play.
|
||||
|
||||
Evariste has only tested on an RPi2, I have been using an RPi3. I succeeded in generating a direct RF output (from GPIO pin 32) on 437 MHz at 333KS using the on-board camera as the source; it would not work reliably at higher SRs. The big win for me is that I could feed the I and Q signals from pins 32 and 33 directly into the LC filter on my old DigiLite modulator and generate a 2MS QPSK H264 DVB-S signal from the on-board camera. Some adjustment of the bias is required as the I and Q signals from the Pi are 3.3v, not 5v as provided by the DigiLite encoder.
|
||||
|
||||
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
107
install.sh
107
install.sh
|
@ -1,86 +1,91 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
# Updated by davecrump on 20161208
|
||||
|
||||
set -e # Don't report errors....
|
||||
|
||||
# Update the package manager, then install the packages we need
|
||||
sudo dpkg --configure -a
|
||||
sudo apt-get clean
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install apt-transport-https git rpi-update
|
||||
sudo apt-get -y install cmake libusb-1.0-0-dev g++ libx11-dev buffer libjpeg-dev indent libfreetype6-dev ttf-dejavu-core bc usbmount fftw3-dev wiringpi libvncserver-dev
|
||||
|
||||
#rpi-update to get latest firmware
|
||||
# rpi-update to get latest firmware
|
||||
sudo rpi-update
|
||||
|
||||
# ---------- install rpidatv -----------
|
||||
|
||||
# Get the source software and copy to the Pi
|
||||
cd /home/pi
|
||||
#git clone git://github.com/F5OEO/rpidatv -> BUG IN QEMU : Go to download method
|
||||
wget https://github.com/F5OEO/rpidatv/archive/master.zip
|
||||
wget https://github.com/davecrump/rpidatv/archive/master.zip
|
||||
unzip -o master.zip
|
||||
mv rpidatv-master rpidatv
|
||||
rm master.zip
|
||||
|
||||
#rpidatv core
|
||||
# Compile rpidatv core
|
||||
cd rpidatv/src
|
||||
make
|
||||
sudo make install
|
||||
#rpidatv gui
|
||||
|
||||
# Compile rpidatv gui
|
||||
cd gui
|
||||
make
|
||||
sudo make install
|
||||
cd ../
|
||||
#avc2ts
|
||||
cd avc2ts
|
||||
|
||||
#git clone git://github.com/kierank/libmpegts
|
||||
# Get libmpegts and compile
|
||||
cd avc2ts
|
||||
wget https://github.com/kierank/libmpegts/archive/master.zip
|
||||
unzip master.zip
|
||||
mv libmpegts-master libmpegts
|
||||
rm master.zip
|
||||
|
||||
cd libmpegts
|
||||
./configure
|
||||
make
|
||||
#make avc2ts
|
||||
|
||||
# Compile avc2ts
|
||||
cd ../
|
||||
make
|
||||
sudo make install
|
||||
|
||||
# Compile adf4351
|
||||
cd /home/pi/rpidatv/src/adf4351
|
||||
make
|
||||
cp adf4351 ../../bin/
|
||||
|
||||
|
||||
#install rtl_sdr
|
||||
# Get rtl_sdr
|
||||
cd /home/pi
|
||||
#git clone https://github.com/keenerd/rtl-sdr
|
||||
wget https://github.com/keenerd/rtl-sdr/archive/master.zip
|
||||
unzip master.zip
|
||||
mv rtl-sdr-master rtl-sdr
|
||||
rm master.zip
|
||||
|
||||
# Compile and install rtl-sdr
|
||||
cd rtl-sdr/ && mkdir build && cd build
|
||||
cmake ../ -DINSTALL_UDEV_RULES=ON
|
||||
make && sudo make install && sudo ldconfig
|
||||
sudo bash -c 'echo -e "\n# for RTL-SDR:\nblacklist dvb_usb_rtl28xxu\n" >> /etc/modprobe.d/blacklist.conf'
|
||||
cd ../../
|
||||
|
||||
#install leandvb
|
||||
# Get leandvb
|
||||
cd /home/pi/rpidatv/src
|
||||
#git clone git://github.com/pabr/leansdr
|
||||
wget https://github.com/pabr/leansdr/archive/master.zip
|
||||
unzip master.zip
|
||||
mv leansdr-master leansdr
|
||||
rm master.zip
|
||||
|
||||
# Compile leandvb
|
||||
cd leansdr/src/apps
|
||||
make
|
||||
cp leandvb ../../../../bin/
|
||||
|
||||
|
||||
#install tstools
|
||||
# Get tstools
|
||||
cd /home/pi/rpidatv/src
|
||||
wget https://github.com/F5OEO/tstools/archive/master.zip
|
||||
unzip master.zip
|
||||
mv tstools-master tstools
|
||||
rm master.zip
|
||||
|
||||
# Compile tstools
|
||||
cd tstools
|
||||
make
|
||||
cp bin/ts2es ../../bin/
|
||||
|
@ -94,7 +99,6 @@ cd /home/pi/rpidatv/src/hello_video
|
|||
make
|
||||
cp hello_video.bin ../../bin/
|
||||
|
||||
|
||||
# TouchScreen GUI
|
||||
# FBCP : Duplicate Framebuffer 0 -> 1
|
||||
cd /home/pi/
|
||||
|
@ -102,7 +106,8 @@ wget https://github.com/tasanakorn/rpi-fbcp/archive/master.zip
|
|||
unzip master.zip
|
||||
mv rpi-fbcp-master rpi-fbcp
|
||||
rm master.zip
|
||||
#git clone https://github.com/tasanakorn/rpi-fbcp
|
||||
|
||||
# Compile fbcp
|
||||
cd rpi-fbcp/
|
||||
mkdir build
|
||||
cd build/
|
||||
|
@ -111,46 +116,50 @@ make
|
|||
sudo install fbcp /usr/local/bin/fbcp
|
||||
cd ../../
|
||||
|
||||
#Install Waveshare DTOVERLAY
|
||||
# Install Waveshare DTOVERLAY
|
||||
cd /home/pi/rpidatv/scripts/
|
||||
sudo cp ./waveshare35a.dtbo /boot/overlays/
|
||||
|
||||
|
||||
#Fallback IP to 192.168.1.60
|
||||
# Fallback IP to 192.168.1.60
|
||||
sudo bash -c 'echo -e "\nprofile static_eth0\nstatic ip_address=192.168.1.60/24\nstatic routers=192.168.1.1\nstatic domain_name_servers=192.168.1.1\ninterface eth0\nfallback static_eth0" >> /etc/dhcpcd.conf'
|
||||
|
||||
#enable camera
|
||||
# Enable camera
|
||||
sudo bash -c 'echo -e "\ngpu_mem=128\nstart_x=1\n" >> /boot/config.txt'
|
||||
|
||||
#disable sync option for usbmount
|
||||
# Disable sync option for usbmount
|
||||
sudo sed -i 's/sync,//g' /etc/usbmount/usbmount.conf
|
||||
|
||||
# Install executable for hardware shutdown button
|
||||
wget 'https://github.com/philcrump/pi-sdn/releases/download/v1.0/pi-sdn' -O /home/pi/pi-sdn
|
||||
chmod +x /home/pi/pi-sdn
|
||||
|
||||
if [ "$1" == "Autostart" ];
|
||||
then
|
||||
echo "Doing autostart..."
|
||||
##Menu autostart
|
||||
# Record Version Number
|
||||
cd /home/pi/rpidatv/scripts/
|
||||
##make kayboard in french
|
||||
sudo cp keyfr /etc/default/keyboard
|
||||
##do Menu as auto install
|
||||
bash install_autostart.sh
|
||||
cp latest_version.txt installed_version.txt
|
||||
cd /home/pi
|
||||
|
||||
#change hostname
|
||||
CURRENT_HOSTNAME=`sudo cat /etc/hostname | sudo tr -d " \t\n\r"`
|
||||
NEW_HOSTNAME="rpidatv"
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo sh -c "echo '$NEW_HOSTNAME' > /etc/hostname"
|
||||
sudo sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts
|
||||
fi
|
||||
#change password to tv
|
||||
echo "pi:tv" | sudo chpasswd
|
||||
# Switch to French if required
|
||||
if [ "$1" == "fr" ];
|
||||
then
|
||||
echo "Installing French Language and Keyboard"
|
||||
cd /home/pi/rpidatv/scripts/
|
||||
sudo cp configs/keyfr /etc/default/keyboard
|
||||
cp configs/rpidatvconfig.fr rpidatvconfig.txt
|
||||
cd /home/pi
|
||||
echo "Completed French Install"
|
||||
else
|
||||
echo "completed without autostart"
|
||||
echo "Completed English Install"
|
||||
fi
|
||||
#always enable HDMI at 720p
|
||||
#sudo bash -c 'echo -e "\nhdmi_force_hotplug=1\nhdmi_drive=2\nhdmi_group=1\nhdmi_mode=4\n" >> /boot/config.txt'
|
||||
|
||||
# Offer reboot
|
||||
printf "A reboot will be required before using the software."
|
||||
printf "Do you want to reboot now? (y/n)\n"
|
||||
read -n 1
|
||||
printf "\n"
|
||||
if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then
|
||||
echo "rebooting"
|
||||
sudo reboot now
|
||||
fi
|
||||
exit
|
||||
|
||||
|
||||
#remove script that starts raspi config on first boot
|
||||
#sudo rm -rf /etc/profile.d/raspi-config.sh
|
||||
|
|
12
scripts/a.sh
12
scripts/a.sh
|
@ -97,6 +97,7 @@ case "$MODE_OUTPUT" in
|
|||
OUTPUT=videots
|
||||
MODE=IQ
|
||||
$PATHSCRIPT"/ctlfilter.sh"
|
||||
$PATHSCRIPT"/ctlvco.sh"
|
||||
#GAIN=0
|
||||
;;
|
||||
QPSKRF)
|
||||
|
@ -113,7 +114,9 @@ case "$MODE_OUTPUT" in
|
|||
OUTPUT=videots
|
||||
DIGITHIN_MODE=1
|
||||
MODE=DIGITHIN
|
||||
#GAIN=0
|
||||
$PATHSCRIPT"/ctlfilter.sh"
|
||||
$PATHSCRIPT"/ctlvco.sh"
|
||||
#GAIN=0
|
||||
;;
|
||||
DTX1)
|
||||
MODE=PARALLEL
|
||||
|
@ -311,8 +314,6 @@ $PATHRPI"/avc2ts" -b $BITRATE_VIDEO -m $BITRATE_TS -x $VIDEO_WIDTH -y $VIDEO_HEI
|
|||
;;
|
||||
|
||||
#============================================ ANALOG =============================================================
|
||||
|
||||
|
||||
"ANALOGCAM")
|
||||
sudo modprobe -r bcm2835_v4l2
|
||||
case "$MODE_OUTPUT" in
|
||||
|
@ -328,6 +329,7 @@ $PATHRPI"/avc2ts" -b $BITRATE_VIDEO -m $BITRATE_TS -x $VIDEO_WIDTH -y $VIDEO_HEI
|
|||
|
||||
;;
|
||||
|
||||
#============================================ DESKTOP =============================================================
|
||||
"DESKTOP")
|
||||
sudo modprobe -r bcm2835_v4l2
|
||||
case "$MODE_OUTPUT" in
|
||||
|
@ -358,11 +360,11 @@ $PATHRPI"/mnc" -l -i eth0 -p $PORT $UDPINADDR > videots &
|
|||
|
||||
# *********************************** TRANSPORT STREAM INPUT FILE ******************************************
|
||||
"FILETS")
|
||||
|
||||
|
||||
case "$MODE_OUTPUT" in
|
||||
"BATC")
|
||||
sudo nice -n -30 $PATHRPI"/ffmpeg" -loglevel $MODE_DEBUG -i $TSVIDEOFILE -y $OUTPUT_BATC & ;;
|
||||
|
||||
|
||||
*)
|
||||
sudo $PATHRPI"/rpidatv" -i $TSVIDEOFILE -s $SYMBOLRATE_K -c $FECNUM"/"$FECDEN -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q &;;
|
||||
esac
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux
|
|
@ -0,0 +1,122 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
||||
./rpidatv/scripts/rpibutton.sh
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
#con2fbmap 1 1
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
||||
./rpidatv/scripts/menu.sh menu
|
|
@ -0,0 +1,2 @@
|
|||
## Console selected
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
#con2fbmap 1 1
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
||||
|
||||
./rpidatv/scripts/menu.sh
|
|
@ -0,0 +1,124 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
||||
sudo killall fbcp
|
||||
fbcp &
|
||||
./rpidatv/bin/rpidatvgui
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
||||
sudo killall fbcp
|
||||
fbcp &
|
||||
./rpidatv/bin/rpidatvgui 1
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
hdmi_group=2
|
||||
hdmi_mode=1
|
||||
hdmi_mode=87
|
||||
hdmi_cvt 800 480 60 6 0 0 0
|
||||
dtparam=spi=on
|
||||
|
||||
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
|
|
@ -0,0 +1,10 @@
|
|||
# KEYBOARD CONFIGURATION FILE
|
||||
|
||||
# Consult the keyboard(5) manual page.
|
||||
|
||||
XKBMODEL="pc105"
|
||||
XKBLAYOUT="us"
|
||||
XKBVARIANT=""
|
||||
XKBOPTIONS=""
|
||||
|
||||
BACKSPACE="guess"
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
## Begin LCD Driver
|
||||
## No driver loaded
|
||||
## End LCD Driver
|
|
@ -0,0 +1,130 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
## Tidy shutdown by hardware button
|
||||
## Button to 3.3v on physical pin 15. LED to indicate still running on pin 13
|
||||
## See https://github.com/philcrump/pi-sdn
|
||||
## Calls .pi-sdn if present and runs "sudo pi-sdn 3 2 &"
|
||||
|
||||
if [ -f ~/.pi-sdn ]; then
|
||||
. ~/.pi-sdn
|
||||
fi
|
||||
|
||||
## Facility to Disable WiFi
|
||||
## Calls .wifi_off if present and runs "sudo ifconfig wlan0 down"
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
. ~/.wifi_off
|
||||
fi
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
modeinput=PATERNAUDIO
|
||||
symbolrate=250
|
||||
fec=7
|
||||
freqoutput=437
|
||||
rfpower=7
|
||||
modeoutput=QPSKRF
|
||||
tsvideofile=/home/pi/rpidatv/video/f4day.ts
|
||||
call=F5OEO
|
||||
paternfile=/home/pi/rpidatv/video
|
||||
udpinaddr=230.0.0.2
|
||||
pidvideo=1001
|
||||
pidpmt=1000
|
||||
serviceid=1
|
||||
gpio_i=12
|
||||
gpio_q=13
|
||||
pathmedia=/home/pi/rpidatv/video
|
||||
locator=JNO6EP
|
||||
pidstart=1000
|
||||
pidaudio=1002
|
||||
display=Waveshare
|
||||
menulanguage=fr
|
|
@ -0,0 +1,8 @@
|
|||
## called by .bashrc at log-on to enable hardware button shutdown
|
||||
## If this file is in ~, then hardware button shutdown is enabled
|
||||
|
||||
sudo ~/pi-sdn 3 2 &
|
||||
|
||||
##
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
## called by .bashrc at log-on to diable wifi
|
||||
## If this file is not in ~, then wifi is allowed to start
|
||||
|
||||
sudo ifconfig wlan0 down
|
||||
|
||||
## Only way to restart wifi is to reboot
|
|
@ -0,0 +1,3 @@
|
|||
dtparam=spi=on
|
||||
dtoverlay=mz61581
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
dtparam=spi=on
|
||||
dtoverlay=waveshare35a
|
||||
dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=1000000,keep_vref_on=1,swapxy=1,pmax=255,xohms=60,xmin=200,xmax=3900,ymin=200,ymax=3900
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
##STARTNW
|
||||
## No network loaded
|
||||
##ENDNW
|
|
@ -0,0 +1,4 @@
|
|||
network={
|
||||
ssid="PixienetG"
|
||||
psk=b7a2fc71b648e214d337ca533c8c506167fc8f463477c50df379067cc3341912
|
||||
}
|
|
@ -1,28 +1,56 @@
|
|||
########## ctlfilter.sh ############
|
||||
|
||||
# Called by a.sh in IQ mode to switch in correct
|
||||
# Nyquist Filter
|
||||
# Nyquist Filter and band switching
|
||||
# Written by Dave G8GKQ 26 Nov 16 and 4 Dec 16
|
||||
|
||||
# SR Outputs:
|
||||
|
||||
# <130 000
|
||||
# <260 001
|
||||
# <360 010
|
||||
# <550 011
|
||||
# <1100 100
|
||||
# <2200 101
|
||||
# >=2200 110
|
||||
|
||||
# Band Outputs:
|
||||
|
||||
# <100 00 (71 MHz)
|
||||
# <250 01 (146.5 MHz)
|
||||
# <950 10 (437 MHz)
|
||||
# <4400 11 (1255 MHz)
|
||||
|
||||
# Non integer frequencies are rounded down
|
||||
|
||||
############ Set Environment Variables ###############
|
||||
|
||||
|
||||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
|
||||
|
||||
############### PIN DEFINITION ###########
|
||||
############### PIN DEFINITIONS ###########
|
||||
|
||||
#filter_bit0 LSB of filter control word=GPIO 16 / Header 36
|
||||
#filter_bit0 LSB of filter control word = BCM 16 / Header 36
|
||||
filter_bit0=16
|
||||
|
||||
#filter_bit1 Mid Bit of filter control word=GPIO 26 / Header 37
|
||||
#filter_bit1 Mid Bit of filter control word = BCM 26 / Header 37
|
||||
filter_bit1=26
|
||||
|
||||
#filter_bit0 MSB of filter control word=GPIO 20 / Header 38
|
||||
#filter_bit0 MSB of filter control word = BCM 20 / Header 38
|
||||
filter_bit2=20
|
||||
|
||||
#band_bit_0 LSB of band switching word = BCM 1 / Header 28
|
||||
band_bit0=1
|
||||
|
||||
#band_bit_1 MSB of band switching word = BCM 19 / Header 35
|
||||
band_bit1=19
|
||||
|
||||
# Set all as outputs
|
||||
gpio -g mode $filter_bit0 out
|
||||
gpio -g mode $filter_bit1 out
|
||||
gpio -g mode $filter_bit2 out
|
||||
gpio -g mode $band_bit0 out
|
||||
gpio -g mode $band_bit1 out
|
||||
|
||||
############### Function to read Config File ###############
|
||||
|
||||
|
@ -47,45 +75,62 @@ SYMBOLRATEK=$(get_config_var symbolrate $CONFIGFILE)
|
|||
|
||||
############### Switch GPIOs based on Symbol Rate ########
|
||||
|
||||
case "$SYMBOLRATEK" in
|
||||
125)
|
||||
if (( $SYMBOLRATEK \< 130 )); then
|
||||
gpio -g write $filter_bit0 0;
|
||||
gpio -g write $filter_bit1 0;
|
||||
gpio -g write $filter_bit2 0;
|
||||
;;
|
||||
250)
|
||||
gpio -g write $filter_bit0 1;
|
||||
gpio -g write $filter_bit2 0;
|
||||
elif (( $SYMBOLRATEK \< 260 )); then
|
||||
gpio -g write $filter_bit0 1;
|
||||
gpio -g write $filter_bit1 0;
|
||||
gpio -g write $filter_bit2 0;
|
||||
;;
|
||||
333)
|
||||
elif (( $SYMBOLRATEK \< 360 )); then
|
||||
gpio -g write $filter_bit0 0;
|
||||
gpio -g write $filter_bit1 1;
|
||||
gpio -g write $filter_bit2 0;
|
||||
;;
|
||||
500)
|
||||
elif (( $SYMBOLRATEK \< 550 )); then
|
||||
gpio -g write $filter_bit0 1;
|
||||
gpio -g write $filter_bit1 1;
|
||||
gpio -g write $filter_bit2 0;
|
||||
;;
|
||||
1000)
|
||||
elif (( $SYMBOLRATEK \< 1100 )); then
|
||||
gpio -g write $filter_bit0 0;
|
||||
gpio -g write $filter_bit1 0;
|
||||
gpio -g write $filter_bit2 1;
|
||||
;;
|
||||
2000)
|
||||
elif (( $SYMBOLRATEK \< 2200 )); then
|
||||
gpio -g write $filter_bit0 1;
|
||||
gpio -g write $filter_bit1 0;
|
||||
gpio -g write $filter_bit2 1;
|
||||
;;
|
||||
*)
|
||||
gpio -g write $filter_bit0 1;
|
||||
gpio -g write $filter_bit1 0;
|
||||
else
|
||||
gpio -g write $filter_bit0 0;
|
||||
gpio -g write $filter_bit1 1;
|
||||
gpio -g write $filter_bit2 1;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
############### Read Frequency #########################
|
||||
|
||||
FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
|
||||
|
||||
INT_FREQ_OUTPUT=${FREQ_OUTPUT%.*}
|
||||
|
||||
############### Switch GPIOs based on Frequency ########
|
||||
|
||||
if (( $INT_FREQ_OUTPUT \< 100 )); then
|
||||
gpio -g write $band_bit0 0;
|
||||
gpio -g write $band_bit1 0;
|
||||
elif (( $INT_FREQ_OUTPUT \< 250 )); then
|
||||
gpio -g write $band_bit0 1;
|
||||
gpio -g write $band_bit1 0;
|
||||
elif (( $INT_FREQ_OUTPUT \< 950 )); then
|
||||
gpio -g write $band_bit0 0;
|
||||
gpio -g write $band_bit1 1;
|
||||
elif (( $INT_FREQ_OUTPUT \< 4400 )); then
|
||||
gpio -g write $band_bit0 1;
|
||||
gpio -g write $band_bit1 1;
|
||||
else
|
||||
gpio -g write $band_bit0 0;
|
||||
gpio -g write $band_bit1 0;
|
||||
fi
|
||||
|
||||
### End ###
|
||||
|
||||
# Revert to a.sh #
|
||||
# Revert to menu.sh or a.sh #
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
########## ctlvco.sh ############
|
||||
|
||||
# Called by a.sh in IQ mode to set ADF4351
|
||||
# vco to correct frequency
|
||||
|
||||
############ Set Environment Variables ###############
|
||||
|
||||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
PATHRPI=/home/pi/rpidatv/bin
|
||||
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
|
||||
|
||||
############### Function to read Config File ###############
|
||||
|
||||
get_config_var() {
|
||||
lua - "$1" "$2" <<EOF
|
||||
local key=assert(arg[1])
|
||||
local fn=assert(arg[2])
|
||||
local file=assert(io.open(fn))
|
||||
for line in file:lines() do
|
||||
local val = line:match("^#?%s*"..key.."=(.*)$")
|
||||
if (val ~= nil) then
|
||||
print(val)
|
||||
break
|
||||
end
|
||||
end
|
||||
EOF
|
||||
}
|
||||
|
||||
############### Read Frequency #########################
|
||||
|
||||
FREQM=$(get_config_var freqoutput $CONFIGFILE)
|
||||
|
||||
############### Call binary to set frequency ########
|
||||
|
||||
sudo $PATHRPI"/adf4351" $FREQM
|
||||
|
||||
### End ###
|
||||
|
||||
# Revert to a.sh #
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
|
||||
|
||||
source $PATHSCRIPT"/langfr.sh"
|
||||
source $PATHSCRIPT"/menu.sh"
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
|
||||
|
||||
source $PATHSCRIPT"/langgb.sh"
|
||||
source $PATHSCRIPT"/menu.sh"
|
||||
|
||||
|
||||
|
|
@ -85,21 +85,35 @@ StrAutostartMenu="Démarrage automatique"
|
|||
StrDisplayMenu="Ecran"
|
||||
StrIPMenu="Adresse IP"
|
||||
|
||||
######## AUTOSTART MENU #########
|
||||
|
||||
StrAutostartSetupTitle="Configure le démarrage"
|
||||
StrAutostartSetupContext="Choix:"
|
||||
AutostartSetupConsole="Menu console(ce menu)"
|
||||
AutostartSetupDisplay="Graphique(avec ecran tactile)"
|
||||
AutostartSetupButton="Boutons poussoires"
|
||||
AutostartSetupPrompt="Log-on to Linux Command Prompt"
|
||||
AutostartSetupConsole="Log-on to rpidatv Menu"
|
||||
AutostartSetupDisplay="Log-on to start Graphique(avec ecran tactile)"
|
||||
AutostartSetupButton="Log-on to enable Boutons poussoires"
|
||||
AutostartSetupTX_boot="Boot-up to Transmit"
|
||||
AutostartSetupDisplay_boot="Boot-up to Graphique(avec ecran tactile)"
|
||||
AutostartSetupButton_boot="Boot-up to Boutons poussoires"
|
||||
|
||||
StrDisplaySetupTitle="Configure un ecran tactile"
|
||||
######## TOUCHSCREEN MENU #########
|
||||
|
||||
StrDisplaySetupTitle="Configure un ecran tactile - apres reboot"
|
||||
StrDisplaySetupContext="Choix:"
|
||||
DisplaySetupTontec="Ecran Tontec 3,5 pouces"
|
||||
DisplaySetupHDMI="HDMI tactile"
|
||||
DisplaySetupRpiLCD="Rpi LCD"
|
||||
DisplaySetupConsole="Network Console"
|
||||
|
||||
StrIPSetupTitle="Configure en IP Statique"
|
||||
StrIPSetupContext="Exemple: 192.168.1.60"
|
||||
|
||||
######## LANGUAGE MENU #########
|
||||
|
||||
StrLanguageTitle="Configure la Langue"
|
||||
StrKeyboardChange="Redemarrage apres reglage"
|
||||
|
||||
######## MAIN MENU #########
|
||||
StrMainMenuTitle="RpiDATV GUI Version 2.0 (F5OEO Evariste)"
|
||||
StrMainMenuSource="Selection de la source"
|
||||
|
|
|
@ -82,29 +82,43 @@ StrAutostartMenu="Automatic startup"
|
|||
StrDisplayMenu="Display type"
|
||||
StrIPMenu="IP Address"
|
||||
|
||||
######## AUTOSTART MENU #########
|
||||
|
||||
StrAutostartSetupTitle="Autostart setup"
|
||||
StrAutostartSetupContext="Choice:"
|
||||
AutostartSetupConsole="Console menu"
|
||||
AutostartSetupDisplay="Display with touchscreen"
|
||||
AutostartSetupButton="Push buttons"
|
||||
AutostartSetupPrompt="Log-on to Linux Command Prompt"
|
||||
AutostartSetupConsole="Log-on to rpidatv Menu"
|
||||
AutostartSetupDisplay="Log-on to start Touchscreen Display"
|
||||
AutostartSetupButton="Log-on to enable Button Control"
|
||||
AutostartSetupTX_boot="Boot-up to Transmit"
|
||||
AutostartSetupDisplay_boot="Boot-up to Touchscreen Display"
|
||||
AutostartSetupButton_boot="Boot-up to Button Control"
|
||||
|
||||
StrDisplaySetupTitle="Touchscreen setup"
|
||||
######## TOUCHSCREEN MENU #########
|
||||
|
||||
StrDisplaySetupTitle="Touchscreen setup - needs reboot after setting"
|
||||
StrDisplaySetupContext="Choice:"
|
||||
DisplaySetupTontec="Tontec 3,5 inches"
|
||||
DisplaySetupHDMI="HDMI touchscreen"
|
||||
DisplaySetupRpiLCD="Rpi LCD"
|
||||
DisplaySetupConsole="Network Console"
|
||||
|
||||
StrIPSetupTitle="Setup a static IP"
|
||||
StrIPSetupContext="Example: 192.168.1.60"
|
||||
|
||||
######## LANGUAGE MENU #########
|
||||
|
||||
StrLanguageTitle="Language Selection"
|
||||
StrKeyboardChange="Needs reboot after setting"
|
||||
|
||||
######## MAIN MENU #########
|
||||
StrMainMenuTitle="RpiDATV GUI Version 2.0 (F5OEO Evariste)"
|
||||
StrMainMenuSource="Source select"
|
||||
StrMainMenuOutput="Output select"
|
||||
StrMainMenuSource="Select Video Source"
|
||||
StrMainMenuOutput="Configure Output"
|
||||
StrMainMenuCall="Station call setup"
|
||||
StrMainMenuSystem="System setup"
|
||||
StrMainMenuExitTitle="Exit"
|
||||
StrMainMenuExitContext="Thanks to use RpiDATV... 73's de F5OEO(evaristec@gmail.com)"
|
||||
StrMainMenuExitContext="Thanks for using RpiDATV... 73's de F5OEO(evaristec@gmail.com)"
|
||||
|
||||
########## FILE #################
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
201612081
|
|
@ -1,7 +0,0 @@
|
|||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
|
||||
$PATHSCRIPT"/a.sh"
|
||||
read -p "To exit : Press a key or CTL-C"
|
||||
touche
|
||||
|
||||
|
516
scripts/menu.sh
516
scripts/menu.sh
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
############ Set Environment Variables ###############
|
||||
|
||||
PATHSCRIPT=/home/pi/rpidatv/scripts
|
||||
PATHRPI=/home/pi/rpidatv/bin
|
||||
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
|
||||
PATHCONFIGS="/home/pi/rpidatv/scripts/configs" ## Path to config files
|
||||
|
||||
set_config_var() {
|
||||
lua - "$1" "$2" "$3" <<EOF > "$3.bak"
|
||||
|
@ -51,7 +57,7 @@ fi
|
|||
RET=$?
|
||||
if [ $RET -eq 1 ]; then
|
||||
## This is the section where you control what happens when the user hits Cancel
|
||||
Cancel
|
||||
Cancel
|
||||
elif [ $RET -eq 0 ]; then
|
||||
if [[ -d "/$1$pathselect" ]]; then
|
||||
Filebrowser "/$1$pathselect"
|
||||
|
@ -59,7 +65,6 @@ elif [ $RET -eq 0 ]; then
|
|||
## Do your thing here, this is just a stub of the code I had to do what I wanted the script to do.
|
||||
fileout=`file "$1$pathselect"`
|
||||
filename=`readlink -m $1$pathselect`
|
||||
|
||||
else
|
||||
echo pathselect $1$pathselect
|
||||
whiptail --title "$FileMenuTitle" --msgbox "$FileMenuContext" 8 44
|
||||
|
@ -67,9 +72,7 @@ elif [ $RET -eq 0 ]; then
|
|||
unset imgpath
|
||||
Filebrowser
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
Pathbrowser() {
|
||||
|
@ -95,7 +98,7 @@ elif [ $RET -eq 0 ]; then
|
|||
fileout=`file "$1$pathselect"`
|
||||
filenametemp=`readlink -m $1$pathselect`
|
||||
filename=`dirname $filenametemp`
|
||||
|
||||
|
||||
else
|
||||
echo pathselect $1$pathselect
|
||||
whiptail --title "$FileMenuTitle" --msgbox "$FileMenuContext" 8 44
|
||||
|
@ -103,9 +106,8 @@ elif [ $RET -eq 0 ]; then
|
|||
unset imgpath
|
||||
Pathbrowser
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
do_input_setup() {
|
||||
|
@ -244,7 +246,6 @@ case "$MODE_INPUT" in
|
|||
Radio9=OFF
|
||||
Radio10=OFF
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
chinput=$(whiptail --title "$StrInputSetupTitle" --radiolist \
|
||||
|
@ -282,28 +283,27 @@ chinput=$(whiptail --title "$StrInputSetupTitle" --radiolist \
|
|||
;;
|
||||
IPTSIN)
|
||||
UDPINADDR=$(get_config_var udpinaddr $CONFIGFILE)
|
||||
|
||||
|
||||
UDPINADDR=$(whiptail --inputbox "$StrInputSetupIPTSINName" 8 78 $UDPINADDR --title "$StrInputSetupIPTSINTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var udpinaddr "$UDPINADDR" $CONFIGFILE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
ANALOGCAM)
|
||||
ANALOGCAMNAME=$(get_config_var analogcamname $CONFIGFILE)
|
||||
|
||||
ANALOGCAMNAME=$(whiptail --inputbox "$StrInputSetupANALOGCAMName" 8 78 $ANALOGCAMNAME --title "$StrInputSetupANALOGCAMTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var analogcamname "$ANALOGCAMNAME" $CONFIGFILE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
VNC)
|
||||
VNCADDR=$(get_config_var vncaddr $CONFIGFILE)
|
||||
|
||||
|
||||
VNCADDR=$(whiptail --inputbox "$StrInputSetupVNCName" 8 78 $VNCADDR --title "$StrInputSetupVNCTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var vncaddr "$VNCADDR" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
set_config_var modeinput "$chinput" $CONFIGFILE
|
||||
fi
|
||||
|
@ -411,56 +411,56 @@ choutput=$(whiptail --title "$StrOutputSetupTitle" --radiolist \
|
|||
"DTX1" "$StrOutputSetupDTX1" $Radio5 \
|
||||
"DATVEXPRESS" "$StrOutputSetupDATVExpress" $Radio6 \
|
||||
"IP" "$StrOutputSetupIP" $Radio7 3>&2 2>&1 1>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
case "$choutput" in
|
||||
IQ)
|
||||
IQ)
|
||||
PIN_I=$(get_config_var gpio_i $CONFIGFILE)
|
||||
PIN_I=$(whiptail --inputbox "$StrPIN_IContext" 8 78 $PIN_I --title "$StrPIN_ITitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var gpio_i "$PIN_I" $CONFIGFILE
|
||||
set_config_var gpio_i "$PIN_I" $CONFIGFILE
|
||||
fi
|
||||
PIN_Q=$(get_config_var gpio_q $CONFIGFILE)
|
||||
PIN_Q=$(whiptail --inputbox "$StrPIN_QContext" 8 78 $PIN_Q --title "$StrPIN_QTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var gpio_q "$PIN_Q" $CONFIGFILE
|
||||
set_config_var gpio_q "$PIN_Q" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
QPSKRF)
|
||||
FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
|
||||
FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
fi
|
||||
##FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3)
|
||||
##if [ $? -eq 0 ]; then
|
||||
## set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
##fi
|
||||
GAIN_OUTPUT=$(get_config_var rfpower $CONFIGFILE)
|
||||
GAIN=$(whiptail --inputbox "$StrOutputRFGainContext" 8 78 $GAIN_OUTPUT --title "$StrOutputRFGainTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var rfpower "$GAIN" $CONFIGFILE
|
||||
set_config_var rfpower "$GAIN" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
BATC)
|
||||
BATC_OUTPUT=$(get_config_var batcoutput $CONFIGFILE)
|
||||
ADRESS=$(whiptail --inputbox "$StrOutputBATCContext" 8 78 $BATC_OUTPUT --title "$StrOutputBATCTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var batcoutput "$ADRESS" $CONFIGFILE
|
||||
fi
|
||||
set_config_var batcoutput "$ADRESS" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
DIGITHIN)
|
||||
PIN_I=$(get_config_var gpio_i $CONFIGFILE)
|
||||
PIN_I=$(whiptail --inputbox "$StrPIN_IContext" 8 78 $PIN_I --title "$StrPIN_ITitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var gpio_i "$PIN_I" $CONFIGFILE
|
||||
set_config_var gpio_i "$PIN_I" $CONFIGFILE
|
||||
fi
|
||||
PIN_Q=$(get_config_var gpio_q $CONFIGFILE)
|
||||
PIN_Q=$(whiptail --inputbox "$StrPIN_QContext" 8 78 $PIN_Q --title "$StrPIN_QTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var gpio_q "$PIN_Q" $CONFIGFILE
|
||||
set_config_var gpio_q "$PIN_Q" $CONFIGFILE
|
||||
fi
|
||||
FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
|
||||
FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
fi
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
fi
|
||||
sudo ./si570 -f $FREQ -m off
|
||||
;;
|
||||
DTX1) ;;
|
||||
|
@ -468,22 +468,22 @@ if [ $? -eq 0 ]; then
|
|||
FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
|
||||
FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
fi
|
||||
GAIN_OUTPUT=$(get_config_var rfpower $CONFIGFILE)
|
||||
GAIN=$(whiptail --inputbox "$StrOutputRFGainContext" 8 78 $GAIN_OUTPUT --title "$StrOutputRFGainTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var rfpower "$GAIN" $CONFIGFILE
|
||||
set_config_var rfpower "$GAIN" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
IP)
|
||||
IP)
|
||||
UDPOUTADDR=$(get_config_var udpoutaddr $CONFIGFILE)
|
||||
|
||||
|
||||
UDPOUTADDR=$(whiptail --inputbox "$StrOutputSetupIPTSOUTName" 8 78 $UDPOUTADDR --title "$StrOutputSetupIPTSOUTTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var udpoutaddr "$UDPOUTADDR" $CONFIGFILE
|
||||
fi
|
||||
;;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
set_config_var modeoutput "$choutput" $CONFIGFILE
|
||||
fi
|
||||
|
@ -554,7 +554,7 @@ do_fec_setup()
|
|||
"7" "7/8" $Radio5 3>&2 2>&1 1>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var fec "$FEC" $CONFIGFILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
do_PID_setup()
|
||||
|
@ -573,39 +573,47 @@ set_config_var pidaudio "$PID" $CONFIGFILE
|
|||
fi
|
||||
}
|
||||
|
||||
do_freq_setup()
|
||||
{
|
||||
FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
|
||||
FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then
|
||||
set_config_var freqoutput "$FREQ" $CONFIGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
do_output_setup() {
|
||||
menuchoice=$(whiptail --title "$StrOutputTitle" --menu "$StrOutputContext" 16 78 5 \
|
||||
"1 SymbolRate" "$StrOutputSR" \
|
||||
"2 FEC" "$StrOutputFEC" \
|
||||
"3 Output mode" "$StrOutputMode" \
|
||||
"4 PID" "$StrPIDSetup" \
|
||||
"5 Frequency" "$StrOutputRFFreqContext" \
|
||||
3>&2 2>&1 1>&3)
|
||||
case "$menuchoice" in
|
||||
1\ *) do_symbolrate_setup ;;
|
||||
2\ *) do_fec_setup ;;
|
||||
3\ *) do_output_setup_mode ;;
|
||||
4\ *) do_PID_setup ;;
|
||||
4\ *) do_PID_setup ;;
|
||||
5\ *) do_freq_setup ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
do_transmit()
|
||||
{
|
||||
|
||||
$PATHSCRIPT"/a.sh" >/dev/null 2>/dev/null &
|
||||
#$PATHSCRIPT"/a.sh" &
|
||||
do_status
|
||||
do_stop_transmit
|
||||
|
||||
$PATHSCRIPT"/a.sh" >/dev/null 2>/dev/null &
|
||||
do_status # Wait here transmitting until user presses a key
|
||||
do_stop_transmit
|
||||
}
|
||||
|
||||
do_stop_transmit()
|
||||
{
|
||||
sudo killall rpidatv >/dev/null 2>/dev/null
|
||||
sudo killall ffmpeg >/dev/null 2>/dev/null
|
||||
sudo killall tcanim >/dev/null 2>/dev/null
|
||||
sudo killall tcanim >/dev/null 2>/dev/null
|
||||
sudo killall avc2ts >/dev/null 2>/dev/null
|
||||
|
||||
sudo $PATHRPI"/adf4351" off
|
||||
}
|
||||
|
||||
do_display_on()
|
||||
|
@ -635,8 +643,6 @@ do_receive_status()
|
|||
whiptail --title "RECEIVE" --msgbox "$INFO" 8 78
|
||||
sudo killall rpidatvgui >/dev/null 2>/dev/null
|
||||
sudo killall leandvb >/dev/null 2>/dev/null
|
||||
|
||||
|
||||
}
|
||||
|
||||
do_receive()
|
||||
|
@ -657,104 +663,181 @@ do_receive()
|
|||
/home/pi/rpidatv/bin/rpidatvgui 0 1 >/dev/null 2>/dev/null &
|
||||
do_receive_status;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
do_autostart_setup()
|
||||
{
|
||||
MODE_STARTUP=$(get_config_var startup $CONFIGFILE)
|
||||
case "$MODE_STARTUP" in
|
||||
Console)
|
||||
Radio1=ON
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
;;
|
||||
Display)
|
||||
Radio1=OFF
|
||||
Radio2=ON
|
||||
Radio3=OFF
|
||||
;;
|
||||
Button)
|
||||
Radio1=OFF
|
||||
Radio2=OFF
|
||||
Radio3=ON
|
||||
;;
|
||||
*)
|
||||
Radio1=ON
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
|
||||
esac
|
||||
MODE_STARTUP=$(get_config_var startup $CONFIGFILE)
|
||||
|
||||
chstartup=$(whiptail --title "$StrAutostartSetupTitle" --radiolist \
|
||||
"$StrAutostartSetupContext" 20 78 8 \
|
||||
"Console" "$AutostartSetupConsole" $Radio1 \
|
||||
"Display" "$AutostartSetupDisplay" $Radio2 \
|
||||
"Button" "$AutostartSetupButton" $Radio3 \
|
||||
3>&2 2>&1 1>&3)
|
||||
Radio1=OFF
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
Radio4=OFF
|
||||
Radio5=OFF
|
||||
Radio6=OFF
|
||||
Radio7=OFF
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
case "$chstartup" in
|
||||
Console) cp $PATHSCRIPT"/install_bashrc" /home/pi/.bashrc >/dev/null 2>/dev/null;;
|
||||
Display) MODE_DISPLAY=$(get_config_var display $CONFIGFILE)
|
||||
case "$MODE_DISPLAY" in
|
||||
Waveshare)
|
||||
cp $PATHSCRIPT"/install_display_inversed.fr" /home/pi/.bashrc >/dev/null 2>/dev/null;;
|
||||
*)
|
||||
cp $PATHSCRIPT"/install_display.fr" /home/pi/.bashrc >/dev/null 2>/dev/null;;
|
||||
esac;;
|
||||
|
||||
Button) cp $PATHSCRIPT"/install_button" /home/pi/.bashrc >/dev/null 2>/dev/null;;
|
||||
|
||||
esac
|
||||
set_config_var startup "$chstartup" $CONFIGFILE
|
||||
fi
|
||||
case "$MODE_STARTUP" in
|
||||
Prompt)
|
||||
Radio1=ON;;
|
||||
Console)
|
||||
Radio2=ON;;
|
||||
Display)
|
||||
Radio3=ON;;
|
||||
Button)
|
||||
Radio4=ON;;
|
||||
TX_boot)
|
||||
Radio5=ON;;
|
||||
Display_boot)
|
||||
Radio6=ON;;
|
||||
Button_boot)
|
||||
Radio7=ON;;
|
||||
*)
|
||||
Radio1=ON;;
|
||||
esac
|
||||
|
||||
chstartup=$(whiptail --title "$StrAutostartSetupTitle" --radiolist \
|
||||
"$StrAutostartSetupContext" 20 78 8 \
|
||||
"Prompt" "$AutostartSetupPrompt" $Radio1 \
|
||||
"Console" "$AutostartSetupConsole" $Radio2 \
|
||||
"Display" "$AutostartSetupDisplay" $Radio3 \
|
||||
"Button" "$AutostartSetupButton" $Radio4 \
|
||||
"TX_boot" "$AutostartSetupTX_boot" $Radio5 \
|
||||
"Display_boot" "$AutostartSetupDisplay_boot" $Radio6 \
|
||||
"Button_boot" "$AutostartSetupButton_boot" $Radio7 \
|
||||
3>&2 2>&1 1>&3)
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
case "$chstartup" in
|
||||
Prompt)
|
||||
sudo systemctl disable getty@tty1.service
|
||||
sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf >/dev/null 2>/dev/null
|
||||
cp $PATHCONFIGS"/prompt.bashrc" /home/pi/.bashrc;;
|
||||
Console)
|
||||
sudo systemctl disable getty@tty1.service
|
||||
sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf >/dev/null 2>/dev/null
|
||||
cp $PATHCONFIGS"/console.bashrc" /home/pi/.bashrc;;
|
||||
Display)
|
||||
sudo systemctl disable getty@tty1.service
|
||||
sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf >/dev/null 2>/dev/null
|
||||
MODE_DISPLAY=$(get_config_var display $CONFIGFILE)
|
||||
case "$MODE_DISPLAY" in
|
||||
Waveshare)
|
||||
cp $PATHCONFIGS"/displaywaveshare.bashrc" /home/pi/.bashrc;;
|
||||
*)
|
||||
cp $PATHCONFIGS"/display.bashrc" /home/pi/.bashrc;;
|
||||
esac;;
|
||||
Button)
|
||||
sudo systemctl disable getty@tty1.service
|
||||
sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf /dev/null 2>/dev/null
|
||||
cp $PATHCONFIGS"/button.bashrc" /home/pi/.bashrc;;
|
||||
TX_boot)
|
||||
sudo mkdir -pv /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo cp $PATHCONFIGS"/autologin.conf" /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo systemctl enable getty@tty1.service
|
||||
cp $PATHCONFIGS"/console_tx.bashrc" /home/pi/.bashrc;;
|
||||
Display_boot)
|
||||
sudo mkdir -pv /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo cp $PATHCONFIGS"/autologin.conf" /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo systemctl enable getty@tty1.service
|
||||
MODE_DISPLAY=$(get_config_var display $CONFIGFILE)
|
||||
case "$MODE_DISPLAY" in
|
||||
Waveshare)
|
||||
cp $PATHCONFIGS"/displaywaveshare.bashrc" /home/pi/.bashrc;; #>/dev/null 2>/dev/null;;
|
||||
*)
|
||||
cp $PATHCONFIGS"/display.bashrc" /home/pi/.bashrc;; #>/dev/null 2>/dev/null;;
|
||||
esac;;
|
||||
Button_boot)
|
||||
sudo mkdir -pv /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo cp $PATHCONFIGS"/autologin.conf" /etc/systemd/system/getty@tty1.service.d/
|
||||
sudo systemctl enable getty@tty1.service
|
||||
cp $PATHCONFIGS"/button.bashrc" /home/pi/.bashrc;;
|
||||
esac
|
||||
set_config_var startup "$chstartup" $CONFIGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
do_display_setup()
|
||||
{
|
||||
MODE_DISPLAY=$(get_config_var display $CONFIGFILE)
|
||||
case "$MODE_DISPLAY" in
|
||||
Tontec35)
|
||||
|
||||
Tontec35)
|
||||
Radio1=ON
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
Radio4=OFF
|
||||
;;
|
||||
HDMITouch)
|
||||
Radio1=OFF
|
||||
Radio2=ON
|
||||
Radio3=OFF
|
||||
;;
|
||||
Radio4=OFF
|
||||
;;
|
||||
Waveshare)
|
||||
Radio1=OFF
|
||||
Radio2=OFF
|
||||
Radio3=ON
|
||||
Radio4=OFF
|
||||
;;
|
||||
Console)
|
||||
Radio1=OFF
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
Radio4=ON
|
||||
;;
|
||||
*)
|
||||
Radio1=ON
|
||||
Radio2=OFF
|
||||
Radio3=OFF
|
||||
|
||||
Radio4=OFF
|
||||
esac
|
||||
|
||||
chdisplay=$(whiptail --title "$StrDisplaySetupTitle" --radiolist \
|
||||
"$StrDisplaySetupContext" 20 78 8 \
|
||||
"Tontec35" "$DisplaySetupTontec" $Radio1 \
|
||||
"HDMITouch" "$DisplaySetupHDMI" $Radio2 \
|
||||
"Waveshare" "$DisplaySetupRpiLCD" $Radio3 \
|
||||
3>&2 2>&1 1>&3)
|
||||
"$StrDisplaySetupContext" 20 78 8 \
|
||||
"Tontec35" "$DisplaySetupTontec" $Radio1 \
|
||||
"HDMITouch" "$DisplaySetupHDMI" $Radio2 \
|
||||
"Waveshare" "$DisplaySetupRpiLCD" $Radio3 \
|
||||
"Console" "$DisplaySetupConsole" $Radio4 \
|
||||
3>&2 2>&1 1>&3)
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
case "$chdisplay" in
|
||||
Tontec35) sudo bash -c 'echo -e "\ndtparam=spi=on\ndtoverlay=mz61581\n" >> /boot/config.txt' ;;
|
||||
HDMITouch) sudo bash -c 'echo -e "\nhdmi_group=2\nhdmi_mode=1\nhdmi_mode=87\nhdmi_cvt 800 480 60 6 0 0 0\ndtparam=spi=on\n\ndtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900" >> /boot/config.txt' ;;
|
||||
Waveshare) sudo bash -c 'echo -e "\ndtparam=spi=on\ndtoverlay=waveshare35a\ndtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=1000000,keep_vref_on=1,swapxy=1,pmax=255,xohms=60,xmin=200,xmax=3900,ymin=200,ymax=3900\n" >> /boot/config.txt' ;;
|
||||
## This section modifies and replaces the end of /boot/config.txt
|
||||
## to allow (only) the correct LCD drivers to be loaded at next boot
|
||||
|
||||
|
||||
esac
|
||||
set_config_var display "$chdisplay" $CONFIGFILE
|
||||
## Set constants for the amendment of /boot/config.txt below
|
||||
|
||||
PATHCONFIGS="/home/pi/rpidatv/scripts/configs" ## Path to config files
|
||||
lead='^## Begin LCD Driver' ## Marker for start of inserted text
|
||||
tail='^## End LCD Driver' ## Marker for end of inserted text
|
||||
CHANGEFILE="/boot/config.txt" ## File requiring added text
|
||||
APPENDFILE=$PATHCONFIGS"/lcd_markers.txt" ## File containing both markers
|
||||
TRANSFILE=$PATHCONFIGS"/transfer.txt" ## File used for transfer
|
||||
|
||||
if [ $? -eq 0 ]; then ## If the selection has changed
|
||||
|
||||
grep -q "$lead" "$CHANGEFILE" ## Is the first marker already present?
|
||||
if [ $? -ne 0 ]; then
|
||||
sudo bash -c 'cat '$APPENDFILE' >> '$CHANGEFILE' ' ## If not append the markers
|
||||
fi
|
||||
|
||||
case "$chdisplay" in ## Select the correct driver text
|
||||
|
||||
Tontec35) INSERTFILE=$PATHCONFIGS"/tontec35.txt" ;; ## Message to be added
|
||||
HDMITouch) INSERTFILE=$PATHCONFIGS"/hdmitouch.txt" ;;
|
||||
Waveshare) INSERTFILE=$PATHCONFIGS"/waveshare.txt" ;;
|
||||
Console) INSERTFILE=$PATHCONFIGS"/console.txt" ;;
|
||||
|
||||
esac
|
||||
|
||||
## Replace whatever is between the markers with the driver text
|
||||
|
||||
sed -e "/$lead/,/$tail/{ /$lead/{p; r $INSERTFILE
|
||||
}; /$tail/p; d }" $CHANGEFILE >> $TRANSFILE
|
||||
|
||||
sudo cp "$TRANSFILE" "$CHANGEFILE" ## Copy from the transfer file
|
||||
rm $TRANSFILE ## Delete the transfer file
|
||||
|
||||
set_config_var display "$chdisplay" $CONFIGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -764,23 +847,151 @@ CURRENTIP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '(
|
|||
whiptail --title "IP" --msgbox "$CURRENTIP" 8 78
|
||||
}
|
||||
|
||||
do_WiFi_setup()
|
||||
{
|
||||
$PATHSCRIPT"/wifisetup.sh"
|
||||
}
|
||||
|
||||
do_WiFi_Off()
|
||||
{
|
||||
sudo ifconfig wlan0 down ## Disable it now
|
||||
cp $PATHCONFIGS"/text.wifi_off" /home/pi/.wifi_off ## Disable at start-up
|
||||
}
|
||||
|
||||
do_Enable_DigiThin()
|
||||
{
|
||||
whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78
|
||||
}
|
||||
|
||||
do_125KS()
|
||||
{
|
||||
whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78
|
||||
}
|
||||
|
||||
do_EasyCap()
|
||||
{
|
||||
whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78
|
||||
}
|
||||
|
||||
do_Update()
|
||||
{
|
||||
whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78
|
||||
}
|
||||
|
||||
do_system_setup()
|
||||
{
|
||||
menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 5 \
|
||||
"1 Autostart" "$StrAutostartMenu" \
|
||||
"2 Display" "$StrDisplayMenu" \
|
||||
"3 IP" "$StrIPMenu" \
|
||||
3>&2 2>&1 1>&3)
|
||||
case "$menuchoice" in
|
||||
1\ *) do_autostart_setup ;;
|
||||
2\ *) do_display_setup ;;
|
||||
3\ *) do_IP_setup ;;
|
||||
esac
|
||||
menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 9 \
|
||||
"1 Autostart" "$StrAutostartMenu" \
|
||||
"2 Display" "$StrDisplayMenu" \
|
||||
"3 IP" "$StrIPMenu" \
|
||||
"4 WiFi Set-up" "SSID and password" \
|
||||
"5 WiFi Off" "Turn the WiFi Off" \
|
||||
"6 Enable DigiThin" "Not Implemented Yet" \
|
||||
"7 Enable 125KS" "Not implemented yet" \
|
||||
"8 Set EasyCap" "Not implemented yet" \
|
||||
"9 Update" "Not implemented yet" \
|
||||
3>&2 2>&1 1>&3)
|
||||
case "$menuchoice" in
|
||||
1\ *) do_autostart_setup ;;
|
||||
2\ *) do_display_setup ;;
|
||||
3\ *) do_IP_setup ;;
|
||||
4\ *) do_WiFi_setup ;;
|
||||
5\ *) do_WiFi_Off ;;
|
||||
6\ *) do_Enable_DigiThin ;;
|
||||
7\ *) do_125KS ;;
|
||||
8\ *) do_EasyCap ;;
|
||||
9\ *) do_Update ;;
|
||||
esac
|
||||
}
|
||||
|
||||
do_language_setup()
|
||||
{
|
||||
menuchoice=$(whiptail --title "$StrLanguageTitle" --menu "$StrOutputContext" 16 78 6 \
|
||||
"1 French Menus" "Menus Francais" \
|
||||
"2 English Menus" "Change Menus to English" \
|
||||
"3 French Keyboard" "$StrKeyboardChange" \
|
||||
"4 UK Keyboard" "$StrKeyboardChange" \
|
||||
"5 US Keyboard" "$StrKeyboardChange" \
|
||||
3>&2 2>&1 1>&3)
|
||||
case "$menuchoice" in
|
||||
1\ *) set_config_var menulanguage "fr" $CONFIGFILE ;;
|
||||
2\ *) set_config_var menulanguage "en" $CONFIGFILE ;;
|
||||
3\ *) sudo cp $PATHCONFIGS"/keyfr" /etc/default/keyboard ;;
|
||||
4\ *) sudo cp $PATHCONFIGS"/keygb" /etc/default/keyboard ;;
|
||||
5\ *) sudo cp $PATHCONFIGS"/keyus" /etc/default/keyboard ;;
|
||||
esac
|
||||
|
||||
# Check Language
|
||||
|
||||
MENU_LANG=$(get_config_var menulanguage $CONFIGFILE)
|
||||
|
||||
# Set Language
|
||||
|
||||
if [ "$MENU_LANG" == "en" ]; then
|
||||
source $PATHSCRIPT"/langgb.sh"
|
||||
else
|
||||
source $PATHSCRIPT"/langfr.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
do_Exit()
|
||||
{
|
||||
exit
|
||||
}
|
||||
|
||||
do_Reboot()
|
||||
{
|
||||
sudo reboot now
|
||||
}
|
||||
|
||||
do_Shutdown()
|
||||
{
|
||||
sudo shutdown now
|
||||
}
|
||||
|
||||
do_TouchScreen()
|
||||
{
|
||||
reset
|
||||
~/rpidatv/bin/rpidatvgui 1
|
||||
}
|
||||
|
||||
do_EnableButtonSD()
|
||||
{
|
||||
cp $PATHCONFIGS"/text.pi-sdn" ~/.pi-sdn ## Load it at logon
|
||||
~/.pi-sdn ## Load it now
|
||||
}
|
||||
|
||||
do_DisableButtonSD()
|
||||
{
|
||||
rm ~/.pi-sdn ## Stop it being loaded at log-on
|
||||
sudo pkill -x pi-sdn ## kill the current process
|
||||
}
|
||||
|
||||
do_shutdown_menu()
|
||||
{
|
||||
menuchoice=$(whiptail --title "Shutdown Menu" --menu "Select Choice" 16 78 7 \
|
||||
"1 Shutdown now" "Immediate Shutdown" \
|
||||
"2 Reboot now" "Immediate reboot" \
|
||||
"3 Exit to Linux" "Exit menu to Command Prompt" \
|
||||
"4 Restore TouchScreen" "Exit Menu, restart LCD" \
|
||||
"5 Button Enable" "Enable Shutdown Button" \
|
||||
"6 Button Disable" "Disable Shutdown Button" \
|
||||
3>&2 2>&1 1>&3)
|
||||
case "$menuchoice" in
|
||||
1\ *) do_Shutdown ;;
|
||||
2\ *) do_Reboot ;;
|
||||
3\ *) do_Exit ;;
|
||||
4\ *) do_TouchScreen ;;
|
||||
5\ *) do_EnableButtonSD ;;
|
||||
6\ *) do_DisableButtonSD ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
OnStartup()
|
||||
{
|
||||
CALL=$(get_config_var call $CONFIGFILE)
|
||||
CALL=$(get_config_var call $CONFIGFILE)
|
||||
MODE_INPUT=$(get_config_var modeinput $CONFIGFILE)
|
||||
MODE_OUTPUT=$(get_config_var modeoutput $CONFIGFILE)
|
||||
SYMBOLRATEK=$(get_config_var symbolrate $CONFIGFILE)
|
||||
|
@ -795,10 +1006,27 @@ INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/"
|
|||
do_transmit
|
||||
}
|
||||
|
||||
#********************************************* MAIN MENU **************************************************
|
||||
#********************************************* MAIN MENU *********************************
|
||||
#************************* Execution of Console Menu starts here *************************
|
||||
|
||||
# Check Language
|
||||
|
||||
MENU_LANG=$(get_config_var menulanguage $CONFIGFILE)
|
||||
|
||||
# Set Language
|
||||
|
||||
if [ "$MENU_LANG" == "en" ]; then
|
||||
source $PATHSCRIPT"/langgb.sh"
|
||||
else
|
||||
source $PATHSCRIPT"/langfr.sh"
|
||||
fi
|
||||
|
||||
status="0"
|
||||
OnStartup
|
||||
#$PATHRPI"/rpibutton.sh" &
|
||||
|
||||
if [ "$1" != "menu" ]; then # if tx on boot
|
||||
OnStartup # go straight to transmit
|
||||
fi
|
||||
|
||||
sleep 0.2
|
||||
|
||||
while [ "$status" -eq 0 ]
|
||||
|
@ -820,28 +1048,32 @@ INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/"
|
|||
#do_transmit
|
||||
#do_status
|
||||
#do_display_on
|
||||
#"1 Transmission" "Demarre la transmission"\
|
||||
menuchoice=$(whiptail --title "$StrMainMenuTitle" --menu "$INFO" 16 82 6 \
|
||||
"0 Transmit" "Go transmit" \
|
||||
|
||||
menuchoice=$(whiptail --title "$StrMainMenuTitle" --menu "$INFO" 16 82 8 \
|
||||
"0 Transmit" "Go to transmit" \
|
||||
"1 Source" "$StrMainMenuSource" \
|
||||
"2 Sortie" "$StrMainMenuOutput" \
|
||||
"2 Output" "$StrMainMenuOutput" \
|
||||
"3 Station" "$StrMainMenuCall" \
|
||||
"4 Receive" "Receive via rtlsdr" \
|
||||
"5 System" "$StrMainMenuSystem" \
|
||||
3>&2 2>&1 1>&3)
|
||||
|
||||
"6 Language" "Set Language and Keyboard" \
|
||||
"7 Shutdown" "Shutdown and reboot options" \
|
||||
3>&2 2>&1 1>&3)
|
||||
|
||||
case "$menuchoice" in
|
||||
0\ *) do_transmit ;;
|
||||
0\ *) do_transmit ;;
|
||||
1\ *) do_input_setup ;;
|
||||
2\ *) do_output_setup ;;
|
||||
3\ *) do_station_setup ;;
|
||||
4\ *) do_receive ;;
|
||||
5\ *) do_system_setup ;;
|
||||
*)
|
||||
|
||||
4\ *) do_receive ;;
|
||||
5\ *) do_system_setup ;;
|
||||
6\ *) do_language_setup ;;
|
||||
7\ *) do_shutdown_menu ;;
|
||||
*)
|
||||
|
||||
whiptail --title "$StrMainMenuExitTitle" --msgbox "$StrMainMenuExitContext" 8 78
|
||||
status=1
|
||||
|
||||
|
||||
kill -1 $(pidof -x frmenu.sh) >/dev/null 2>/dev/null
|
||||
kill -1 $(pidof -x gbmenu.sh) >/dev/null 2>/dev/null
|
||||
sleep 1
|
||||
|
@ -850,7 +1082,5 @@ INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/"
|
|||
esac
|
||||
exitstatus1=$status1
|
||||
done
|
||||
else
|
||||
whiptail --title "Testing" --msgbox "Bye" 8 78
|
||||
exit
|
||||
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
modeinput=PATERNAUDIO
|
||||
symbolrate=250
|
||||
modeinput=CAMH264
|
||||
symbolrate=2000
|
||||
fec=7
|
||||
freqoutput=437
|
||||
freqoutput=1249
|
||||
rfpower=7
|
||||
modeoutput=QPSKRF
|
||||
modeoutput=IQ
|
||||
tsvideofile=/home/pi/rpidatv/video/f4day.ts
|
||||
call=F5OEO
|
||||
call=BATC
|
||||
paternfile=/home/pi/rpidatv/video
|
||||
udpinaddr=230.0.0.2
|
||||
pidvideo=1001
|
||||
pidpmt=1000
|
||||
pidvideo=256
|
||||
pidpmt=255
|
||||
serviceid=1
|
||||
gpio_i=12
|
||||
gpio_q=13
|
||||
pathmedia=/home/pi/rpidatv/video
|
||||
locator=JNO6EP
|
||||
pidstart=1000
|
||||
pidaudio=1002
|
||||
locator=IO90LU
|
||||
pidstart=255
|
||||
pidaudio=257
|
||||
display=Waveshare
|
||||
menulanguage=en
|
||||
analogcamname=/dev/video0
|
||||
startup=Display
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script used to set up WiFi from rpidatv menu
|
||||
|
||||
reset # Clear the screen
|
||||
|
||||
# Check that wifi has not been disabled
|
||||
|
||||
if [ -f ~/.wifi_off ]; then
|
||||
printf "WiFi was disabled at start-up.\n"
|
||||
printf "You cannot set up the WiFi until it is re-enabled.\n"
|
||||
printf "Do you want to re-enable it and reboot immediately? (y/n)\n"
|
||||
read -n 1
|
||||
printf "\n"
|
||||
if [ "$REPLY" = "Y" ]; then
|
||||
echo "rebooting"
|
||||
rm ~/.wifi_off
|
||||
sudo reboot now
|
||||
fi
|
||||
if [ "$REPLY" = "y" ]; then
|
||||
echo "rebooting"
|
||||
rm ~/.wifi_off
|
||||
sudo reboot now
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
## Wifi is enabled so
|
||||
## Check current network name
|
||||
|
||||
printf "Current WiFi Status:\n\n"
|
||||
iwgetid
|
||||
printf "\nDo you want to set up a new network? (y/n)\n"
|
||||
read -n 1
|
||||
printf "\n"
|
||||
if [ "$REPLY" = "N" ]; then
|
||||
exit
|
||||
fi
|
||||
if [ "$REPLY" = "n" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
## Set up new network
|
||||
|
||||
printf "\nThe following networks are available:\n"
|
||||
printf "\n"
|
||||
sudo iwlist wlan0 scan | grep 'ESSID'
|
||||
printf "\n"
|
||||
printf "Type the SSID of the network that you want to connect to (without qoutes) and press enter\n"
|
||||
printf "\n"
|
||||
|
||||
read SSID
|
||||
|
||||
printf "\n"
|
||||
printf "Type the network password and press enter\n"
|
||||
printf "Characters will not be displayed\n"
|
||||
printf "\n"
|
||||
|
||||
stty -echo
|
||||
|
||||
read PW
|
||||
|
||||
stty echo
|
||||
printf "\nWorking....\n\n"
|
||||
stty -echo
|
||||
|
||||
PSK_TEXT=$(wpa_passphrase "$SSID" "$PW" | grep 'psk=' | grep -v '#psk')
|
||||
|
||||
PATHCONFIGS="/home/pi/rpidatv/scripts/configs" ## Path to config files
|
||||
|
||||
## Build text for supplicant file
|
||||
|
||||
rm $PATHCONFIGS"/wpa_text.txt"
|
||||
|
||||
echo -e "network={" >> $PATHCONFIGS"/wpa_text.txt"
|
||||
echo -e " ssid="\"""$SSID"\"" >> $PATHCONFIGS"/wpa_text.txt"
|
||||
echo -e " "$PSK_TEXT >> $PATHCONFIGS"/wpa_text.txt"
|
||||
echo -e "}" >> $PATHCONFIGS"/wpa_text.txt"
|
||||
|
||||
## Copy the existing wpa_supplicant file to work on
|
||||
|
||||
sudo cp /etc/wpa_supplicant/wpa_supplicant.conf $PATHCONFIGS"/wpa_supcopy.txt"
|
||||
sudo chown pi:pi $PATHCONFIGS"/wpa_supcopy.txt"
|
||||
|
||||
## Define the parameters for the replace script
|
||||
|
||||
lead='^##STARTNW' ## Marker for start of inserted text
|
||||
tail='^##ENDNW' ## Marker for end of inserted text
|
||||
CHANGEFILE=$PATHCONFIGS"/wpa_supcopy.txt" ## File requiring added text
|
||||
APPENDFILE=$PATHCONFIGS"/wpa_markers.txt" ## File containing both markers
|
||||
TRANSFILE=$PATHCONFIGS"/transfer.txt" ## File used for transfer
|
||||
INSERTFILE=$PATHCONFIGS"/wpa_text.txt" ## File to be included
|
||||
|
||||
grep -q "$lead" "$CHANGEFILE" ## Is the first marker already present?
|
||||
if [ $? -ne 0 ]; then
|
||||
sudo bash -c 'cat '$APPENDFILE' >> '$CHANGEFILE' ' ## If not append the markers
|
||||
fi
|
||||
|
||||
## Replace whatever is between the markers with the insert text
|
||||
|
||||
sed -e "/$lead/,/$tail/{ /$lead/{p; r $INSERTFILE
|
||||
}; /$tail/p; d }" $CHANGEFILE >> $TRANSFILE
|
||||
|
||||
sudo cp "$TRANSFILE" "$CHANGEFILE" ## Copy from the transfer file
|
||||
rm $TRANSFILE ## Delete the transfer file
|
||||
|
||||
## Give the file root ownership and copy it back over the original
|
||||
|
||||
sudo chown root:root $PATHCONFIGS"/wpa_supcopy.txt"
|
||||
sudo cp $PATHCONFIGS"/wpa_supcopy.txt" /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
sudo rm $PATHCONFIGS"/wpa_supcopy.txt"
|
||||
|
||||
stty echo
|
||||
|
||||
##bring wifi down and up again
|
||||
|
||||
sudo ifdown wlan0
|
||||
sudo ifup wlan0
|
||||
|
||||
printf "WiFi Configured\n"
|
||||
sleep 1
|
||||
|
||||
exit
|
|
@ -0,0 +1,13 @@
|
|||
all: adf4351
|
||||
|
||||
CFLAGS = -Wall -g -O2 -Wno-unused-variable
|
||||
LDFLAGS = -lm -lrt -lpthread -lwiringPi
|
||||
|
||||
adf4351 : adf4351.h adf4351.c ctladf4351.c
|
||||
$(CC) $(CFLAGS) -o adf4351 adf4351.c ctladf4351.c $(LDFLAGS)
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
|
||||
|
||||
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,588 @@
|
|||
/***************************************************************************//**
|
||||
* @file adf4350.c
|
||||
* @brief Implementation of ADF4350 Driver.
|
||||
* @author DBogdan (dragos.bogdan@analog.com)
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2012-2015(c) Analog Devices, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* - The use of this software may or may not infringe the patent rights
|
||||
* of one or more patent holders. This license does not release you
|
||||
* from the requirement that you obtain separate licenses from these
|
||||
* patent holders to use this software.
|
||||
* - Use of the software either in source or binary form, must be run
|
||||
* on or directly connected to an Analog Devices Inc. component.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*******************************************************************************/
|
||||
/* wiringPiSPI.c:
|
||||
* Simplified SPI access routines
|
||||
* Copyright (c) 2012-2015 Gordon Henderson
|
||||
***********************************************************************
|
||||
* This file is part of wiringPi:
|
||||
* https://projects.drogon.net/raspberry-pi/wiringpi/
|
||||
*
|
||||
* wiringPi 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* wiringPi 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 wiringPi.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
***********************************************************************
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spi/spidev.h>
|
||||
#include <wiringPi.h>
|
||||
#include "adf4351.h"
|
||||
|
||||
// The SPI bus parameters
|
||||
// Variables as they need to be passed as pointers later on
|
||||
|
||||
const static char *spiDev0 = "/dev/spidev0.0" ;
|
||||
const static char *spiDev1 = "/dev/spidev0.1" ;
|
||||
const static uint8_t spiBPW = 8 ;
|
||||
const static uint16_t spiDelay = 0 ;
|
||||
|
||||
static uint32_t spiSpeeds [2] ;
|
||||
static int spiFds [2] ;
|
||||
|
||||
int SPIDataRW (int channel, unsigned char *data, int len)
|
||||
{
|
||||
struct spi_ioc_transfer spi ;
|
||||
|
||||
channel &= 1 ;
|
||||
|
||||
// Mentioned in spidev.h but not used in the original kernel documentation
|
||||
// test program )-:
|
||||
|
||||
memset (&spi, 0, sizeof (spi)) ;
|
||||
|
||||
spi.tx_buf = (unsigned long)data ;
|
||||
spi.rx_buf = (unsigned long)data ;
|
||||
spi.len = len ;
|
||||
spi.delay_usecs = spiDelay ;
|
||||
spi.speed_hz = spiSpeeds [channel] ;
|
||||
spi.bits_per_word = spiBPW ;
|
||||
|
||||
//return ioctl (spiFds [channel], SPI_IOC_MESSAGE(1), &spi) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Was used to open the spi device set up the SPI mode. Now unused
|
||||
*
|
||||
* @param data - int channel, int speed, int mode
|
||||
*
|
||||
* @return Always Returns 0
|
||||
*******************************************************************************/
|
||||
|
||||
int SPISetupMode (int channel, int speed, int mode)
|
||||
{
|
||||
int fd ;
|
||||
|
||||
mode &= 3 ; // Mode is 0, 1, 2 or 3
|
||||
channel &= 1 ; // Channel is 0 or 1
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/************************ Local variables and types ***************************/
|
||||
/******************************************************************************/
|
||||
static struct adf4350_state
|
||||
{
|
||||
struct adf4350_platform_data *pdata;
|
||||
uint32_t clkin;
|
||||
uint32_t chspc; /* Channel Spacing */
|
||||
uint32_t fpfd; /* Phase Frequency Detector */
|
||||
uint32_t min_out_freq;
|
||||
uint32_t r0_fract;
|
||||
uint32_t r0_int;
|
||||
uint32_t r1_mod;
|
||||
uint32_t r4_rf_div_sel;
|
||||
uint32_t regs[6];
|
||||
uint32_t regs_hw[6];
|
||||
uint32_t val;
|
||||
}adf4350_st;
|
||||
|
||||
uint8_t adf4350_slave_select;
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Writes 4 bytes (32 bits) of data to ADF4350.
|
||||
*
|
||||
* @param data - Data value to write
|
||||
*
|
||||
* @return Always Returns 0
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_write(uint32_t data)
|
||||
{
|
||||
// Nominate pins using WiringPi numbers
|
||||
|
||||
// LE pin 27 wPi 30
|
||||
// CLK pin 29 wPi 21
|
||||
// Data pin 31 wPi 22
|
||||
|
||||
uint8_t LE_4351_GPIO = 30;
|
||||
uint8_t CLK_4351_GPIO = 21;
|
||||
uint8_t DATA_4351_GPIO = 22;
|
||||
|
||||
// Set all nominated pins to outputs
|
||||
|
||||
pinMode(LE_4351_GPIO, OUTPUT);
|
||||
pinMode(CLK_4351_GPIO, OUTPUT);
|
||||
pinMode(DATA_4351_GPIO, OUTPUT);
|
||||
|
||||
// Set idle conditions
|
||||
|
||||
digitalWrite(LE_4351_GPIO, HIGH);
|
||||
digitalWrite(CLK_4351_GPIO, LOW);
|
||||
digitalWrite(DATA_4351_GPIO, LOW);
|
||||
|
||||
//Select device LE low
|
||||
|
||||
digitalWrite(LE_4351_GPIO, LOW);
|
||||
|
||||
// printf(" ADF4351 Register (one of the five) Updated\n");
|
||||
|
||||
// Initialise loop
|
||||
|
||||
uint16_t i;
|
||||
|
||||
// Send all 32 bits
|
||||
|
||||
for (i = 0; i <32; i++)
|
||||
{
|
||||
// Test left-most bit
|
||||
|
||||
if (data & 0x80000000)
|
||||
digitalWrite(DATA_4351_GPIO, HIGH);
|
||||
else
|
||||
digitalWrite(DATA_4351_GPIO, LOW);
|
||||
|
||||
// Pulse clock
|
||||
|
||||
digitalWrite(CLK_4351_GPIO, HIGH);
|
||||
delay(1);
|
||||
digitalWrite(CLK_4351_GPIO, LOW);
|
||||
delay(1);
|
||||
// shift data left so next bit will be leftmost
|
||||
|
||||
data <<= 1;
|
||||
}
|
||||
|
||||
//Set ADF4351 LE high
|
||||
|
||||
digitalWrite(LE_4351_GPIO, HIGH);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Updates the registers values.
|
||||
*
|
||||
* @param st - The selected structure.
|
||||
*
|
||||
* @return Returns 0 in case of success or negative error code.
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_sync_config(struct adf4350_state *st)
|
||||
{
|
||||
int32_t ret, i, doublebuf = 0;
|
||||
|
||||
for (i = ADF4350_REG5; i >= ADF4350_REG0; i--)
|
||||
{
|
||||
if ((st->regs_hw[i] != st->regs[i]) ||
|
||||
((i == ADF4350_REG0) && doublebuf))
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case ADF4350_REG1:
|
||||
case ADF4350_REG4:
|
||||
doublebuf = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
st->val = (st->regs[i] | i);
|
||||
ret = adf4350_write(st->val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
st->regs_hw[i] = st->regs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Increases the R counter value until the ADF4350_MAX_FREQ_PFD is
|
||||
* greater than PFD frequency.
|
||||
*
|
||||
* @param st - The selected structure.
|
||||
* @param r_cnt - Initial r_cnt value.
|
||||
*
|
||||
* @return Returns 0 in case of success or negative error code.
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_tune_r_cnt(struct adf4350_state *st, uint16_t r_cnt)
|
||||
{
|
||||
struct adf4350_platform_data *pdata = st->pdata;
|
||||
|
||||
do
|
||||
{
|
||||
r_cnt++;
|
||||
st->fpfd = (st->clkin * (pdata->ref_doubler_en ? 2 : 1)) /
|
||||
(r_cnt * (pdata->ref_div2_en ? 2 : 1));
|
||||
} while (st->fpfd > ADF4350_MAX_FREQ_PFD);
|
||||
|
||||
return r_cnt;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Computes the greatest common divider of two numbers
|
||||
*
|
||||
* @return Returns the gcd.
|
||||
*******************************************************************************/
|
||||
uint32_t gcd(uint32_t x, uint32_t y)
|
||||
{
|
||||
int32_t tmp;
|
||||
|
||||
tmp = y > x ? x : y;
|
||||
|
||||
|
||||
while((x % tmp) || (y % tmp))
|
||||
{
|
||||
tmp--;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Sets the ADF4350 frequency.
|
||||
*
|
||||
* @param st - The selected structure.
|
||||
* @param freq - The desired frequency value.
|
||||
*
|
||||
* @return calculatedFrequency - The actual frequency value that was set.
|
||||
*******************************************************************************/
|
||||
int64_t adf4350_set_freq(struct adf4350_state *st, uint64_t freq)
|
||||
{
|
||||
struct adf4350_platform_data *pdata = st->pdata;
|
||||
uint64_t tmp;
|
||||
uint32_t div_gcd, prescaler, chspc;
|
||||
uint16_t mdiv, r_cnt = 0;
|
||||
uint8_t band_sel_div;
|
||||
int32_t ret;
|
||||
|
||||
if ((freq > ADF4350_MAX_OUT_FREQ) || (freq < ADF4350_MIN_OUT_FREQ))
|
||||
return -1;
|
||||
|
||||
if (freq > ADF4350_MAX_FREQ_45_PRESC) {
|
||||
prescaler = ADF4350_REG1_PRESCALER;
|
||||
mdiv = 75;
|
||||
}
|
||||
else
|
||||
{
|
||||
prescaler = 0;
|
||||
mdiv = 23;
|
||||
}
|
||||
|
||||
st->r4_rf_div_sel = 0;
|
||||
|
||||
while (freq < ADF4350_MIN_VCO_FREQ)
|
||||
{
|
||||
freq <<= 1;
|
||||
st->r4_rf_div_sel++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow a predefined reference division factor
|
||||
* if not set, compute our own
|
||||
*/
|
||||
if (pdata->ref_div_factor)
|
||||
r_cnt = pdata->ref_div_factor - 1;
|
||||
|
||||
chspc = st->chspc;
|
||||
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
r_cnt = adf4350_tune_r_cnt(st, r_cnt);
|
||||
st->r1_mod = st->fpfd / chspc;
|
||||
if (r_cnt > ADF4350_MAX_R_CNT)
|
||||
{
|
||||
/* try higher spacing values */
|
||||
chspc++;
|
||||
r_cnt = 0;
|
||||
}
|
||||
} while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
|
||||
} while (r_cnt == 0);
|
||||
|
||||
|
||||
tmp = freq * (uint64_t)st->r1_mod + (st->fpfd > 1);
|
||||
|
||||
tmp = (tmp / st->fpfd); /* Div round closest (n + d/2)/d */
|
||||
|
||||
st->r0_fract = tmp % st->r1_mod;
|
||||
tmp = tmp / st->r1_mod;
|
||||
|
||||
st->r0_int = tmp;
|
||||
} while (mdiv > st->r0_int);
|
||||
|
||||
band_sel_div = st->fpfd % ADF4350_MAX_BANDSEL_CLK > ADF4350_MAX_BANDSEL_CLK / 2 ?
|
||||
st->fpfd / ADF4350_MAX_BANDSEL_CLK + 1 :
|
||||
st->fpfd / ADF4350_MAX_BANDSEL_CLK;
|
||||
|
||||
if (st->r0_fract && st->r1_mod) {
|
||||
div_gcd = gcd(st->r1_mod, st->r0_fract);
|
||||
st->r1_mod /= div_gcd;
|
||||
st->r0_fract /= div_gcd;
|
||||
}
|
||||
else
|
||||
{
|
||||
st->r0_fract = 0;
|
||||
st->r1_mod = 1;
|
||||
}
|
||||
|
||||
st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) |
|
||||
ADF4350_REG0_FRACT(st->r0_fract);
|
||||
|
||||
st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(1) |
|
||||
ADF4350_REG1_MOD(st->r1_mod) |
|
||||
prescaler;
|
||||
|
||||
st->regs[ADF4350_REG2] =
|
||||
ADF4350_REG2_10BIT_R_CNT(r_cnt) |
|
||||
ADF4350_REG2_DOUBLE_BUFF_EN |
|
||||
(pdata->ref_doubler_en ? ADF4350_REG2_RMULT2_EN : 0) |
|
||||
(pdata->ref_div2_en ? ADF4350_REG2_RDIV2_EN : 0) |
|
||||
(pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS |
|
||||
ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N |
|
||||
ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) |
|
||||
ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9)));
|
||||
|
||||
st->regs[ADF4350_REG3] = pdata->r3_user_settings &
|
||||
(ADF4350_REG3_12BIT_CLKDIV(0xFFF) |
|
||||
ADF4350_REG3_12BIT_CLKDIV_MODE(0x3) |
|
||||
ADF4350_REG3_12BIT_CSR_EN);
|
||||
|
||||
st->regs[ADF4350_REG4] =
|
||||
ADF4350_REG4_FEEDBACK_FUND |
|
||||
ADF4350_REG4_RF_DIV_SEL(st->r4_rf_div_sel) |
|
||||
ADF4350_REG4_8BIT_BAND_SEL_CLKDIV(band_sel_div) |
|
||||
ADF4350_REG4_RF_OUT_EN |
|
||||
(pdata->r4_user_settings &
|
||||
(ADF4350_REG4_OUTPUT_PWR(0x3) |
|
||||
ADF4350_REG4_AUX_OUTPUT_PWR(0x3) |
|
||||
ADF4350_REG4_AUX_OUTPUT_EN |
|
||||
ADF4350_REG4_AUX_OUTPUT_FUND |
|
||||
ADF4350_REG4_MUTE_TILL_LOCK_EN));
|
||||
|
||||
st->regs[ADF4350_REG5] = ADF4350_REG5_LD_PIN_MODE_DIGITAL | 0x00180000;
|
||||
|
||||
ret = adf4350_sync_config(st);
|
||||
if(ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
tmp = (uint64_t)((st->r0_int * st->r1_mod) + st->r0_fract) * (uint64_t)st->fpfd;
|
||||
tmp = tmp / ((uint64_t)st->r1_mod * ((uint64_t)1 << st->r4_rf_div_sel));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Initializes the ADF4350.
|
||||
*
|
||||
* @param spiBaseAddr - SPI peripheral AXI base address.
|
||||
* @param ssNo - Slave select line on which the slave is connected.
|
||||
*
|
||||
* @return Returns 0 in case of success or negative error code.
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_setup(uint32_t spi_device_id, uint8_t slave_select,
|
||||
adf4350_init_param init_param)
|
||||
{
|
||||
struct adf4350_state *st = &adf4350_st;
|
||||
|
||||
adf4350_slave_select = slave_select;
|
||||
|
||||
SPISetupMode(spi_device_id,500000,0);//To CHeck last parameters : fixeme !
|
||||
st->pdata = (struct adf4350_platform_data *)malloc(sizeof(*st->pdata));
|
||||
if (!st->pdata)
|
||||
return -1;
|
||||
|
||||
st->pdata->clkin = init_param.clkin;
|
||||
|
||||
st->pdata->channel_spacing = init_param.channel_spacing;
|
||||
|
||||
st->pdata->power_up_frequency = init_param.power_up_frequency;
|
||||
st->pdata->ref_div_factor = init_param.reference_div_factor;
|
||||
st->pdata->ref_doubler_en = init_param.reference_doubler_enable;
|
||||
st->pdata->ref_div2_en = init_param.reference_div2_enable;
|
||||
|
||||
/* r2_user_settings */
|
||||
|
||||
st->pdata->r2_user_settings = init_param.phase_detector_polarity_positive_enable ?
|
||||
ADF4350_REG2_PD_POLARITY_POS : 0;
|
||||
st->pdata->r2_user_settings |= init_param.lock_detect_precision_6ns_enable ?
|
||||
ADF4350_REG2_LDP_6ns : 0;
|
||||
st->pdata->r2_user_settings |= init_param.lock_detect_function_integer_n_enable ?
|
||||
ADF4350_REG2_LDF_INT_N : 0;
|
||||
st->pdata->r2_user_settings |= ADF4350_REG2_CHARGE_PUMP_CURR_uA(init_param.charge_pump_current);
|
||||
st->pdata->r2_user_settings |= ADF4350_REG2_MUXOUT(init_param.muxout_select);
|
||||
st->pdata->r2_user_settings |= init_param.low_spur_mode_enable ? ADF4350_REG2_NOISE_MODE(0x3) : 0;
|
||||
|
||||
/* r3_user_settings */
|
||||
|
||||
st->pdata->r3_user_settings = init_param.cycle_slip_reduction_enable ?
|
||||
ADF4350_REG3_12BIT_CSR_EN : 0;
|
||||
st->pdata->r3_user_settings |= init_param.charge_cancellation_enable ?
|
||||
ADF4351_REG3_CHARGE_CANCELLATION_EN : 0;
|
||||
st->pdata->r3_user_settings |= init_param.anti_backlash_3ns_enable ?
|
||||
ADF4351_REG3_ANTI_BACKLASH_3ns_EN : 0;
|
||||
st->pdata->r3_user_settings |= init_param.band_select_clock_mode_high_enable ?
|
||||
ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH : 0;
|
||||
st->pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV(init_param.clk_divider_12bit);
|
||||
st->pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV_MODE(init_param.clk_divider_mode);
|
||||
|
||||
/* r4_user_settings */
|
||||
|
||||
st->pdata->r4_user_settings = init_param.aux_output_enable ?
|
||||
ADF4350_REG4_AUX_OUTPUT_EN : 0;
|
||||
st->pdata->r4_user_settings |= init_param.aux_output_fundamental_enable ?
|
||||
ADF4350_REG4_AUX_OUTPUT_FUND : 0;
|
||||
st->pdata->r4_user_settings |= init_param.mute_till_lock_enable ?
|
||||
ADF4350_REG4_MUTE_TILL_LOCK_EN : 0;
|
||||
st->pdata->r4_user_settings |= ADF4350_REG4_OUTPUT_PWR(init_param.output_power);
|
||||
st->pdata->r4_user_settings |= ADF4350_REG4_AUX_OUTPUT_PWR(init_param.aux_output_power);
|
||||
|
||||
adf4350_out_altvoltage0_refin_frequency(st->pdata->clkin);
|
||||
adf4350_out_altvoltage0_frequency_resolution(st->pdata->channel_spacing);
|
||||
adf4350_out_altvoltage0_frequency(st->pdata->power_up_frequency);
|
||||
|
||||
// printf("ADF4350 successfully initialized.\n");
|
||||
|
||||
/*int i;
|
||||
for(i=0;i<6;i++)
|
||||
printf("RegHw%d %x\n",i,st->regs[i]);
|
||||
printf("Reg2 %x\n",st->pdata->r2_user_settings);
|
||||
printf("Reg3 %x\n",st->pdata->r3_user_settings);
|
||||
printf("Reg4 %x\n",st->pdata->r4_user_settings);*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Stores PLL 0 frequency in Hz.
|
||||
*
|
||||
* @param Hz - The selected frequency.
|
||||
*
|
||||
* @return Returns the selected frequency.
|
||||
*******************************************************************************/
|
||||
int64_t adf4350_out_altvoltage0_frequency(int64_t Hz)
|
||||
{
|
||||
return adf4350_set_freq(&adf4350_st, Hz);
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Stores PLL 0 frequency resolution/channel spacing in Hz.
|
||||
*
|
||||
* @param Hz - The selected frequency.
|
||||
*
|
||||
* @return Returns the selected frequency.
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_out_altvoltage0_frequency_resolution(int32_t Hz)
|
||||
{
|
||||
if(Hz != INT32_MAX)
|
||||
{
|
||||
adf4350_st.chspc = Hz;
|
||||
}
|
||||
|
||||
return adf4350_st.chspc;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Sets PLL 0 REFin frequency in Hz.
|
||||
*
|
||||
* @param Hz - The selected frequency.
|
||||
*
|
||||
* @return Returns the selected frequency.
|
||||
*******************************************************************************/
|
||||
int64_t adf4350_out_altvoltage0_refin_frequency(int64_t Hz)
|
||||
{
|
||||
if(Hz != INT32_MAX)
|
||||
{
|
||||
adf4350_st.clkin = Hz;
|
||||
}
|
||||
|
||||
return adf4350_st.clkin;
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Powers down the PLL.
|
||||
*
|
||||
* @param pwd - Power option.
|
||||
* Example: 0 - Power up the PLL.
|
||||
* 1 - Power down the PLL.
|
||||
*
|
||||
* @return Returns the PLL's power status.
|
||||
*******************************************************************************/
|
||||
int32_t adf4350_out_altvoltage0_powerdown(int32_t pwd)
|
||||
{
|
||||
struct adf4350_state *st = &adf4350_st;
|
||||
|
||||
if(pwd == 1)
|
||||
{
|
||||
st->regs[ADF4350_REG2] |= ADF4350_REG2_POWER_DOWN_EN;
|
||||
adf4350_sync_config(st);
|
||||
}
|
||||
if(pwd == 0)
|
||||
{
|
||||
st->regs[ADF4350_REG2] &= ~ADF4350_REG2_POWER_DOWN_EN;
|
||||
adf4350_sync_config(st);
|
||||
}
|
||||
|
||||
return (st->regs[ADF4350_REG2] & ADF4350_REG2_POWER_DOWN_EN);
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
/***************************************************************************//**
|
||||
* @file adf4350.h
|
||||
* @brief Header file of ADF4350 Driver.
|
||||
* @author DBogdan (dragos.bogdan@analog.com)
|
||||
********************************************************************************
|
||||
* Copyright 2012-2015(c) Analog Devices, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of Analog Devices, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* - The use of this software may or may not infringe the patent rights
|
||||
* of one or more patent holders. This license does not release you
|
||||
* from the requirement that you obtain separate licenses from these
|
||||
* patent holders to use this software.
|
||||
* - Use of the software either in source or binary form, must be run
|
||||
* on or directly connected to an Analog Devices Inc. component.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#ifndef __ADF4350_H__
|
||||
#define __ADF4350_H__
|
||||
|
||||
/******************************************************************************/
|
||||
/***************************** Include Files **********************************/
|
||||
/******************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
/******************************************************************************/
|
||||
/********************** Macros and Constants Definitions **********************/
|
||||
/******************************************************************************/
|
||||
|
||||
/* Channels */
|
||||
#define ADF4350_RX_CHANNEL 0
|
||||
#define ADF4350_TX_CHANNEL 1
|
||||
|
||||
/* Registers */
|
||||
#define ADF4350_REG0 0
|
||||
#define ADF4350_REG1 1
|
||||
#define ADF4350_REG2 2
|
||||
#define ADF4350_REG3 3
|
||||
#define ADF4350_REG4 4
|
||||
#define ADF4350_REG5 5
|
||||
|
||||
/* REG0 Bit Definitions */
|
||||
#define ADF4350_REG0_FRACT(x) (((x) & 0xFFF) << 3)
|
||||
#define ADF4350_REG0_INT(x) (((x) & 0xFFFF) << 15)
|
||||
|
||||
/* REG1 Bit Definitions */
|
||||
#define ADF4350_REG1_MOD(x) (((x) & 0xFFF) << 3)
|
||||
#define ADF4350_REG1_PHASE(x) (((x) & 0xFFF) << 15)
|
||||
#define ADF4350_REG1_PRESCALER (1 << 27)
|
||||
|
||||
/* REG2 Bit Definitions */
|
||||
#define ADF4350_REG2_COUNTER_RESET_EN (1 << 3)
|
||||
#define ADF4350_REG2_CP_THREESTATE_EN (1 << 4)
|
||||
#define ADF4350_REG2_POWER_DOWN_EN (1 << 5)
|
||||
#define ADF4350_REG2_PD_POLARITY_POS (1 << 6)
|
||||
#define ADF4350_REG2_LDP_6ns (1 << 7)
|
||||
#define ADF4350_REG2_LDP_10ns (0 << 7)
|
||||
#define ADF4350_REG2_LDF_FRACT_N (0 << 8)
|
||||
#define ADF4350_REG2_LDF_INT_N (1 << 8)
|
||||
#define ADF4350_REG2_CHARGE_PUMP_CURR_uA(x) (((((x)-312) / 312) & 0xF) << 9)
|
||||
#define ADF4350_REG2_DOUBLE_BUFF_EN (1 << 13)
|
||||
#define ADF4350_REG2_10BIT_R_CNT(x) ((x) << 14)
|
||||
#define ADF4350_REG2_RDIV2_EN (1 << 24)
|
||||
#define ADF4350_REG2_RMULT2_EN (1 << 25)
|
||||
#define ADF4350_REG2_MUXOUT(x) ((x) << 26)
|
||||
#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29)
|
||||
|
||||
/* REG3 Bit Definitions */
|
||||
#define ADF4350_REG3_12BIT_CLKDIV(x) ((x) << 3)
|
||||
#define ADF4350_REG3_12BIT_CLKDIV_MODE(x) ((x) << 16)
|
||||
#define ADF4350_REG3_12BIT_CSR_EN (1 << 18)
|
||||
#define ADF4351_REG3_CHARGE_CANCELLATION_EN (1 << 21)
|
||||
#define ADF4351_REG3_ANTI_BACKLASH_3ns_EN (1 << 22)
|
||||
#define ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH (1 << 23)
|
||||
|
||||
/* REG4 Bit Definitions */
|
||||
#define ADF4350_REG4_OUTPUT_PWR(x) ((x) << 3)
|
||||
#define ADF4350_REG4_RF_OUT_EN (1 << 5)
|
||||
#define ADF4350_REG4_AUX_OUTPUT_PWR(x) ((x) << 6)
|
||||
#define ADF4350_REG4_AUX_OUTPUT_EN (1 << 8)
|
||||
#define ADF4350_REG4_AUX_OUTPUT_FUND (1 << 9)
|
||||
#define ADF4350_REG4_AUX_OUTPUT_DIV (0 << 9)
|
||||
#define ADF4350_REG4_MUTE_TILL_LOCK_EN (1 << 10)
|
||||
#define ADF4350_REG4_VCO_PWRDOWN_EN (1 << 11)
|
||||
#define ADF4350_REG4_8BIT_BAND_SEL_CLKDIV(x) ((x) << 12)
|
||||
#define ADF4350_REG4_RF_DIV_SEL(x) ((x) << 20)
|
||||
#define ADF4350_REG4_FEEDBACK_DIVIDED (0 << 23)
|
||||
#define ADF4350_REG4_FEEDBACK_FUND (1 << 23)
|
||||
|
||||
/* REG5 Bit Definitions */
|
||||
#define ADF4350_REG5_LD_PIN_MODE_LOW (0 << 22)
|
||||
#define ADF4350_REG5_LD_PIN_MODE_DIGITAL (1 << 22)
|
||||
#define ADF4350_REG5_LD_PIN_MODE_HIGH (3 << 22)
|
||||
|
||||
/* Specifications */
|
||||
#define ADF4350_MAX_OUT_FREQ 4400000000ULL /* Hz */
|
||||
#define ADF4350_MIN_OUT_FREQ 34375000 /* Hz */
|
||||
#define ADF4350_MIN_VCO_FREQ 2200000000ULL /* Hz */
|
||||
#define ADF4350_MAX_FREQ_45_PRESC 3000000000ULL /* Hz */
|
||||
#define ADF4350_MAX_FREQ_PFD 32000000 /* Hz */
|
||||
#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */
|
||||
#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */
|
||||
#define ADF4350_MAX_MODULUS 4095
|
||||
#define ADF4350_MAX_R_CNT 1023
|
||||
|
||||
/******************************************************************************/
|
||||
/************************ Types Definitions ***********************************/
|
||||
/******************************************************************************/
|
||||
struct adf4350_platform_data
|
||||
{
|
||||
uint32_t clkin;
|
||||
uint32_t channel_spacing;
|
||||
uint64_t power_up_frequency;
|
||||
|
||||
uint16_t ref_div_factor; /* 10-bit R counter */
|
||||
uint8_t ref_doubler_en;
|
||||
uint8_t ref_div2_en;
|
||||
|
||||
uint32_t r2_user_settings;
|
||||
uint32_t r3_user_settings;
|
||||
uint32_t r4_user_settings;
|
||||
int32_t gpio_lock_detect;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t clkin;
|
||||
uint32_t channel_spacing;
|
||||
uint32_t power_up_frequency;
|
||||
uint32_t reference_div_factor;
|
||||
uint8_t reference_doubler_enable;
|
||||
uint8_t reference_div2_enable;
|
||||
|
||||
/* r2_user_settings */
|
||||
uint8_t phase_detector_polarity_positive_enable;
|
||||
uint8_t lock_detect_precision_6ns_enable;
|
||||
uint8_t lock_detect_function_integer_n_enable;
|
||||
uint32_t charge_pump_current;
|
||||
uint32_t muxout_select;
|
||||
uint8_t low_spur_mode_enable;
|
||||
|
||||
/* r3_user_settings */
|
||||
uint8_t cycle_slip_reduction_enable;
|
||||
uint8_t charge_cancellation_enable;
|
||||
uint8_t anti_backlash_3ns_enable;
|
||||
uint8_t band_select_clock_mode_high_enable;
|
||||
uint32_t clk_divider_12bit;
|
||||
uint32_t clk_divider_mode;
|
||||
|
||||
/* r4_user_settings */
|
||||
uint8_t aux_output_enable;
|
||||
uint8_t aux_output_fundamental_enable;
|
||||
uint8_t mute_till_lock_enable;
|
||||
uint32_t output_power;
|
||||
uint32_t aux_output_power;
|
||||
}adf4350_init_param;
|
||||
|
||||
/******************************************************************************/
|
||||
/************************ Functions Declarations ******************************/
|
||||
/******************************************************************************/
|
||||
/*! Initializes the ADF4350. */
|
||||
int32_t adf4350_setup(uint32_t spi_device_id, uint8_t slave_select,
|
||||
adf4350_init_param init_param);
|
||||
/*! Writes 4 bytes of data to ADF4350. */
|
||||
int32_t adf4350_write(uint32_t data);
|
||||
/*! Stores PLL 0 frequency in Hz. */
|
||||
int64_t adf4350_out_altvoltage0_frequency(int64_t Hz);
|
||||
/*! Stores PLL 0 frequency resolution/channel spacing in Hz. */
|
||||
int32_t adf4350_out_altvoltage0_frequency_resolution(int32_t Hz);
|
||||
/*! Sets PLL 0 REFin frequency in Hz. */
|
||||
int64_t adf4350_out_altvoltage0_refin_frequency(int64_t Hz);
|
||||
/*! Powers down the PLL. */
|
||||
int32_t adf4350_out_altvoltage0_powerdown(int32_t pwd);
|
||||
|
||||
#endif // __ADF4350_H__
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spi/spidev.h>
|
||||
#include <wiringPi.h>
|
||||
#include "adf4351.h"
|
||||
|
||||
adf4350_init_param MyAdf=
|
||||
{.clkin=25000000,
|
||||
.channel_spacing=5000,
|
||||
.power_up_frequency=437000000,
|
||||
.reference_div_factor=0,
|
||||
.reference_doubler_enable=0,
|
||||
.reference_div2_enable=0,
|
||||
|
||||
// r2_user_settings
|
||||
.phase_detector_polarity_positive_enable=1,
|
||||
.lock_detect_precision_6ns_enable=0,
|
||||
.lock_detect_function_integer_n_enable=0,
|
||||
.charge_pump_current=7, // FixMe
|
||||
.muxout_select=0,
|
||||
.low_spur_mode_enable=1,
|
||||
|
||||
// r3_user_settings
|
||||
.cycle_slip_reduction_enable=1,
|
||||
.charge_cancellation_enable=0,
|
||||
.anti_backlash_3ns_enable=0,
|
||||
.band_select_clock_mode_high_enable=1,
|
||||
.clk_divider_12bit=0,
|
||||
.clk_divider_mode=0,
|
||||
|
||||
// r4_user_settings
|
||||
.aux_output_enable=1,
|
||||
.aux_output_fundamental_enable=1,
|
||||
.mute_till_lock_enable=0,
|
||||
.output_power=0,//-4dbm
|
||||
.aux_output_power=0
|
||||
|
||||
};
|
||||
uint32_t registers[6] = {0x4580A8, 0x80080C9, 0x4E42, 0x4B3, 0xBC803C, 0x580005};
|
||||
//REG 0
|
||||
//REG1 1000000000001000000011001 001
|
||||
//REG2 100111001000 010
|
||||
//REG3 10010110 011
|
||||
//REG4 101111001000000000111 100
|
||||
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief Powers off or sets the Synth frequency.
|
||||
*
|
||||
* @param "off" or freq in MHz (float).
|
||||
*
|
||||
* @return 0 or 1 if freq out of bounds
|
||||
*******************************************************************************/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (wiringPiSetup() == -1);
|
||||
|
||||
if (strcmp(argv[1], "off") == 0)
|
||||
{
|
||||
// Turn VCO Off and return
|
||||
|
||||
adf4350_out_altvoltage0_powerdown(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if ( atof(argv[1])>=35 && atof(argv[1])<=4400 )
|
||||
{
|
||||
// Valid freq, so set it
|
||||
uint32_t adf4350_requested_frequency = 1000000 * atof(argv[1]);
|
||||
|
||||
adf4350_setup(0,0,MyAdf);
|
||||
adf4350_out_altvoltage0_frequency(adf4350_requested_frequency);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Requested freq out of limits so print error and return 1
|
||||
printf("ERROR: Requested Frequency out of limits");
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
}
|
Plik diff jest za duży
Load Diff
19
update.sh
19
update.sh
|
@ -1,32 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
# Updated by davecrump 20161210
|
||||
|
||||
set -e # Don't report errors
|
||||
|
||||
# ---------- Update rpidatv -----------
|
||||
|
||||
cd /home/pi
|
||||
#git clone git://github.com/F5OEO/rpidatv -> BUG IN QEMU : Go to download method
|
||||
wget https://github.com/F5OEO/rpidatv/archive/master.zip -O master.zip
|
||||
unzip -o master.zip
|
||||
cp -f -r rpidatv-master rpidatv
|
||||
rm master.zip
|
||||
|
||||
#rpidatv core
|
||||
# Compile rpidatv core
|
||||
cd rpidatv/src
|
||||
make clean
|
||||
make
|
||||
sudo make install
|
||||
#rpidatv gui
|
||||
|
||||
# Compile rpidatv gui
|
||||
cd gui
|
||||
make clean
|
||||
make
|
||||
sudo make install
|
||||
cd ../
|
||||
#avc2ts
|
||||
|
||||
# Compile avc2ts
|
||||
cd avc2ts
|
||||
make clean
|
||||
make
|
||||
sudo make install
|
||||
|
||||
#install adf4351
|
||||
cd /home/pi/rpidatv/src/adf4351
|
||||
make
|
||||
cp adf4351 ../../bin/
|
||||
cd /home/pi/rpidatv
|
||||
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue