Skip to content

Commit

Permalink
xu5: show network status on the OLED display
Browse files Browse the repository at this point in the history
This change only affect target xu5_st1 but can be easily ported to others.
The display controller is a SSD1306.

fbpad(a frame buffer terminal emulator) is expected to by provided by the
rootfs.
  • Loading branch information
EmilioPeJu committed May 1, 2024
1 parent 1c08986 commit bcec7a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions targets/xu5_st1/etc/target-defs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,22 @@ STA_LED_OFFSET=25
DIA_LED_OFFSET=24

get_mac_address() { :; }

target_specific_start() {
# Show hostname, IP and link status in the OLED display
if [ -e /sys/class/graphics/fb0 ]; then
cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode
cat <<EOF > /var/run/show-status.sh
#!/bin/sh
while true; do
clear; hostname -s
ip addr show eth0 | head -n3 | tail -n1 | cut -d' ' -f 6
[ \$(cat /sys/class/net/eth0/carrier) -eq 1 ] &&
echo "Link up" || echo "Link down"
sleep 2
done
EOF
chmod +x /var/run/show-status.sh
fbpad /var/run/show-status.sh &
fi
}
9 changes: 9 additions & 0 deletions targets/xu5_st1/target-top.dts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@

&sdhci1 {
disable-wp;
no-1-8-v;
};

&i2c0 {
clock-frequency = <100000>;
ssd1306: oled@0x3c {
compatible = "solomon,ssd1306";
reg = <0x3c>;
solomon,height = <64>;
solomon,width = <128>;
solomon,page-offset = <0>;
solomon,segment-no-remap;
};
};

&qspi {
Expand Down

0 comments on commit bcec7a2

Please sign in to comment.