Skip to content

Commit

Permalink
Use the new I2S API and add tests. (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch authored Feb 6, 2025
1 parent 4872a01 commit d8e86dc
Show file tree
Hide file tree
Showing 24 changed files with 2,149 additions and 285 deletions.
724 changes: 664 additions & 60 deletions lib/i2s.toit

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/compiler/propagation/type_primitive_i2s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ MODULE_TYPES(i2s, MODULE_I2S)

TYPE_PRIMITIVE_ANY(init)
TYPE_PRIMITIVE_ANY(create)
TYPE_PRIMITIVE_ANY(start)
TYPE_PRIMITIVE_ANY(stop)
TYPE_PRIMITIVE_ANY(preload)
TYPE_PRIMITIVE_ANY(close)
TYPE_PRIMITIVE_ANY(write)
TYPE_PRIMITIVE_ANY(read)
TYPE_PRIMITIVE_ANY(read_to_buffer)
TYPE_PRIMITIVE_ANY(errors)

} // namespace toit::compiler
} // namespace toit
25 changes: 22 additions & 3 deletions src/primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,14 @@ namespace toit {

#define MODULE_I2S(PRIMITIVE) \
PRIMITIVE(init, 0) \
PRIMITIVE(create, 12) \
PRIMITIVE(create, 13) \
PRIMITIVE(start, 1) \
PRIMITIVE(stop, 1) \
PRIMITIVE(preload, 2) \
PRIMITIVE(close, 2) \
PRIMITIVE(write, 2) \
PRIMITIVE(read, 1) \
PRIMITIVE(read_to_buffer, 2) \
PRIMITIVE(errors, 1) \

#define MODULE_SPI(PRIMITIVE) \
PRIMITIVE(init, 3) \
Expand Down Expand Up @@ -1227,10 +1230,26 @@ Object* get_absolute_path(Process* process, const wchar_t* pathname, wchar_t* ou
_A_T_##t11(10, n11); \
_A_T_##t12(11, n12);

#define _OVERRIDE(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, NAME, ...) NAME
#define _A_26(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5, t6, n6, t7, n7, t8, n8, t9, n9, t10, n10, t11, n11, t12, n12, t13, n13) \
_A_T_##t1(0, n1); \
_A_T_##t2(1, n2); \
_A_T_##t3(2, n3); \
_A_T_##t4(3, n4); \
_A_T_##t5(4, n5); \
_A_T_##t6(5, n6); \
_A_T_##t7(6, n7); \
_A_T_##t8(7, n8); \
_A_T_##t9(8, n9); \
_A_T_##t10(9, n10); \
_A_T_##t11(10, n11); \
_A_T_##t12(11, n12); \
_A_T_##t13(12, n13);

#define _OVERRIDE(_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, NAME, ...) NAME

#define ARGS(...) \
_OVERRIDE(__VA_ARGS__, \
_A_26, _ODD, \
_A_24, _ODD, \
_A_22, _ODD, \
_A_20, _ODD, \
Expand Down
Loading

0 comments on commit d8e86dc

Please sign in to comment.