add initial support (framebuffer creation)

This commit is contained in:
Ladyada 2019-08-31 00:54:57 -04:00
parent e9dbd94117
commit c08a01eb36

View file

@ -75,7 +75,7 @@ selectN() {
function print_version() {
echo "Adafruit PiTFT Helper v2.0.0"
echo "Adafruit PiTFT Helper v2.1.0"
exit 1
}
@ -220,6 +220,24 @@ function update_configtxt() {
overlay="dtoverlay=pitft35-resistive,rotate=${pitftrot},speed=20000000,fps=20"
fi
if [ "${pitfttype}" == "st7789_240x240" ]; then
cat >> /etc/modprobe.d/fbtft.conf <<EOF
# --- added by adafruit-pitft-helper $date ---
options fbtft_device name=flexfb gpios=dc:25,cs:8,led:26 speed=40000000 bgr=1 fps=60
options flexfb setaddrwin=0 width=240 height=240 init=-1,0x11,-2,120,-1,0x36,0x00,-1,0x3A,0x05,-1,0xB2,0x0C,0x0C,0x00,0x33,0x33,-1,0xB7,0x35,-1,0xBB,0x1A,-1,0xC0,0x2C,-1,0xC2,0x01,-1,0xC3,0x0B,-1,0xC4,0x20,-1,0xC6,0x0F,-1,0xD0,0xA4,0xA1,-1,0x21,-1,0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F,-1,0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F,-1,0x29,-3
# --- end adafruit-pitft-helper $date ---
EOF
echo "flexfb" >> /etc/modules
echo "fbtft_device" >> /etc/modules
echo "spi-bcm2835" >> /etc/modules
overlay=""
else
rm -f /etc/modprobe.d/fbtft.conf
sed -i 's/flexfb//g' "/etc/modules"
sed -i 's/fbtft_device//g' "/etc/modules"
sed -i 's/spi-bcm2835//g' "/etc/modules"
fi
date=`date`
@ -475,9 +493,10 @@ selectN "PiTFT 2.4\", 2.8\" or 3.2\" resistive (240x320)" \
"PiTFT 2.2\" no touch (240x320)" \
"PiTFT 2.8\" capacitive touch (240x320)" \
"PiTFT 3.5\" resistive touch (320x480)" \
"Braincraft 1.54\" display (240x240)" \
"Quit without installing"
PITFT_SELECT=$?
if [ $PITFT_SELECT -gt 4 ]; then
if [ $PITFT_SELECT -gt 5 ]; then
exit 1
fi
@ -492,7 +511,7 @@ if [ $PITFT_ROTATE -gt 4 ]; then
fi
PITFT_ROTATIONS=("90" "180" "270" "0")
PITFT_TYPES=("28r" "22" "28c" "35r")
PITFT_TYPES=("28r" "22" "28c" "35r" "st7789_240x240")
WIDTH_VALUES=(320 320 320 480)
HEIGHT_VALUES=(240 240 240 320)
HZ_VALUES=(64000000 64000000 64000000 32000000)
@ -553,12 +572,13 @@ pitfttype=${PITFT_TYPES[$PITFT_SELECT-1]}
pitftrot=${PITFT_ROTATIONS[$PITFT_ROTATE-1]}
if [ "${pitfttype}" != "28r" ] && [ "${pitfttype}" != "28c" ] && [ "${pitfttype}" != "35r" ] && [ "${pitfttype}" != "22" ]; then
if [ "${pitfttype}" != "28r" ] && [ "${pitfttype}" != "28c" ] && [ "${pitfttype}" != "35r" ] && [ "${pitfttype}" != "22" ] && [ "${pitfttype}" != "st7789_240x240" ]; then
echo "Type must be one of:"
echo " '28r' (2.8\" resistive, PID 1601)"
echo " '28c' (2.8\" capacitive, PID 1983)"
echo " '35r' (3.5\" Resistive)"
echo " '22' (2.2\" no touch)"
echo " 'st7789_240x240' (1.54\" or 1.3\" no touch)"
echo
print_help
fi