How to reset button on NGo - Netduino Go - Netduino Forums
   
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

How to reset button on NGo


  • Please log in to reply
5 replies to this topic

#1 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 12 October 2012 - 02:27 PM

how do i write button on NGo board to reset it? inputport button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled); Btw could be? var button = new InputPort(Pins.Button, false,Port.ResistorMode.Disabled);

Edited by supra, 12 October 2012 - 02:33 PM.


#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 12 October 2012 - 02:38 PM

I believe it's something like this:

private static InterruptPort _ResetButton = new InterruptPort(Pins.Button, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);

        public static void Main()
        {
            _ResetButton.OnInterrupt += delegate(uint PinId, uint Value, DateTime Time) { 
                Debug.Print("RESET pressed"); 
                PowerState.RebootDevice(true); 
            };
            _ResetButton.EnableInterrupt();

            // Your code here :-)
        }

"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 12 October 2012 - 02:47 PM

@stefan
it is ok with this?
InterruptPort button = new InterruptPort(Pins.Button,false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);

#4 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 12 October 2012 - 02:49 PM

You may enable the glitch filter, for sure, and Pins.Button could be equal to (Cpu.Pin)0x2E. I can't check that out right now though.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#5 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 13 October 2012 - 10:16 AM

glitch filter?, is that some debouncing?, is that built into .netmf or the chip?

--
Asbjørn


#6 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 13 October 2012 - 11:31 AM

glitch filter?, is that some debouncing?, is that built into .netmf or the chip?


It have no clue if it's in the MCU or in the .netmf, but if it is the latter it's deep inside...

If you pass the value true in the glitchFilter parameter when creating an InputPort, it can "debounce" the attached switch. The exact time that determines whether or not a pair of signals is considered a bounce is controllable with Cpu.GlitchFilterTime value. A pair of signals that appears within the specified interval will be ignored by the InterruptPort.


Funny this info is now in a thread where it actually don't matter much, we are resetting the MCU, but for every other button that generates interrupts, or should I say, one interrupt. ;)

- Ulrik




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.