Spin Semiconductor Forum Index Spin Semiconductor
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SpinCAD Designer - intermediate classes for SpinCADBlocks

 
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> FV-1 software questions
View previous topic :: View next topic  
Author Message
Digital Larry



Joined: 12 Nov 2012
Posts: 274

PostPosted: Tue Apr 30, 2013 5:38 am    Post subject: SpinCAD Designer - intermediate classes for SpinCADBlocks Reply with quote

Here I'm showing the POTCADBlock, which is an intermediate class extended by each of the actual blocks POT0CADBlock, POT1CADBlock, and POT2CADBlock.

Code:

/* SpinCAD Designer - DSP Development Tool for the Spin FV-1
 * Copyright (C)2013 - Gary Worsham
 * Based on ElmGen by Andrew Kilpatrick
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *    
 */

package com.holycityaudio.SpinCAD.ControlBlocks;

import java.awt.Color;

import com.holycityaudio.SpinCAD.SpinCADBlock;

public class PotCADBlock extends SpinCADBlock{

   /**
    *
    */
   private static final long serialVersionUID = -6291190763689134131L;

   public PotCADBlock(int x, int y) {
      super(x, y);
      // TODO Auto-generated constructor stub
      addControlOutputPin(this);   //   feedback
      setBorderColor(Color.MAGENTA);
   }
}



The PotCADBlock constructor adds a single Control Output pin and sets the block color to magenta. All POTCADBlocks have one Control Output pin and are magenta. Below, I show the POT0CADBlock class which extends the POTCADBlock class.

The constructor here gives the block a name.

The generateCode() method associates the Control Output 1 pin with the POT0 register.

Code:

/* SpinCAD Designer - DSP Development Tool for the Spin FV-1
 * Copyright (C)2013 - Gary Worsham
 * Based on ElmGen by Andrew Kilpatrick
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *    
 */

package com.holycityaudio.SpinCAD.ControlBlocks;

import com.holycityaudio.SpinCAD.fxblocks.basic.SpinFXBlock;

public class Pot0CADBlock extends PotCADBlock{

   /**
    *
    */
   private static final long serialVersionUID = 3427388550727980484L;

   public Pot0CADBlock(int x, int y) {
      super(x, y);
      // TODO Auto-generated constructor stub
      setName("Pot 0");
   }
   
   public void generateCode(SpinFXBlock eP) {
      System.out.println("Pot 0 codegen!");
      this.getPin("Control Output 1").setRegister(POT0);
   }

}


More soon!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> FV-1 software questions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group