diff --git a/RPiCamera/README.md b/RPiCamera/README.md new file mode 100755 index 0000000..5401e53 --- /dev/null +++ b/RPiCamera/README.md @@ -0,0 +1,42 @@ +# Use RPi Camera in your Mini Pupper +## Step1: Connect Pi Camera to the Raspberry Pi 4B CSI Port +1. Ensure the Raspberry Pi is turned off and unplugged from the power source. +2. Locate the CSI (Camera Serial Interface) port on the Raspberry Pi 4B. This port is a rectangular-shaped connector located between the micro HDMI and audio ports. +![camera_port_4B](/imgs/camera_port_4B.png) +3. Open the camera module's plastic tab by gently pulling it away from the circuit board. +![camera_module.png](/imgs/camera_camera_module.png) +1. Gently insert the ribbon cable into the camera module's connector with the shiny contacts facing the circuit board. +2. Push the plastic tab back into place to secure the ribbon cable. +3. Gently insert the other end of the ribbon cable into the CSI port on the Raspberry Pi 4B, making sure that the shiny contacts are facing the micro HDMI port. +4. Push the ribbon cable firmly into the CSI port, ensuring that it is properly connected. +![camera_connect_camera](/imgs/camera_connect_camera.gif) + +Remember to handle the ribbon cable and connector carefully to avoid damage, and double-check that everything is properly aligned before inserting or securing the cable. +![camera_all_4B](/imgs/camera_all_4B.jpg) +For additional information, please refer to the official Raspberry Pi documentation on [getting started with Picamera](https://projects.raspberrypi.org/en/projects/getting-started-with-picamera), which includes these images. + +## Step2: Install the camera driver and configure Raspberry Pi + +```bash +cd ~/mini_pupper_bsp/RPiCamera # To RPiCamera directory +``` + +```bash +. install.sh # Set camera configurations +``` + +## Step3: Test camera + + +- Camera ffplay test +```bash +cd ~/mini_pupper_bsp/demos # To demos directory +``` + +```bash +sudo apt install python-is-python3 -y # install python +python camera_ffplay_test.py # run ffplay test demo +``` +- Camera image in RViz +TODO + diff --git a/RPiCamera/details_for_install_sh.md b/RPiCamera/details_for_install_sh.md new file mode 100755 index 0000000..3a0eb62 --- /dev/null +++ b/RPiCamera/details_for_install_sh.md @@ -0,0 +1,28 @@ +# sudo apt install -y v4l-utils +The command "sudo apt install -y v4l-utils" installs the Video 4 Linux (v4l) utilities package on a Debian-based Linux system. + +Video 4 Linux is a kernel module that provides support for webcams and other video capture devices on Linux systems. The v4l-utils package provides a set of command-line utilities for working with video capture devices, such as listing available devices, adjusting device settings, and capturing video. + +Some of the utilities provided by v4l-utils include v4l2-ctl, which allows for querying and adjusting video device settings, and v4l2-sysfs-path, which can be used to identify the device path of a video device. + +Overall, the v4l-utils package is essential for working with video capture devices on Linux systems and enables developers to create applications that can access video streams from cameras and other capture devices. + +# # camera_auto_detect=1 +This command checks if the configuration file /boot/firmware/config.txt contains a line that starts with "camera_auto_detect=1". If such a line is found, it is commented out by adding a "#" character at the beginning of the line using the sed command. The purpose of this is to disable the camera auto-detection feature on the Raspberry Pi, as it can cause conflicts when using certain camera modules. + +# echo "gpu_mem=128" | sudo tee -a /boot/firmware/config.txt +When using a CSI camera on a Raspberry Pi, setting the `gpu_mem` to 128MB is recommended because the GPU needs a sufficient amount of memory to be able to process the data from the camera. The CSI camera interface uses the GPU to handle the camera data, and if there is not enough memory allocated to the GPU, the system may become unstable or the camera may not work correctly. By setting the `gpu_mem` to 128MB, we ensure that the GPU has enough memory to handle the camera data and avoid potential issues. + +# echo "start_x=1" | sudo tee -a /boot/firmware/config.txt +This command adds a line "start_x=1" to the end of the /boot/firmware/config.txt file. This line enables the Raspberry Pi to start the X Windows system on boot, which is necessary for running graphical applications and interfaces. By default, this line is commented out, which means that the X Windows system is not started on boot. + +# sudo usermod -aG video $USER +The command "sudo usermod -aG video $USER" adds the current user to the "video" group on the system. This grants the user permission to access video devices such as cameras and webcams. + +In Linux, user accounts are associated with one or more groups, which are used to control access to files and devices on the system. The "video" group is a special group that grants access to video devices. By default, only users who are members of this group can access video devices. + +When the "sudo usermod -aG video $USER" command is executed, it modifies the user account by adding the user to the "video" group. The "-aG" option specifies that the user should be added to the group, rather than replacing any existing group membership. The "$USER" variable is expanded to the username of the current user. + +After the command is executed and the user is added to the "video" group, the user will have access to video devices without needing to use the "sudo" command. This is because members of the "video" group have the necessary permissions to access video devices. +# sudo dtc -I dts -O dtb -o /boot/firmware/dt-blob.bin dt-blob-cam1.dts +This command compiles a DTS file into a binary DTB file and saves it to the specified output file path /boot/dt-blob.bin. The DTB file contains information about the hardware devices connected to the Raspberry Pi, which is used by the operating system to properly configure and use those devices. diff --git a/RPiCamera/dts/Readme.md b/RPiCamera/dts/Readme.md new file mode 100755 index 0000000..ea4d39e --- /dev/null +++ b/RPiCamera/dts/Readme.md @@ -0,0 +1,9 @@ +# What is dt-blob-cam1.dts? +The dt-blob-cam1.dts file is a Device Tree Source file that defines the hardware configuration of a Raspberry Pi compute module. The Camera Serial Interface (CSI) is a dedicated interface in Raspberry Pi for connecting the Raspberry Pi camera module to the Raspberry Pi board. The CSI camera is connected to the camera interface via a ribbon cable, providing a high-speed data connection between the camera and the processor. The dt-blob-cam1.dts file configures the GPIO pins for the CSI camera interface and enables the interface. + +The dt-blob-cam1.dts file provides the necessary hardware configuration for the CSI camera interface, including the configuration of the GPIO pins used for the interface. Without this configuration, the Raspberry Pi board will not be able to communicate with the camera module via the CSI interface. + +In summary, the dt-blob-cam1.dts file is essential for enabling the CSI camera interface on the Raspberry Pi compute module. Without it, the camera module would not function correctly. + +# Where can I find official Raspberry Pi dts examples? +For more information about dts files, please refer to the [RPi_Datasheets](https://datasheets.raspberrypi.org). diff --git a/RPiCamera/dts/dt-blob-cam1.dts b/RPiCamera/dts/dt-blob-cam1.dts new file mode 100755 index 0000000..b471832 --- /dev/null +++ b/RPiCamera/dts/dt-blob-cam1.dts @@ -0,0 +1,2575 @@ +/dts-v1/; + +/ { + videocore { + pins_rev1 { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p2 { function = "i2c1"; termination = "pull_up"; }; // I2C 1 SDA + pin@p3 { function = "i2c1"; termination = "pull_up"; }; // I2C 1 SCL + pin@p5 { function = "output"; termination = "pull_down"; }; // CAM_LED + pin@p6 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN_RUN + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p16 { function = "output"; termination = "pull_up"; polarity="active_low"; }; // activity LED + pin@p27 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p46 { function = "input"; termination = "no_pulling"; }; // Hotplug + pin@p47 { function = "input"; termination = "no_pulling"; }; // SD_CARD_DETECT + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <2>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <3>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <27>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <5>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <16>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <6>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <40>; + }; + pin_define@PWMR { + type = "internal"; + number = <45>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <1>; + }; + pin_define@SD_CARD_DETECT { + type = "internal"; + number = <47>; + }; + pin_define@ID_SDA { + type = "absent"; + }; + pin_define@ID_SCL { + type = "absent"; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <1>; + }; + }; // pin_defines + }; // pins_rev1 + + pins_rev2 { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p0 { function = "i2c0"; termination = "pull_up"; }; // I2C 0 SDA + pin@p1 { function = "i2c0"; termination = "pull_up"; }; // I2C 0 SCL + pin@p5 { function = "output"; termination = "pull_down"; }; // CAM_LED + pin@p6 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN NRESET + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p16 { function = "output"; termination = "pull_up"; polarity = "active_low"; }; // activity LED + pin@p21 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p46 { function = "input"; termination = "no_pulling"; }; // Hotplug + pin@p47 { function = "input"; termination = "no_pulling"; }; // SD_CARD_DETECT + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <21>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <5>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <16>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <6>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <40>; + }; + pin_define@PWMR { + type = "internal"; + number = <45>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "internal"; + number = <47>; + }; + pin_define@ID_SDA { + type = "absent"; + }; + pin_define@ID_SCL { + type = "absent"; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <2>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <3>; + }; + }; // pin_defines + }; // pins + + pins_bplus1 { // Pi 1 Model B+ rev 1.1 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p31 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p35 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN_RUN + pin@p38 { function = "output"; termination = "no_pulling"; }; // USB current limit (0=600mA, 1=1200mA) + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "internal"; + number = <31>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <35>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <44>; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "internal"; + number = <38>; + }; + pin_define@PWML { + type = "internal"; + number = <45>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <28>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <29>; + }; + }; // pin_defines + }; // pins + + pins_bplus2 { // Pi 1 Model B+ rev 1.2 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p31 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN_RUN + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p35 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + pin@p38 { function = "output"; termination = "no_pulling"; }; // USB current limit (0=600mA, 1=1200mA) + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "internal"; + number = <35>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <31>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <44>; + }; + pin_define@USB_LIMIT_1A2 { + type = "internal"; + number = <38>; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <45>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <28>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <29>; + }; + }; // pin_defines + }; // pins + + pins_aplus { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p35 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + pin@p38 { function = "output"; termination = "no_pulling"; }; // USB current limit (0=600mA, 1=1200mA) + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "internal"; + number = <35>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "internal"; + number = <38>; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <45>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <28>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <29>; + }; + }; // pin_defines + }; // pins + + pins_2b1 { // Pi 2 Model B rev 1.0 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA / SMPS_SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL / SMPS_SCL + pin@p31 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN_RUN + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p35 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + pin@p38 { function = "output"; termination = "no_pulling"; }; // USB current limit (0=600mA, 1=1200mA) + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "internal"; + number = <35>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <31>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <28>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <29>; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <44>; + }; + pin_define@USB_LIMIT_1A2 { + type = "internal"; + number = <38>; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <45>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <28>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <29>; + }; + }; // pin_defines + }; // pins + + pins_2b2 { // Pi 2 Model B rev 1.1 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p31 { function = "output"; termination = "pull_down"; startup_state = "active"; }; // LAN_RUN + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p35 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + pin@p38 { function = "output"; termination = "no_pulling"; }; // USB current limit (0=600mA, 1=1200mA) + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + // Communicate with the SMPS by "bit-bashing" the I2C protocol on GPIOs 42 and 43 + pin@p42 { function = "output"; termination = "pull_up"; }; // SMPS_SCL + pin@p43 { function = "input"; termination = "no_pulling"; }; // SMPS_SDA + pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p45 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "internal"; + number = <35>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "internal"; + number = <31>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <43>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <42>; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <44>; + }; + pin_define@USB_LIMIT_1A2 { + type = "internal"; + number = <38>; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <45>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "internal"; + number = <3>; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <28>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <29>; + }; + }; // pin_defines + }; // pins + + pins_3b1 { // Pi 3 Model B rev 1.0 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p42 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p43 { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; }; // Status LED + pin@p131 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // LAN_RUN + pin@p132 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera LED + pin@p134 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p135 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "external"; + number = <4>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <6>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "external"; + number = <5>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "external"; + number = <7>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "external"; + number = <3>; + }; + pin_define@LAN_RUN_BOOT { + type = "internal"; + number = <29>; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <44>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <45>; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <42>; + }; + pin_define@WL_LPO_CLK { + type = "internal"; + number = <43>; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <41>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + + pins_3b2 { // Pi 3 Model B rev 1.2 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p42 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p43 { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; }; // ACT_LED + pin@p131 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // LAN_RUN + pin@p132 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p134 { function = "output"; termination = "no_pulling"; }; // Camera LED + pin@p135 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "external"; + number = <4>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "external"; + number = <6>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "external"; + number = <7>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "external"; + number = <2>; + }; + pin_define@LAN_RUN { + type = "external"; + number = <3>; + }; + pin_define@LAN_RUN_BOOT { + type = "internal"; + number = <29>; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <46>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <47>; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <42>; + }; + pin_define@WL_LPO_CLK { + type = "internal"; + number = <43>; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <41>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + + pins_3bplus { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p29 { function = "output"; termination = "no_pulling"; }; // ACT_LED (GREEN) + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p42 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output + pin@p43 { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "active"; }; // PWR_LED (RED) + pin@p131 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // LAN_RUN + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p134 { function = "output"; termination = "no_pulling"; }; // Camera LED + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <28>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "external"; + number = <6>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_PWR_OK { + type = "external"; + number = <2>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <29>; + }; + pin_define@LAN_RUN { + type = "external"; + number = <3>; + }; + pin_define@LAN_RUN_BOOT { + type = "internal"; + number = <30>; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <46>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <47>; + }; + pin_define@ETH_CLK { + type = "internal"; + number = <42>; + }; + pin_define@WL_LPO_CLK { + type = "internal"; + number = <43>; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <41>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + + pins_3aplus { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p29 { function = "output"; termination = "no_pulling"; }; // ACT_LED (GREEN) + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p43 { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "active"; }; // PWR_LED (RED) + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p134 { function = "output"; termination = "no_pulling"; }; // Camera LED + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <28>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "external"; + number = <6>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_PWR_OK { + type = "external"; + number = <2>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <29>; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@LAN_RUN_BOOT { + type = "internal"; + number = <30>; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <46>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <47>; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "internal"; + number = <43>; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "internal"; + number = <41>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + + pins_cm3 { // Pi 3 CM3 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p0 { function = "input"; termination = "pull_up"; }; // CAMERA 0 I2C0 SDA + pin@p1 { function = "input"; termination = "pull_up"; }; // CAMERA 0 I2C0 SCL + pin@p2 { function = "output"; termination = "no_pulling"; }; // CAMERA 0 LED + pin@p3 { function = "output"; termination = "no_pulling"; }; // CAMERA 0 SHUTDOWN + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p129 { function = "output"; termination = "no_pulling"; polarity = "active_low"; }; // EMMC_ENABLE_N + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "external"; + number = <0>; + }; + pin_define@EMMC_ENABLE { + type = "external"; + number = <1>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "absent"; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <46>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <47>; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "absent"; + }; + pin_define@ID_SCL { + type = "absent"; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <2>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <3>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <1>; + }; + }; // pin_defines + }; // pins + + pins_cm4 { // Pi 4 CM4 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p46 { function = "input"; termination = "pull_up"; }; // SMPS_SCL + pin@p47 { function = "input"; termination = "pull_up"; }; // SMPS_SDA + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "active"; }; // PWR_LED (RED) + pin@p131 { function = "output"; termination = "no_pulling"; }; // ANT1 + pin@p132 { function = "output"; termination = "no_pulling"; }; // SD VDDIO + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p134 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // SD_PWR_ON + pin@p135 { function = "output"; termination = "no_pulling"; }; // ANT2 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "external"; + number = <0>; + }; + pin_define@EMMC_ENABLE { + type = "external"; + number = <1>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "absent"; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@SMPS_SDA { + type = "internal"; + number = <46>; + }; + pin_define@SMPS_SCL { + type = "internal"; + number = <47>; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "absent"; + }; + }; // pin_defines + }; // pins + + pins_pi0 { // Pi zero + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p41 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_up"; polarity="active_low"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <41>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <32>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "absent"; + }; + pin_define@DISPLAY_SDA { + type = "absent"; + }; + pin_define@DISPLAY_SCL { + type = "absent"; + }; + }; // pin_defines + }; // pins + + pins_pi0w { // Pi zero W + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p28 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p29 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "output"; termination = "pull_down"; }; // Camera LED + pin@p41 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p43 { function = "gp_clk"; termination = "pull_down"; }; // WIFI_CLK - Wifi 32kHz output + pin@p44 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p45 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p46 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Hotplug + pin@p47 { function = "output"; termination = "pull_up"; polarity="active_low"; }; // activity LED + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "internal"; + number = <46>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <28>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <29>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <40>; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <47>; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@BT_ON { + type = "internal"; + number = <45>; + }; + pin_define@WL_ON { + type = "internal"; + number = <41>; + }; + pin_define@WL_LPO_CLK { + type = "internal"; + number = <43>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "absent"; + }; + pin_define@DISPLAY_SDA { + type = "absent"; + }; + pin_define@DISPLAY_SCL { + type = "absent"; + }; + }; // pin_defines + }; // pins + + pins_cm { + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p0 { function = "input"; termination = "pull_up"; }; // CAMERA 0 I2C0 SDA + pin@p1 { function = "input"; termination = "pull_up"; }; // CAMERA 0 I2C0 SCL + pin@p2 { function = "output"; termination = "no_pulling"; }; // CAMERA 0 LED + pin@p3 { function = "output"; termination = "no_pulling"; }; // CAMERA 0 SHUTDOWN + pin@p14 { function = "uart0"; termination = "no_pulling"; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; }; // RX uart0 + pin@p47 { function = "output"; termination = "no_pulling"; polarity = "active_low"; }; // EMMC_ENABLE_N + pin@p48 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CLK + pin@p49 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD CMD + pin@p50 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D0 + pin@p51 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D1 + pin@p52 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D2 + pin@p53 { function = "sdcard"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // SD D3 + }; // pin_config + + pin_defines { + pin_define@EMMC_ENABLE { + type = "internal"; + number = <47>; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "absent"; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "absent"; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "absent"; + }; + pin_define@ID_SCL { + type = "absent"; + }; + pin_define@CAMERA_0_LED { + type = "internal"; + number = <2>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "internal"; + number = <3>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <1>; + }; + }; // pin_defines + }; // pins_cm + + pins_4b { // Pi4 Model B + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio + pin@p41 { function = "pwm"; termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio + pin@p42 { function = "output"; termination = "pull_up"; }; // activity LED + pin@p43 { function = "input"; termination = "pull_up"; }; // SPIFLASH_CE_N + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p46 { function = "input"; termination = "pull_up"; drive_strength_mA = < 14 >; }; // Dummy pin for HSTL drive on bank 2 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "active"; }; // PWR_LED (RED) + pin@p131 { function = "output"; termination = "no_pulling"; }; // GLOBAL_RESET + pin@p132 { function = "output"; termination = "no_pulling"; }; // SD VDDIO + pin@p133 { function = "output"; termination = "no_pulling"; }; // Camera shutdown + pin@p134 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // SD_PWR_ON + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "absent"; + }; + pin_define@EMMC_ENABLE { + type = "absent"; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@CAMERA_0_SDA_PIN { + type = "internal"; + number = <44>; + }; + pin_define@CAMERA_0_SCL_PIN { + type = "internal"; + number = <45>; + }; + pin_define@CAMERA_0_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@CAMERA_0_UNICAM_PORT { + type = "internal"; + number = <1>; + }; + pin_define@CAMERA_0_LED { + type = "absent"; + }; + pin_define@FLASH_0_ENABLE { + type = "absent"; + }; + pin_define@FLASH_0_INDICATOR { + type = "absent"; + }; + pin_define@FLASH_1_ENABLE { + type = "absent"; + }; + pin_define@FLASH_1_INDICATOR { + type = "absent"; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_PWR_OK { + type = "external"; + number = <2>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "internal"; + number = <42>; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@GLOBAL_RESET { + type = "external"; + number = <3>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "external"; + number = <4>; + }; + pin_define@SD_PWR_ON { + type = "external"; + number = <6>; + }; + pin_define@PWML { + type = "internal"; + number = <41>; + }; + pin_define@PWMR { + type = "internal"; + number = <40>; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + + pins_400 { // Pi400 + pin_config { + pin@default { + polarity = "active_high"; + termination = "pull_down"; + startup_state = "inactive"; + function = "input"; + }; // pin + pin@p14 { function = "uart0"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0 + pin@p15 { function = "uart0"; termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0 + pin@p34 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p35 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p36 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p37 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p38 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p39 { function = "input"; termination = "pull_up"; drive_strength_mA = < 8 >; }; + pin@p40 { function = "input"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // Used for SPI flash + pin@p41 { function = "input"; termination = "no_pulling"; drive_strength_mA = < 8 >; }; // Used for SPI flash + pin@p42 { function = "output"; termination = "pull_up"; polarity = "active_high"; startup_state = "active"; }; // power LED + pin@p43 { function = "input"; termination = "pull_up"; }; // SPIFLASH_CE_N + pin@p44 { function = "input"; termination = "pull_up"; }; // I2C 0 SDA + pin@p45 { function = "input"; termination = "pull_up"; }; // I2C 0 SCL + pin@p46 { function = "input"; termination = "pull_up"; drive_strength_mA = < 14 >; }; // Dummy pin for HSTL drive on bank 2 + pin@p128 { function = "output"; termination = "no_pulling"; }; // BT_ON + pin@p129 { function = "output"; termination = "no_pulling"; }; // WL_ON + pin@p130 { function = "output"; termination = "no_pulling"; polarity = "active_low"; startup_state = "active"; }; // PWR_LED (RED) + pin@p131 { function = "output"; termination = "no_pulling"; }; // GLOBAL_RESET + pin@p132 { function = "output"; termination = "no_pulling"; }; // SD VDDIO + pin@p133 { function = "output"; termination = "no_pulling"; }; // GLOBAL_SHUTDOWN + pin@p134 { function = "output"; termination = "no_pulling"; startup_state = "active"; }; // SD_PWR_ON + }; // pin_config + + pin_defines { + pin_define@HDMI_CONTROL_ATTACHED { + type = "absent"; + }; + pin_define@EMMC_ENABLE { + type = "absent"; + }; + pin_define@NUM_CAMERAS { + type = "internal"; + number = <0>; + }; + pin_define@POWER_LOW { + type = "absent"; + }; + pin_define@LEDS_PWR_OK { + type = "external"; + number = <2>; + }; + pin_define@LEDS_DISK_ACTIVITY { + type = "absent"; + }; + pin_define@LAN_RUN { + type = "absent"; + }; + pin_define@BT_ON { + type = "external"; + number = <0>; + }; + pin_define@WL_ON { + type = "external"; + number = <1>; + }; + pin_define@GLOBAL_RESET { + type = "external"; + number = <3>; + }; + pin_define@GLOBAL_SHUTDOWN { + type = "external"; + number = <5>; + }; + pin_define@SHUTDOWN_REQUEST { + type = "external"; + number = <7>; + }; + pin_define@SMPS_SDA { + type = "absent"; + }; + pin_define@SMPS_SCL { + type = "absent"; + }; + pin_define@ETH_CLK { + type = "absent"; + }; + pin_define@WL_LPO_CLK { + type = "absent"; + }; + pin_define@USB_LIMIT_1A2 { + type = "absent"; + }; + pin_define@SIO_1V8_SEL { + type = "external"; + number = <4>; + }; + pin_define@SD_PWR_ON { + type = "external"; + number = <6>; + }; + pin_define@PWML { + type = "absent"; + }; + pin_define@PWMR { + type = "absent"; + }; + pin_define@SAFE_MODE { + type = "absent"; + }; + pin_define@SD_CARD_DETECT { + type = "absent"; + }; + pin_define@ID_SDA { + type = "internal"; + number = <0>; + }; + pin_define@ID_SCL { + type = "internal"; + number = <1>; + }; + pin_define@DISPLAY_I2C_PORT { + type = "internal"; + number = <0>; + }; + pin_define@DISPLAY_SDA { + type = "internal"; + number = <44>; + }; + pin_define@DISPLAY_SCL { + type = "internal"; + number = <45>; + }; + }; // pin_defines + }; // pins + }; +}; diff --git a/RPiCamera/install.sh b/RPiCamera/install.sh new file mode 100755 index 0000000..ff77051 --- /dev/null +++ b/RPiCamera/install.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# This script configures a Raspberry Pi for use with a camera module. +# Version: 1.1 +# Date: 2023-04-10 + +# Exit the script immediately if a command exits with a non-zero status +# set -x +set -e + +# Define an error handing function +function handle_error { + echo "Error: $1" + read -p "Press Enter to continue..." + exit 1 +} + +# Set the error handling function +trap 'handle_error "$?"' ERR + +# Get the directory where this script is located +BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +# Update and upgrade the system +sudo apt update +sudo apt upgrade -y + +# Install v4l2, a video capture utility +sudo apt install -y v4l-utils + +# Edit the /boot/firmware/config.txt file to enable camera support +sudo sed -i 's/^camera_auto_detect=1/# camera_auto_detect=1/g' /boot/firmware/config.txt +echo "gpu_mem=128" | sudo tee -a /boot/firmware/config.txt +echo "start_x=1" | sudo tee -a /boot/firmware/config.txt + +# Add the user to the video group to grant access to video devices +sudo usermod -aG video $USER + +# Compile the dt-blob file to support the camera +cd $BASEDIR/dts +sudo dtc -I dts -O dtb -o /boot/firmware/dt-blob.bin dt-blob-cam1.dts +# For more details about the dts file, please refer to [https://datasheets.raspberrypi.org](https://datasheets.raspberrypi.org) + +# Print successful information +echo "Camera settings successful, changes will be applied after the next reboot." + + diff --git a/demos/camera_ffplay_test.py b/demos/camera_ffplay_test.py new file mode 100755 index 0000000..236f833 --- /dev/null +++ b/demos/camera_ffplay_test.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +import os + + +# Command 1: Check if ffmpeg is already installed +cmd1_check = "dpkg -s ffmpeg" +while os.system(cmd1_check) != 0: + # Install ffmpeg + cmd1_install = "sudo apt install -y ffmpeg" + os.system(cmd1_install) + +print("FFmpeg is already installed, continuing with the script.") + +# Command 2: Check camera status +expected_result2 = "supported=1 detected=1, libcamera interfaces=0" +cmd2 = "vcgencmd get_camera" +os.system( + "gnome-terminal --geometry=80x24+640+0 -- bash -c \ + 'echo \"Expected Result: {0}\n\"; echo; {1}; echo; \ + exec bash'".format(expected_result2, cmd2)) + +# Command 3: List available video devices +expected_result3 = "/dev/video0" +cmd3 = "v4l2-ctl --list-devices" +os.system( + "gnome-terminal --geometry=80x24+0+480 -- bash -c \ + 'echo \"Expected Result: {0}\n\"; echo; {1}; echo; \ + exec bash'".format(expected_result3, cmd3)) + +# Command 4: Play video from device 0 +cmd4 = "ffplay /dev/video0" +os.system( + "gnome-terminal --geometry=80x24+640+480 -- bash -c \ + '{0}; exec bash'".format(cmd4)) diff --git a/imgs/camera_all_4B.jpg b/imgs/camera_all_4B.jpg new file mode 100644 index 0000000..c23806e Binary files /dev/null and b/imgs/camera_all_4B.jpg differ diff --git a/imgs/camera_camera_module.png b/imgs/camera_camera_module.png new file mode 100644 index 0000000..cd5d833 Binary files /dev/null and b/imgs/camera_camera_module.png differ diff --git a/imgs/camera_connect_camera.gif b/imgs/camera_connect_camera.gif new file mode 100644 index 0000000..00c9a95 Binary files /dev/null and b/imgs/camera_connect_camera.gif differ diff --git a/imgs/camera_port_4B.png b/imgs/camera_port_4B.png new file mode 100644 index 0000000..f304852 Binary files /dev/null and b/imgs/camera_port_4B.png differ diff --git a/imgs/copyright_readme.md b/imgs/copyright_readme.md new file mode 100644 index 0000000..f769d19 --- /dev/null +++ b/imgs/copyright_readme.md @@ -0,0 +1,4 @@ +camera_all_4B.jpg from https://projects.raspberrypi.org/en/projects/getting-started-with-picamera +camera_camera_module.png from https://projects.raspberrypi.org/en/projects/getting-started-with-picamera/1 +camera_port_4B.png from https://projects.raspberrypi.org/en/projects/getting-started-with-picamera/1 +camera_connect_camera.gif from https://projects.raspberrypi.org/en/projects/getting-started-with-picamera/2