-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.py
64 lines (51 loc) · 1.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# PyMite interface to the Magic Lantern firmware
"""__NATIVE__
#include "bmp.h"
#include "pymite-helpers.h"
"""
def bmp_puts(x,y,s):
"""__NATIVE__
PmReturn_t retval = PM_RET_OK;
if( NATIVE_GET_NUM_ARGS() != 3 )
{
PM_RAISE( retval, PM_RET_EX_TYPE );
return retval;
}
int x = PM_ARG_INT(0);
int y = PM_ARG_INT(1);
pPmObj_t pn = NATIVE_GET_LOCAL(2);
if( OBJ_GET_TYPE(pn) == OBJ_TYPE_STR )
{
bmp_printf( FONT_LARGE, x, y, "%s", ((pPmString_t)pn)->val );
NATIVE_SET_TOS(PM_NONE);
return retval;
}
if( OBJ_GET_TYPE(pn) == OBJ_TYPE_INT )
{
bmp_printf( FONT_LARGE, x, y, "%d", (int) ((pPmInt_t)pn)->val );
NATIVE_SET_TOS(PM_NONE);
return retval;
}
PM_RAISE( retval, PM_RET_EX_TYPE );
return retval;
"""
pass
def bmp_fill(color,x,y,w,h):
"""__NATIVE__
PmReturn_t retval = PM_RET_OK;
if( NATIVE_GET_NUM_ARGS() != 5 )
{
PM_RAISE( retval, PM_RET_EX_TYPE );
return retval;
}
unsigned color = PM_ARG_INT(0);
unsigned x = PM_ARG_INT(1);
unsigned y = PM_ARG_INT(2);
unsigned w = PM_ARG_INT(3);
unsigned h = PM_ARG_INT(4);
bmp_fill( color, x, y, w, h );
NATIVE_SET_TOS(PM_NONE);
return retval;
"""
pass
#print "Hello, world from %s!" % "Pymite"