Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

OZ-Framework


  • Please log in to reply
8 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 06:04 AM

I am making a project that will simplify many aspects of programming for the netduino... take a look:
Would you use it? Would it help program quicker?
Image is big so go look there.
http://oz.heliohost.org/Images/OZ-Framework.png

WHOOPS: Misspelled witch and On the Digital_Read it should be...
pin: The Pin which you will read input through.

EDIT: Added A pin safety feature as suggested by kingpin2k:

        public Digital_Write(Cpu.Pin pin, bool state)
        {
            if (Pin_Management.Pin_Free(pin))
                _port = new OutputPort(pin, state);
            else
                throw new Exception("The pin you provided is already being used.");
        }

EDIT: I am now adding a Math class with many useful methods

#2 kingpin2k

kingpin2k

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationUSA

Posted 16 August 2010 - 06:10 AM

I'd be careful just sending in a pin to an object. If someone tries to instantiate two of your Digital_Write objects with the same pin and inside of each of those Digital_Write objects they in turn try to both instantiate an OutputPort with that pin it will toss some very unhappy errors. It's almost safer to just pass in an OutputPort that's already been tied to a pin. Both Digital_Write objects could have a reference to the single OutputPort and everything will be honkeydorey. Just a fyi. And I'm sure it will be useful, who doesn't love a good wrapper class!
Homer: [Meeting Aliens] Please don't eat me! I have a wife and kids. Eat them!

#3 kingpin2k

kingpin2k

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationUSA

Posted 16 August 2010 - 06:13 AM

I am making a project that will simplify many aspects of programming for the netduino... take a look:
Would you use it? Would it help program quicker?

WHOOPS: Misspelled witch and On the Digital_Read it should be...
pin: The Pin witch you will read input through.

lol Copy and paste is bad sometimes.


Heh, and I believe you mean which :) You can tell if someone is a witch if they weigh more than a duck.
Homer: [Meeting Aliens] Please don't eat me! I have a wife and kids. Eat them!

#4 Solidus

Solidus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 August 2010 - 06:18 AM

I'd be careful just sending in a pin to an object. If someone tries to instantiate two of your Digital_Write objects with the same pin and inside of each of those Digital_Write objects they in turn try to both instantiate an OutputPort with that pin it will toss some very unhappy errors. It's almost safer to just pass in an OutputPort that's already been tied to a pin. Both Digital_Write objects could have a reference to the single OutputPort and everything will be honkeydorey. Just a fyi.

This would be a good idea to implement in the Netduino API. CreatePort or something. First call is instantiation, second is returning the reference. Just a thought.

#5 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 01:41 PM

I'd be careful just sending in a pin to an object. If someone tries to instantiate two of your Digital_Write objects with the same pin and inside of each of those Digital_Write objects they in turn try to both instantiate an OutputPort with that pin it will toss some very unhappy errors. It's almost safer to just pass in an OutputPort that's already been tied to a pin. Both Digital_Write objects could have a reference to the single OutputPort and everything will be honkeydorey. Just a fyi. And I'm sure it will be useful, who doesn't love a good wrapper class!

I am working on a Port_Management Class that would first check that a pin is not being used.

#6 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 01:43 PM

Heh, and I believe you mean which :) You can tell if someone is a witch if they weigh more than a duck.

Oh yes yes... I love English so much. I'm the only Cuban programmer here I think! No, I hate Castro and Communism

#7 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 02:44 PM

I'd be careful just sending in a pin to an object. If someone tries to instantiate two of your Digital_Write objects with the same pin and inside of each of those Digital_Write objects they in turn try to both instantiate an OutputPort with that pin it will toss some very unhappy errors. It's almost safer to just pass in an OutputPort that's already been tied to a pin. Both Digital_Write objects could have a reference to the single OutputPort and everything will be honkeydorey. Just a fyi. And I'm sure it will be useful, who doesn't love a good wrapper class!

I fixed it, I think. Look at the edit

#8 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 16 August 2010 - 02:44 PM

I am working on a Port_Management Class that would first check that a pin is not being used.

Please note that general naming convention for class names in .NET Framework is Pascal casing. For more detailed information please have a look at official guidelines.

#9 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 02:48 PM

Please note that general naming convention for class names in .NET Framework is Pascal casing. For more detailed information please have a look at official guidelines.


Good idea. I usually have my own way of doing things. I got to do it right if I publish it!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.