Search found 3821 matches

by dhylands
Fri Sep 11, 2015 4:34 pm
Forum: MicroPython pyboard
Topic: genFile on SDcard ?
Replies: 5
Views: 4312

Re: genFile on SDcard ?

When you open a file you can specify a path. /flash is the path which gets you to the root of the internal flash drive, and /sd gets you to the root of the sdcard. So if you do something like this: >>> file = open('/sd/myfile.txt', 'wb') >>> file.write('This is a test\n') 15 >>> file.close() then it...
by dhylands
Fri Sep 11, 2015 4:23 pm
Forum: MicroPython pyboard
Topic: converting bytearray
Replies: 2
Views: 14722

Re: converting bytearray

So, you could do it the old fashioned way: num = x[0] * 256 + x[1] or alternatively: num = x[0] << 8 | x[1] You could also use: import usruct as struct (num,) = struct.unpack('>h', x) and a little example done on the REPL: >>> import ustruct as struct >>> x = bytearray((1,2)) >>> (num,) = struct.unp...
by dhylands
Fri Sep 11, 2015 8:09 am
Forum: General Discussion and Questions
Topic: MicroPython in piCore Linux
Replies: 3
Views: 7493

Re: MicroPython in piCore Linux

Nice. This will definitely be on my list of things to look at.
by dhylands
Thu Sep 10, 2015 8:06 pm
Forum: MicroPython pyboard
Topic: RTC sleep and interrupt callback clarification
Replies: 12
Views: 11363

Re: RTC sleep and interrupt callback clarification

The only thing that may come as a result of that is that there can be bounce when you release the switch as well as when you press the switch. The release bounce can cause falling edges. My normal solution is to have a small state machine for each switch that has 4 states: OFF, BOUNCING_ON, ON, and ...
by dhylands
Thu Sep 10, 2015 4:25 pm
Forum: Hardware Projects
Topic: Audio Codec daughterboard for I2S
Replies: 5
Views: 7072

Re: Audio Codec daughterboard for I2S

I'd be interested in one (no specific reason right now - but making noise sounds like fun)
by dhylands
Thu Sep 10, 2015 4:23 pm
Forum: MicroPython pyboard
Topic: RTC sleep and interrupt callback clarification
Replies: 12
Views: 11363

Re: RTC sleep and interrupt callback clarification

You should be able to use pyb.delay(), just don't use it between disable_irq/enable_irq calls. I think that your problem is probably related to switch bounce. I think I'd move the check for switch value out of the IRQ handler and put it inside the if interruptFlag_1 perhaps after a small delay. I'd ...
by dhylands
Thu Sep 10, 2015 4:13 pm
Forum: MicroPython pyboard
Topic: Max generate Freq of PIN OUT ?
Replies: 2
Views: 2666

Re: Max generate Freq of PIN OUT ?

I don't know what the max frequency is.

You'll be able to get much shorter pulses using say a hardware timer than by using software.

You can definitely get less than 3 usec pulse. See this discussion: http://forum.micropython.org/viewtopic.php?f=2&t=829
by dhylands
Wed Sep 09, 2015 4:40 pm
Forum: MicroPython pyboard
Topic: RTC sleep and interrupt callback clarification
Replies: 12
Views: 11363

Re: RTC sleep and interrupt callback clarification

Adding a sleep won't eliminate the race. The correct way to do this is to disable interrupts, check if you should go to sleep and if so call pyb.stop() and then re-enable interrupts. Note: pyb.stop() is doing a WFI call. If a button push occurs after interrupts are disabled and before the WFI, then ...
by dhylands
Tue Sep 08, 2015 3:38 pm
Forum: Other Boards
Topic: Porting to STM32F0 and F1
Replies: 7
Views: 8827

Re: Porting to STM32F0 and F1

I compiled the "minimal" port using the ARM compiler and it came in around 78K.

The teensy port (which has USB serial but no UMS) is around 190K.