Contents Up Previous Next

HiPi::RaspberryPi

This module provides several useful functions that provide information about your Raspberry Pi


HiPi::RaspberryPi::get_piboard_info()
    Returns a hash reference containing information about
    your Raspberry Pi.

    the keys are: model, memory, processor, hardware, pinplan,
                  manufacturer, revision, serial, release

    Example for a Raspberry Pi 3

    model         => 'Raspberry Pi 3'
    memory        => '1024'
    processor     => 'BCM2837'
    hardware      => 'BCM2709'    
    pinplan       => '3'
    manufacturer  => 'Sony'
    revision      => '2'
    serial        => '00000000abcd123'
    release       => 'Q1 2016'

    model : a descriptive string for this RPi model

    memory : memory in GB

    processor : BCM2837 for RPi 3, BCM2836 for RPi 2,
                BCM2835 for all other RPi models
    
    hardware : BCM2709 for RPi 3 and RPi 2. BCM2708
               for al other RPi models

    pinplan : 1 for the 26 pin GPIO on the original Model 
                B revision 1.0 board.
              2 for the 26 pin GPIO ( and 8 pin PAD 5 ) on the 
                Model B revision 2.0 and Model A boards.
              3 for the 40 pin GPIO on RPi 3, Zero, 2, B+ and
                A+ boards.

    manufacturer : descriptive string for manufacturer

    revision : revision number of this particular board type

    serial : serial number of the Raspberry Pi
   
    release : descriptive string for the release date of this 
              board type and revision
  
HiPi::RaspberryPi::get_piboard_rev()
    returns 1,2 or 3 - value from 'pinplan' 
    member of HiPi::RaspberryPi::get_piboard_info();
HiPi::RaspberryPi::get_validpins()
    Returns an array of GPIO pin numbers valid
    for this Raspberry Pi. (valid == connected
    to the Raspberry Pi GPIO pads.)
    For example, the first two array members
    for a Model B Revision 1 board are 0 and 1.
    The first two array members returned for
    a Module B Revision 2 or Model A board are 2 and 3
HiPi::RaspberryPi::get_cpuinfo()
    Returns a hash reference containing the
    key => value pairs extracted from /proc/cpuinfo
    with an additional key 'GPIO Revision' that
    contains the value 1 for the original Model B revision 1.0 
    board and 2 for all boards since.

    The hash is purely informational and should not be used to
    determine actions.

    For code control, use HiPi::RaspberryPi::get_piboard_info()

    Example Returned Hash Key Value Pairs

    'GPIO Revision'     => '2'
    'Processor'         => 'ARMv6-compatible processor rev 7 (v6l)'
    'BogoMIPS'          => '697.95'
    'Features'          => 'swp half thumb fastmult vfp edsp java tls'
    'CPU implementer'   => '0x41'
    'CPU architecture'  => '7'
    'CPU variant'       => '0x0'
    'CPU part'          => '0xb76'
    'CPU revision'      => '7'
    'Hardware'          => 'BCM2708'
    'Revision'          => '000f'
    'Serial'            => '00000000ec4805c2'

    A Model A Raspberry Pi will have 2 for the
    'GPIO Revision' value.




Contents Up Previous Next


HiPi Modules Copyright © 2013 - 2016 Mark Dootson