11
11
#include "py/runtime.h"
12
12
#include "py/binary.h"
13
13
14
+ #if CIRCUITPY_ULAB
14
15
#include "extmod/ulab/code/ulab.h"
15
16
#include "extmod/ulab/code/ndarray.h"
17
+ #endif
16
18
17
19
#include "shared-module/_eve/__init__.h"
18
20
#include "shared-bindings/_eve/__init__.h"
@@ -847,6 +849,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
847
849
848
850
// }
849
851
852
+ #if CIRCUITPY_ULAB
850
853
static bool is_vector (mp_obj_t a ) {
851
854
if (!mp_obj_is_type (a , & ulab_ndarray_type )) {
852
855
return false;
@@ -857,6 +860,7 @@ static bool is_vector(mp_obj_t a) {
857
860
}
858
861
return true;
859
862
}
863
+ #endif
860
864
861
865
// Hand-written functions {
862
866
@@ -867,6 +871,7 @@ static bool is_vector(mp_obj_t a) {
867
871
//| :param float y: pixel y-coordinate"""
868
872
//| ...
869
873
static mp_obj_t _vertex2f (mp_obj_t self , mp_obj_t a0 , mp_obj_t a1 ) {
874
+ #if CIRCUITPY_ULAB
870
875
if (is_vector (a0 ) && is_vector (a1 )) {
871
876
ndarray_obj_t * v0 = MP_OBJ_TO_PTR (a0 );
872
877
ndarray_obj_t * v1 = MP_OBJ_TO_PTR (a1 );
@@ -875,11 +880,12 @@ static mp_obj_t _vertex2f(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
875
880
for (size_t i = 0 ; i < v0 -> len ; i ++ , p0 ++ , p1 ++ ) {
876
881
common_hal__eve_Vertex2f (EVEHAL (self ), * p0 , * p1 );
877
882
}
878
- } else {
879
- mp_float_t x = mp_obj_get_float (a0 );
880
- mp_float_t y = mp_obj_get_float (a1 );
881
- common_hal__eve_Vertex2f (EVEHAL (self ), x , y );
883
+ return mp_const_none ;
882
884
}
885
+ #endif
886
+ mp_float_t x = mp_obj_get_float (a0 );
887
+ mp_float_t y = mp_obj_get_float (a1 );
888
+ common_hal__eve_Vertex2f (EVEHAL (self ), x , y );
883
889
return mp_const_none ;
884
890
}
885
891
static MP_DEFINE_CONST_FUN_OBJ_3 (vertex2f_obj , _vertex2f ) ;
0 commit comments