Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. class bar
  2. {
  3.         public function setup_pins($port_no, $units)
  4.         {
  5.                 for ($i = 0; $i < $this->pin_qty[$port_no]; $i++)
  6.                 {
  7.                         echo "Setting up pin " . $i . "\n";
  8.                         $this->pin[$i] = new Pin;
  9.                         if ($port_no > 3)
  10.                         {
  11.                                 $this->pins = 8;
  12.                         }
  13.                         else
  14.                         {
  15.                                 $this->pins = 1;
  16.                         }
  17.                         $this->pin[$i]->setup_unit($i, $units);
  18.                 }
  19.         }
  20. }
  21.  
  22. class Pin
  23. {      
  24.        public function setup_unit($pin_no, $units)
  25.        {
  26.                 $this->do_counter();
  27.                 echo "Setting up unit " . $units[$this->c] . "\n";
  28.                 $this->set_bitmask($pin_no);
  29.                 $this->set_unit_no($units[$this->c]);
  30.                 $this->create_call_file($units[$this->c]);
  31.         }
  32.  
  33.         public function do_counter()
  34.         {
  35.                 if (! isset($this->c))
  36.                 {
  37.                         $this->c = 0;
  38.                         echo "Not set\n";
  39.                 }
  40.                 else
  41.                 {
  42.                         $this->c++;
  43.                         echo "C is " . $this->c . "\n";
  44.                 }
  45.         }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement