Search found 30 matches

by PappaPeppar
Fri Oct 30, 2015 10:29 pm
Forum: General Discussion and Questions
Topic: Viper and return values
Replies: 13
Views: 11139

Re: Viper and return values

Thanks for your answers. There are obviously some constraints on how viper can be used. This is the actual calculations I were trying to optimize. import math import sys L=220 R=170.0/2 K = (R/2*1.7320508075688772)**2 Rh = R/2 Lsq = L * L def d(x ,y): yplusK = y+K Az = math.sqrt(Lsq - (x)**2 - (y-R)...
by PappaPeppar
Fri Oct 30, 2015 8:14 am
Forum: General Discussion and Questions
Topic: Viper and return values
Replies: 13
Views: 11139

Re: Viper and return values

Nope, does not work. looking in the code it seems that viper does not support float.
by PappaPeppar
Thu Oct 29, 2015 8:14 am
Forum: General Discussion and Questions
Topic: Viper and return values
Replies: 13
Views: 11139

Re: Viper and return values

I now realize that my simplified code extract does not show what I want to do. I want to use floats in the calculation. @micropython.viper def foo(v:int): return (v*3.6, v*2.3) Does not work. Neither does @micropython.viper def foo(v:int): a = int(v*3.6) b = int(v*2.3) return (a, b) So it looks like...
by PappaPeppar
Wed Oct 28, 2015 9:31 pm
Forum: General Discussion and Questions
Topic: Viper and return values
Replies: 13
Views: 11139

Viper and return values

Is it possible to return more than one value from a viper optimized method/function? E.g.

Code: Select all

@micropython.viper
def foo(v):
	return (v*2, v*3)
gives
ViperTypeError: can't do binary op between 'object' and 'int'
by PappaPeppar
Mon Aug 03, 2015 2:21 pm
Forum: MicroPython pyboard
Topic: CAN bus skin
Replies: 7
Views: 6666

Re: CAN bus skin

The latest code from master works fine.
by PappaPeppar
Thu Jul 30, 2015 7:55 pm
Forum: MicroPython pyboard
Topic: CAN bus skin
Replies: 7
Views: 6666

Re: CAN bus skin

Do you get any messages through if you connect the two ports on the board?
by PappaPeppar
Thu Jul 30, 2015 7:03 pm
Forum: MicroPython pyboard
Topic: CAN bus skin
Replies: 7
Views: 6666

Re: CAN bus skin

I have not used the boards fore some time. But i hope that the tests should have catched any software regression. All CAN code that i have done has been merged into master. One thing that has been troubled me a bit is the fact that I have not been able to try the board and the code with a third part...
by PappaPeppar
Tue Jun 09, 2015 8:28 pm
Forum: MicroPython pyboard
Topic: CAN bus skin
Replies: 7
Views: 6666

Re: CAN bus skin

Sorry for a late reply. Yes the board works fine. I should mention that I made it only to be able to develop the code and to be used on my desk. For a real application you should probably not use RJ11 connectors and cables.
by PappaPeppar
Fri Dec 19, 2014 6:21 pm
Forum: General Discussion and Questions
Topic: how to receive can message?
Replies: 1
Views: 2984

Re: how to receive can message?

First, if you want to receive a message on the same bus (CAN controller) as you send the message on you have to set the bus in LOOPBACK mode. Second, don't use 32 bit filters with basic frames. It is not supported. The following initialization code works. can.init(CAN.LOOPBACK,False,2,sjw=1,bs1=15,b...
by PappaPeppar
Thu Dec 18, 2014 10:53 pm
Forum: MicroPython pyboard
Topic: CAN bus skin
Replies: 7
Views: 6666

CAN bus skin

I just put together a skin for the pyboard with two CAN transceivers. It actually seems to work :o . If anyone is interested it can be found here https://github.com/PappaPeppar/pybcanskin