Tasmota/lib/libesp32/Berry-0.1.10/src/port/be_wirelib.c

55 lines
1.6 KiB
C
Raw Normal View History

2021-02-28 19:50:37 +00:00
/********************************************************************
* Tasmota lib
*
* To use: `import wire`
*
* 2 wire communication - I2C
*******************************************************************/
#include "be_object.h"
2021-03-13 21:42:24 +00:00
extern int b_wire_init(bvm *vm);
2021-02-28 19:50:37 +00:00
extern int b_wire_begintransmission(bvm *vm);
extern int b_wire_endtransmission(bvm *vm);
extern int b_wire_requestfrom(bvm *vm);
extern int b_wire_available(bvm *vm);
extern int b_wire_write(bvm *vm);
extern int b_wire_read(bvm *vm);
2021-03-07 18:37:18 +00:00
extern int b_wire_scan(bvm *vm);
extern int b_wire_validwrite(bvm *vm);
2021-03-03 07:34:38 +00:00
extern int b_wire_validread(bvm *vm);
2021-03-20 17:44:35 +00:00
extern int b_wire_detect(bvm *vm);
2021-03-03 07:34:38 +00:00
2021-02-28 19:50:37 +00:00
// #if !BE_USE_PRECOMPILED_OBJECT
#if 1 // TODO we will do pre-compiled later
2021-03-13 21:42:24 +00:00
void be_load_wirelib(bvm *vm)
{
static const bnfuncinfo members[] = {
{ "_bus", NULL }, // bus number
{ "init", b_wire_init },
2021-03-20 17:44:35 +00:00
{ "_begin_transmission", b_wire_begintransmission },
{ "_end_transmission", b_wire_endtransmission },
{ "_request_from", b_wire_requestfrom },
2021-03-13 21:42:24 +00:00
{ "_available", b_wire_available },
{ "_write", b_wire_write },
{ "_read", b_wire_read },
{ "scan", b_wire_scan },
{ "write", b_wire_validwrite },
{ "read", b_wire_validread },
2021-03-20 17:44:35 +00:00
{ "detect", b_wire_detect },
2021-03-13 21:42:24 +00:00
{ NULL, NULL }
};
2021-03-21 09:03:58 +00:00
be_regclass(vm, "Wire_ntv", members);
2021-03-13 21:42:24 +00:00
}
2021-02-28 19:50:37 +00:00
#else
/* @const_object_info_begin
module tasmota (scope: global, depend: 1) {
2021-03-20 17:44:35 +00:00
get_free_heap, func(l_getFreeHeap)
2021-02-28 19:50:37 +00:00
}
@const_object_info_end */
#include "../generate/be_fixed_tasmota.h"
#endif