예제 #1
0
uint16_t AnalogMux::AnalogRead(uint8_t pin) {
  // this method calculates which pin to read, switches to it and then returns
  // the currently value
  //Serial.print( AnalogMux::AnalogRead() );
  //Serial.print( " " );
  SelectPin(pin);
  delayMicroseconds(4500);
  // delay(1000);
  return AnalogMux::AnalogRead();
}
예제 #2
0
uint16_t AnalogMux::AnalogRead(uint8_t pin) {
  // this method calculates which pin to read, switches to it and then returns
  // the currently value
  SelectPin(pin);
  return AnalogMux::AnalogRead();
}
예제 #3
0
void AnalogDeMux::AnalogWrite(uint8_t wpin, uint8_t value) {
  // write the value to the specified pin - no checking for correctness of this
  SelectPin(wpin);
  AnalogDeMux::AnalogWrite(value);
}
예제 #4
0
/* Callback when the user clicks on a PCB node in the right node treeview.
 */
static void
node_selection_changed_cb (GtkTreeSelection * selection, gpointer data)
{
  GtkTreeIter iter;
  GtkTreeModel *model;
  LibraryMenuType *node_net;
  LibraryEntryType *node;
  static gchar *node_name;
	gint		x0, y0, margin;

  if (selection_holdoff)	/* PCB is highlighting, user is not selecting */
    return;

  /* Toggle off the previous selection.  Look up node_name to make sure
  |  it still exists.  This toggling can get out of sync if a node is
  |  toggled selected, then the net that includes the node is selected
  |  then unselected.
  */
  if ((node = node_get_node_from_name (node_name, &node_net)) != NULL)
    {
      /* If net node belongs to has been highlighted/unhighighed, toggling
      |  if off here will get our on/off toggling out of sync.
      */
      if (node_net == node_selected_net)
	SelectPin (node, TRUE);
      g_free (node_name);
      node_name = NULL;
    }

  /* Get the selected treeview row.
   */
  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
    {
      if (node)
        ghid_invalidate_all ();
      return;
    }

  /* From the treeview row, extract the node pointer stored there and
  |  we've got a pointer to the LibraryEntryType (node) the row
  |  represents.
  */
  gtk_tree_model_get (model, &iter, NODE_LIBRARY_COLUMN, &node, -1);

  dup_string (&node_name, node->ListEntry);
  node_selected_net = selected_net;

  /* Now just toggle a select of the node on the layout and pan.
   */
  SelectPin (node, TRUE);
  IncrementUndoSerialNumber ();
	margin = gport->view_width / 20;
	if (   Crosshair.X < gport->view_x0 + margin
	    || Crosshair.X > gport->view_x0 + gport->view_width - margin
	    || Crosshair.Y < gport->view_y0 + margin
	    || Crosshair.Y > gport->view_y0 + gport->view_height - margin
	   )
	  {

	    x0 = SIDE_X (Crosshair.X) - gport->view_width / 2;
	    y0 = SIDE_Y (Crosshair.Y) - gport->view_height / 2;
	    gport->view_x0 = x0;
	    gport->view_y0 = y0;
	    ghid_pan_fixup ();
	    gui->set_crosshair (Crosshair.X, Crosshair.Y, HID_SC_WARP_POINTER);
	  }
	ghid_screen_update();
}