| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517 |
- #include "pocketpy.h"
- #include <string.h>
- #include <stdint.h>
- #include "periphery.h"
- #define ADD_ENUM(name) py_newint(py_emplacedict(mod, py_name(#name)), name)
- static bool gpio_config__new__(int argc, py_Ref argv) {
- py_Type cls = py_totype(argv);
- py_newobject(py_retval(), cls, 0, sizeof(gpio_config_t));
- return true;
- }
- static bool gpio_config__init__(int argc, py_Ref argv) {
- gpio_config_t* self = py_touserdata(argv);
- if(argc == 1) {
- memset(self, 0, sizeof(gpio_config_t));
- } else if(argc == 1 + 8) {
- if(!py_checkint(py_arg(1))) return false;
- self->direction = (gpio_direction_t)py_toint(py_arg(1));
- if(!py_checkint(py_arg(2))) return false;
- self->edge = (gpio_edge_t)py_toint(py_arg(2));
- if(!py_checkint(py_arg(3))) return false;
- self->event_clock = (gpio_event_clock_t)py_toint(py_arg(3));
- if(!py_checkint(py_arg(4))) return false;
- self->debounce_us = py_toint(py_arg(4));
- if(!py_checkint(py_arg(5))) return false;
- self->bias = (gpio_bias_t)py_toint(py_arg(5));
- if(!py_checkint(py_arg(6))) return false;
- self->drive = (gpio_drive_t)py_toint(py_arg(6));
- if(!py_checkbool(py_arg(7))) return false;
- self->inverted = py_tobool(py_arg(7));
- // _7 label is read-only
- } else {
- return TypeError("expected 1 or 9 arguments");
- }
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_direction(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->direction);
- return true;
- }
- static bool gpio_config__set_direction(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->direction = (gpio_direction_t)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_edge(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->edge);
- return true;
- }
- static bool gpio_config__set_edge(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->edge = (gpio_edge_t)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_event_clock(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->event_clock);
- return true;
- }
- static bool gpio_config__set_event_clock(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->event_clock = (gpio_event_clock_t)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_debounce_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->debounce_us);
- return true;
- }
- static bool gpio_config__set_debounce_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->debounce_us = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_bias(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->bias);
- return true;
- }
- static bool gpio_config__set_bias(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->bias = (gpio_bias_t)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_drive(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->drive);
- return true;
- }
- static bool gpio_config__set_drive(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->drive = (gpio_drive_t)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_inverted(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newbool(py_retval(), self->inverted);
- return true;
- }
- static bool gpio_config__set_inverted(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_config_t* self = py_touserdata(argv);
- if(!py_checkbool(py_arg(1))) return false;
- self->inverted = py_tobool(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool gpio_config__get_label(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_config_t* self = py_touserdata(argv);
- py_newstr(py_retval(), self->label);
- return true;
- }
- static py_Type register__gpio_config(py_GlobalRef mod) {
- py_Type type = py_newtype("gpio_config", tp_stdc_Memory, mod, NULL);
- py_newint(py_emplacedict(py_tpobject(type), py_name("size")), sizeof(gpio_config_t));
- py_bindmethod(type, "__new__", gpio_config__new__);
- py_bindmethod(type, "__init__", gpio_config__init__);
- py_bindproperty(type, "direction", gpio_config__get_direction, gpio_config__set_direction);
- py_bindproperty(type, "edge", gpio_config__get_edge, gpio_config__set_edge);
- py_bindproperty(type, "event_clock", gpio_config__get_event_clock, gpio_config__set_event_clock);
- py_bindproperty(type, "debounce_us", gpio_config__get_debounce_us, gpio_config__set_debounce_us);
- py_bindproperty(type, "bias", gpio_config__get_bias, gpio_config__set_bias);
- py_bindproperty(type, "drive", gpio_config__get_drive, gpio_config__set_drive);
- py_bindproperty(type, "inverted", gpio_config__get_inverted, gpio_config__set_inverted);
- py_bindproperty(type, "label", gpio_config__get_label, NULL);
- return type;
- }
- static py_Type tp_user_gpio_config;
- static bool spi_msg__new__(int argc, py_Ref argv) {
- py_Type cls = py_totype(argv);
- py_newobject(py_retval(), cls, 0, sizeof(spi_msg_t));
- return true;
- }
- static bool spi_msg__init__(int argc, py_Ref argv) {
- spi_msg_t* self = py_touserdata(argv);
- if(argc == 1) {
- memset(self, 0, sizeof(spi_msg_t));
- } else if(argc == 1 + 6) {
- // _0 txbuf is read-only
- if(!py_checkint(py_arg(2))) return false;
- self->rxbuf = (uint8_t*)py_toint(py_arg(2));
- if(!py_checkint(py_arg(3))) return false;
- self->len = py_toint(py_arg(3));
- if(!py_checkbool(py_arg(4))) return false;
- self->deselect = py_tobool(py_arg(4));
- if(!py_checkint(py_arg(5))) return false;
- self->deselect_delay_us = py_toint(py_arg(5));
- if(!py_checkint(py_arg(6))) return false;
- self->word_delay_us = py_toint(py_arg(6));
- } else {
- return TypeError("expected 1 or 7 arguments");
- }
- py_newnone(py_retval());
- return true;
- }
- static bool spi_msg__get_txbuf(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->txbuf);
- return true;
- }
- static bool spi_msg__get_rxbuf(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newint(py_retval(), (py_i64)self->rxbuf);
- return true;
- }
- static bool spi_msg__set_rxbuf(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_msg_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->rxbuf = (uint8_t*)py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool spi_msg__get_len(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->len);
- return true;
- }
- static bool spi_msg__set_len(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_msg_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->len = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool spi_msg__get_deselect(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newbool(py_retval(), self->deselect);
- return true;
- }
- static bool spi_msg__set_deselect(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_msg_t* self = py_touserdata(argv);
- if(!py_checkbool(py_arg(1))) return false;
- self->deselect = py_tobool(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool spi_msg__get_deselect_delay_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->deselect_delay_us);
- return true;
- }
- static bool spi_msg__set_deselect_delay_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_msg_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->deselect_delay_us = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool spi_msg__get_word_delay_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_msg_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->word_delay_us);
- return true;
- }
- static bool spi_msg__set_word_delay_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_msg_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->word_delay_us = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static py_Type register__spi_msg(py_GlobalRef mod) {
- py_Type type = py_newtype("spi_msg", tp_stdc_Memory, mod, NULL);
- py_newint(py_emplacedict(py_tpobject(type), py_name("size")), sizeof(spi_msg_t));
- py_bindmethod(type, "__new__", spi_msg__new__);
- py_bindmethod(type, "__init__", spi_msg__init__);
- py_bindproperty(type, "txbuf", spi_msg__get_txbuf, NULL);
- py_bindproperty(type, "rxbuf", spi_msg__get_rxbuf, spi_msg__set_rxbuf);
- py_bindproperty(type, "len", spi_msg__get_len, spi_msg__set_len);
- py_bindproperty(type, "deselect", spi_msg__get_deselect, spi_msg__set_deselect);
- py_bindproperty(type, "deselect_delay_us", spi_msg__get_deselect_delay_us, spi_msg__set_deselect_delay_us);
- py_bindproperty(type, "word_delay_us", spi_msg__get_word_delay_us, spi_msg__set_word_delay_us);
- return type;
- }
- static py_Type tp_user_spi_msg;
- static bool periphery_version__new__(int argc, py_Ref argv) {
- py_Type cls = py_totype(argv);
- py_newobject(py_retval(), cls, 0, sizeof(periphery_version_t));
- return true;
- }
- static bool periphery_version__init__(int argc, py_Ref argv) {
- periphery_version_t* self = py_touserdata(argv);
- if(argc == 1) {
- memset(self, 0, sizeof(periphery_version_t));
- } else if(argc == 1 + 4) {
- if(!py_checkint(py_arg(1))) return false;
- self->major = py_toint(py_arg(1));
- if(!py_checkint(py_arg(2))) return false;
- self->minor = py_toint(py_arg(2));
- if(!py_checkint(py_arg(3))) return false;
- self->patch = py_toint(py_arg(3));
- // _3 commit_id is read-only
- } else {
- return TypeError("expected 1 or 5 arguments");
- }
- py_newnone(py_retval());
- return true;
- }
- static bool periphery_version__get_major(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- periphery_version_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->major);
- return true;
- }
- static bool periphery_version__set_major(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- periphery_version_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->major = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool periphery_version__get_minor(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- periphery_version_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->minor);
- return true;
- }
- static bool periphery_version__set_minor(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- periphery_version_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->minor = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool periphery_version__get_patch(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- periphery_version_t* self = py_touserdata(argv);
- py_newint(py_retval(), self->patch);
- return true;
- }
- static bool periphery_version__set_patch(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- periphery_version_t* self = py_touserdata(argv);
- if(!py_checkint(py_arg(1))) return false;
- self->patch = py_toint(py_arg(1));
- py_newnone(py_retval());
- return true;
- }
- static bool periphery_version__get_commit_id(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- periphery_version_t* self = py_touserdata(argv);
- py_newstr(py_retval(), self->commit_id);
- return true;
- }
- static py_Type register__periphery_version(py_GlobalRef mod) {
- py_Type type = py_newtype("periphery_version", tp_stdc_Memory, mod, NULL);
- py_newint(py_emplacedict(py_tpobject(type), py_name("size")), sizeof(periphery_version_t));
- py_bindmethod(type, "__new__", periphery_version__new__);
- py_bindmethod(type, "__init__", periphery_version__init__);
- py_bindproperty(type, "major", periphery_version__get_major, periphery_version__set_major);
- py_bindproperty(type, "minor", periphery_version__get_minor, periphery_version__set_minor);
- py_bindproperty(type, "patch", periphery_version__get_patch, periphery_version__set_patch);
- py_bindproperty(type, "commit_id", periphery_version__get_commit_id, NULL);
- return type;
- }
- static py_Type tp_user_periphery_version;
- /* functions */
- static bool cfunc__gpio_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- gpio_t* res = gpio_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__gpio_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- gpio_direction_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = (gpio_direction_t)py_toint(py_arg(3));
- int res = gpio_open(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_open_name(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- const char* _2;
- if(!py_checkstr(py_arg(2))) return false;
- _2 = py_tostr(py_arg(2));
- gpio_direction_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = (gpio_direction_t)py_toint(py_arg(3));
- int res = gpio_open_name(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_open_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- const gpio_config_t* _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = (const gpio_config_t*)py_toint(py_arg(3));
- int res = gpio_open_advanced(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_open_name_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- const char* _2;
- if(!py_checkstr(py_arg(2))) return false;
- _2 = py_tostr(py_arg(2));
- const gpio_config_t* _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = (const gpio_config_t*)py_toint(py_arg(3));
- int res = gpio_open_name_advanced(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_open_sysfs(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- gpio_direction_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (gpio_direction_t)py_toint(py_arg(2));
- int res = gpio_open_sysfs(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_read(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = gpio_read(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_write(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = gpio_write(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_poll(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- int _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = gpio_poll(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- int res = gpio_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__gpio_read_event(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_edge_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_edge_t*)py_toint(py_arg(1));
- uint64_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint64_t*)py_toint(py_arg(2));
- int res = gpio_read_event(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_poll_multiple(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- gpio_t** _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t**)py_toint(py_arg(0));
- size_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- bool* _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = (bool*)py_toint(py_arg(3));
- int res = gpio_poll_multiple(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_direction(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_direction_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_direction_t*)py_toint(py_arg(1));
- int res = gpio_get_direction(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_edge(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_edge_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_edge_t*)py_toint(py_arg(1));
- int res = gpio_get_edge(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_event_clock(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_event_clock_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_event_clock_t*)py_toint(py_arg(1));
- int res = gpio_get_event_clock(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_debounce_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- uint32_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint32_t*)py_toint(py_arg(1));
- int res = gpio_get_debounce_us(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_bias(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_bias_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_bias_t*)py_toint(py_arg(1));
- int res = gpio_get_bias(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_drive(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_drive_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_drive_t*)py_toint(py_arg(1));
- int res = gpio_get_drive(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_get_inverted(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = gpio_get_inverted(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_direction(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_direction_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_direction_t)py_toint(py_arg(1));
- int res = gpio_set_direction(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_edge(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_edge_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_edge_t)py_toint(py_arg(1));
- int res = gpio_set_edge(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_event_clock(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_event_clock_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_event_clock_t)py_toint(py_arg(1));
- int res = gpio_set_event_clock(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_debounce_us(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- uint32_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = gpio_set_debounce_us(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_bias(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_bias_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_bias_t)py_toint(py_arg(1));
- int res = gpio_set_bias(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_drive(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- gpio_drive_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (gpio_drive_t)py_toint(py_arg(1));
- int res = gpio_set_drive(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_set_inverted(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = gpio_set_inverted(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_line(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- unsigned res = gpio_line(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_fd(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- int res = gpio_fd(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_name(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = gpio_name(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_label(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = gpio_label(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_chip_fd(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- int res = gpio_chip_fd(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_chip_name(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = gpio_chip_name(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_chip_label(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = gpio_chip_label(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = gpio_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- int res = gpio_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__gpio_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- gpio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (gpio_t*)py_toint(py_arg(0));
- const char* res = gpio_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__led_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- led_t* res = led_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__led_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- int res = led_open(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_read(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = led_read(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_write(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = led_write(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- int res = led_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- led_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__led_get_brightness(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = led_get_brightness(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_get_max_brightness(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = led_get_max_brightness(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_get_trigger(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = led_get_trigger(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_get_triggers_entry(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- char* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (char*)py_toint(py_arg(2));
- size_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = led_get_triggers_entry(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_get_triggers_count(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = led_get_triggers_count(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_set_brightness(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = led_set_brightness(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_set_trigger(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- int res = led_set_trigger(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_name(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = led_name(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = led_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- int res = led_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__led_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- led_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (led_t*)py_toint(py_arg(0));
- const char* res = led_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- mmio_t* res = mmio_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__mmio_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_open(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_open_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- const char* _3;
- if(!py_checkstr(py_arg(3))) return false;
- _3 = py_tostr(py_arg(3));
- int res = mmio_open_advanced(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_ptr(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- void* res = mmio_ptr(_0);
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__mmio_read64(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint64_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint64_t*)py_toint(py_arg(2));
- int res = mmio_read64(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_read32(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint32_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint32_t*)py_toint(py_arg(2));
- int res = mmio_read32(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_read16(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint16_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint16_t*)py_toint(py_arg(2));
- int res = mmio_read16(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_read8(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint8_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint8_t*)py_toint(py_arg(2));
- int res = mmio_read8(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_read(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint8_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint8_t*)py_toint(py_arg(2));
- size_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = mmio_read(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_write64(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint64_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_write64(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_write32(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint32_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_write32(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_write16(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint16_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_write16(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_write8(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- uint8_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_write8(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_write(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- const uint8_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (const uint8_t*)py_toint(py_arg(2));
- size_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = mmio_write(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- int res = mmio_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- mmio_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__mmio_base(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- uintptr_t res = mmio_base(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_size(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- size_t res = mmio_size(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = mmio_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- int res = mmio_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__mmio_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- mmio_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (mmio_t*)py_toint(py_arg(0));
- const char* res = mmio_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- pwm_t* res = pwm_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__pwm_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = pwm_open(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_enable(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- int res = pwm_enable(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_disable(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- int res = pwm_disable(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- int res = pwm_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- pwm_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__pwm_get_enabled(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = pwm_get_enabled(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_period_ns(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- uint64_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint64_t*)py_toint(py_arg(1));
- int res = pwm_get_period_ns(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_duty_cycle_ns(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- uint64_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint64_t*)py_toint(py_arg(1));
- int res = pwm_get_duty_cycle_ns(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_period(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (double*)py_toint(py_arg(1));
- int res = pwm_get_period(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_duty_cycle(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (double*)py_toint(py_arg(1));
- int res = pwm_get_duty_cycle(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_frequency(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (double*)py_toint(py_arg(1));
- int res = pwm_get_frequency(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_get_polarity(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- pwm_polarity_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (pwm_polarity_t*)py_toint(py_arg(1));
- int res = pwm_get_polarity(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_enabled(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = pwm_set_enabled(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_period_ns(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- uint64_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = pwm_set_period_ns(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_duty_cycle_ns(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- uint64_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = pwm_set_duty_cycle_ns(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_period(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double _1;
- if(!py_castfloat(py_arg(1), &_1)) return false;
- int res = pwm_set_period(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_duty_cycle(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double _1;
- if(!py_castfloat(py_arg(1), &_1)) return false;
- int res = pwm_set_duty_cycle(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_frequency(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- double _1;
- if(!py_castfloat(py_arg(1), &_1)) return false;
- int res = pwm_set_frequency(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_set_polarity(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- pwm_polarity_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (pwm_polarity_t)py_toint(py_arg(1));
- int res = pwm_set_polarity(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_chip(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- unsigned res = pwm_chip(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_channel(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- unsigned res = pwm_channel(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = pwm_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- int res = pwm_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__pwm_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- pwm_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (pwm_t*)py_toint(py_arg(0));
- const char* res = pwm_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- serial_t* res = serial_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__serial_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- uint32_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = serial_open(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_open_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(8);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- uint32_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- unsigned _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- serial_parity_t _4;
- if(!py_checkint(py_arg(4))) return false;
- _4 = (serial_parity_t)py_toint(py_arg(4));
- unsigned _5;
- if(!py_checkint(py_arg(5))) return false;
- _5 = py_toint(py_arg(5));
- bool _6;
- if(!py_checkbool(py_arg(6))) return false;
- _6 = py_tobool(py_arg(6));
- bool _7;
- if(!py_checkbool(py_arg(7))) return false;
- _7 = py_tobool(py_arg(7));
- int res = serial_open_advanced(_0, _1, _2, _3, _4, _5, _6, _7);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_read(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- uint8_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint8_t*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = serial_read(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_write(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- const uint8_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (const uint8_t*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = serial_write(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_flush(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- int res = serial_flush(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_input_waiting(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = serial_input_waiting(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_output_waiting(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = serial_output_waiting(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_poll(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- int _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = serial_poll(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- int res = serial_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- serial_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__serial_get_baudrate(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- uint32_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint32_t*)py_toint(py_arg(1));
- int res = serial_get_baudrate(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_databits(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = serial_get_databits(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_parity(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- serial_parity_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (serial_parity_t*)py_toint(py_arg(1));
- int res = serial_get_parity(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_stopbits(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = serial_get_stopbits(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_xonxoff(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = serial_get_xonxoff(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_rtscts(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- bool* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (bool*)py_toint(py_arg(1));
- int res = serial_get_rtscts(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_vmin(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = serial_get_vmin(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_get_vtime(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- float* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (float*)py_toint(py_arg(1));
- int res = serial_get_vtime(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_baudrate(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- uint32_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = serial_set_baudrate(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_databits(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = serial_set_databits(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_parity(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- serial_parity_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (serial_parity_t)py_toint(py_arg(1));
- int res = serial_set_parity(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_stopbits(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = serial_set_stopbits(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_xonxoff(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = serial_set_xonxoff(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_rtscts(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- bool _1;
- if(!py_checkbool(py_arg(1))) return false;
- _1 = py_tobool(py_arg(1));
- int res = serial_set_rtscts(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_vmin(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = serial_set_vmin(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_set_vtime(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- float _1;
- if(!py_castfloat32(py_arg(1), &_1)) return false;
- int res = serial_set_vtime(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_fd(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- int res = serial_fd(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = serial_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- int res = serial_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__serial_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- serial_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (serial_t*)py_toint(py_arg(0));
- const char* res = serial_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_new(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- spi_t* res = spi_new();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- static bool cfunc__spi_open(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- uint32_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = spi_open(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_open_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(7);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- uint32_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- spi_bit_order_t _4;
- if(!py_checkint(py_arg(4))) return false;
- _4 = (spi_bit_order_t)py_toint(py_arg(4));
- uint8_t _5;
- if(!py_checkint(py_arg(5))) return false;
- _5 = py_toint(py_arg(5));
- uint8_t _6;
- if(!py_checkint(py_arg(6))) return false;
- _6 = py_toint(py_arg(6));
- int res = spi_open_advanced(_0, _1, _2, _3, _4, _5, _6);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_open_advanced2(int argc, py_Ref argv) {
- PY_CHECK_ARGC(7);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const char* _1;
- if(!py_checkstr(py_arg(1))) return false;
- _1 = py_tostr(py_arg(1));
- unsigned _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- uint32_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- spi_bit_order_t _4;
- if(!py_checkint(py_arg(4))) return false;
- _4 = (spi_bit_order_t)py_toint(py_arg(4));
- uint8_t _5;
- if(!py_checkint(py_arg(5))) return false;
- _5 = py_toint(py_arg(5));
- uint32_t _6;
- if(!py_checkint(py_arg(6))) return false;
- _6 = py_toint(py_arg(6));
- int res = spi_open_advanced2(_0, _1, _2, _3, _4, _5, _6);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_transfer(int argc, py_Ref argv) {
- PY_CHECK_ARGC(4);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const uint8_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (const uint8_t*)py_toint(py_arg(1));
- uint8_t* _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = (uint8_t*)py_toint(py_arg(2));
- size_t _3;
- if(!py_checkint(py_arg(3))) return false;
- _3 = py_toint(py_arg(3));
- int res = spi_transfer(_0, _1, _2, _3);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_transfer_advanced(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const spi_msg_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (const spi_msg_t*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = spi_transfer_advanced(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_close(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- int res = spi_close(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_free(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- spi_free(_0);
- py_newnone(py_retval());
- return true;
- }
- static bool cfunc__spi_get_mode(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- unsigned* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (unsigned*)py_toint(py_arg(1));
- int res = spi_get_mode(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_get_max_speed(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint32_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint32_t*)py_toint(py_arg(1));
- int res = spi_get_max_speed(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_get_bit_order(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- spi_bit_order_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (spi_bit_order_t*)py_toint(py_arg(1));
- int res = spi_get_bit_order(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_get_bits_per_word(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint8_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint8_t*)py_toint(py_arg(1));
- int res = spi_get_bits_per_word(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_get_extra_flags(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint8_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint8_t*)py_toint(py_arg(1));
- int res = spi_get_extra_flags(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_get_extra_flags32(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint32_t* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (uint32_t*)py_toint(py_arg(1));
- int res = spi_get_extra_flags32(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_mode(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- unsigned _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = spi_set_mode(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_max_speed(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint32_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = spi_set_max_speed(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_bit_order(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- spi_bit_order_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (spi_bit_order_t)py_toint(py_arg(1));
- int res = spi_set_bit_order(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_bits_per_word(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint8_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = spi_set_bits_per_word(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_extra_flags(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint8_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = spi_set_extra_flags(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_set_extra_flags32(int argc, py_Ref argv) {
- PY_CHECK_ARGC(2);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- uint32_t _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = py_toint(py_arg(1));
- int res = spi_set_extra_flags32(_0, _1);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_fd(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- int res = spi_fd(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_tostring(int argc, py_Ref argv) {
- PY_CHECK_ARGC(3);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- char* _1;
- if(!py_checkint(py_arg(1))) return false;
- _1 = (char*)py_toint(py_arg(1));
- size_t _2;
- if(!py_checkint(py_arg(2))) return false;
- _2 = py_toint(py_arg(2));
- int res = spi_tostring(_0, _1, _2);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_errno(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- int res = spi_errno(_0);
- py_newint(py_retval(), res);
- return true;
- }
- static bool cfunc__spi_errmsg(int argc, py_Ref argv) {
- PY_CHECK_ARGC(1);
- spi_t* _0;
- if(!py_checkint(py_arg(0))) return false;
- _0 = (spi_t*)py_toint(py_arg(0));
- const char* res = spi_errmsg(_0);
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__periphery_version(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- const char* res = periphery_version();
- py_newstr(py_retval(), res);
- return true;
- }
- static bool cfunc__periphery_version_info(int argc, py_Ref argv) {
- PY_CHECK_ARGC(0);
- const periphery_version_t* res = periphery_version_info();
- py_newint(py_retval(), (py_i64)res);
- return true;
- }
- void py__add_module_periphery() {
- py_GlobalRef mod = py_newmodule("periphery");
- /* structs */
- tp_user_gpio_config = register__gpio_config(mod);
- tp_user_spi_msg = register__spi_msg(mod);
- tp_user_periphery_version = register__periphery_version(mod);
- /* aliases */
- py_setdict(mod, py_name("gpio_direction_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("gpio_edge_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("gpio_event_clock_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("gpio_bias_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("gpio_drive_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("pwm_polarity_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("serial_parity_t"), py_tpobject(tp_int));
- py_setdict(mod, py_name("spi_bit_order_t"), py_tpobject(tp_int));
- /* functions */
- py_bindfunc(mod, "gpio_new", &cfunc__gpio_new);
- py_bindfunc(mod, "gpio_open", &cfunc__gpio_open);
- py_bindfunc(mod, "gpio_open_name", &cfunc__gpio_open_name);
- py_bindfunc(mod, "gpio_open_advanced", &cfunc__gpio_open_advanced);
- py_bindfunc(mod, "gpio_open_name_advanced", &cfunc__gpio_open_name_advanced);
- py_bindfunc(mod, "gpio_open_sysfs", &cfunc__gpio_open_sysfs);
- py_bindfunc(mod, "gpio_read", &cfunc__gpio_read);
- py_bindfunc(mod, "gpio_write", &cfunc__gpio_write);
- py_bindfunc(mod, "gpio_poll", &cfunc__gpio_poll);
- py_bindfunc(mod, "gpio_close", &cfunc__gpio_close);
- py_bindfunc(mod, "gpio_free", &cfunc__gpio_free);
- py_bindfunc(mod, "gpio_read_event", &cfunc__gpio_read_event);
- py_bindfunc(mod, "gpio_poll_multiple", &cfunc__gpio_poll_multiple);
- py_bindfunc(mod, "gpio_get_direction", &cfunc__gpio_get_direction);
- py_bindfunc(mod, "gpio_get_edge", &cfunc__gpio_get_edge);
- py_bindfunc(mod, "gpio_get_event_clock", &cfunc__gpio_get_event_clock);
- py_bindfunc(mod, "gpio_get_debounce_us", &cfunc__gpio_get_debounce_us);
- py_bindfunc(mod, "gpio_get_bias", &cfunc__gpio_get_bias);
- py_bindfunc(mod, "gpio_get_drive", &cfunc__gpio_get_drive);
- py_bindfunc(mod, "gpio_get_inverted", &cfunc__gpio_get_inverted);
- py_bindfunc(mod, "gpio_set_direction", &cfunc__gpio_set_direction);
- py_bindfunc(mod, "gpio_set_edge", &cfunc__gpio_set_edge);
- py_bindfunc(mod, "gpio_set_event_clock", &cfunc__gpio_set_event_clock);
- py_bindfunc(mod, "gpio_set_debounce_us", &cfunc__gpio_set_debounce_us);
- py_bindfunc(mod, "gpio_set_bias", &cfunc__gpio_set_bias);
- py_bindfunc(mod, "gpio_set_drive", &cfunc__gpio_set_drive);
- py_bindfunc(mod, "gpio_set_inverted", &cfunc__gpio_set_inverted);
- py_bindfunc(mod, "gpio_line", &cfunc__gpio_line);
- py_bindfunc(mod, "gpio_fd", &cfunc__gpio_fd);
- py_bindfunc(mod, "gpio_name", &cfunc__gpio_name);
- py_bindfunc(mod, "gpio_label", &cfunc__gpio_label);
- py_bindfunc(mod, "gpio_chip_fd", &cfunc__gpio_chip_fd);
- py_bindfunc(mod, "gpio_chip_name", &cfunc__gpio_chip_name);
- py_bindfunc(mod, "gpio_chip_label", &cfunc__gpio_chip_label);
- py_bindfunc(mod, "gpio_tostring", &cfunc__gpio_tostring);
- py_bindfunc(mod, "gpio_errno", &cfunc__gpio_errno);
- py_bindfunc(mod, "gpio_errmsg", &cfunc__gpio_errmsg);
- py_bindfunc(mod, "led_new", &cfunc__led_new);
- py_bindfunc(mod, "led_open", &cfunc__led_open);
- py_bindfunc(mod, "led_read", &cfunc__led_read);
- py_bindfunc(mod, "led_write", &cfunc__led_write);
- py_bindfunc(mod, "led_close", &cfunc__led_close);
- py_bindfunc(mod, "led_free", &cfunc__led_free);
- py_bindfunc(mod, "led_get_brightness", &cfunc__led_get_brightness);
- py_bindfunc(mod, "led_get_max_brightness", &cfunc__led_get_max_brightness);
- py_bindfunc(mod, "led_get_trigger", &cfunc__led_get_trigger);
- py_bindfunc(mod, "led_get_triggers_entry", &cfunc__led_get_triggers_entry);
- py_bindfunc(mod, "led_get_triggers_count", &cfunc__led_get_triggers_count);
- py_bindfunc(mod, "led_set_brightness", &cfunc__led_set_brightness);
- py_bindfunc(mod, "led_set_trigger", &cfunc__led_set_trigger);
- py_bindfunc(mod, "led_name", &cfunc__led_name);
- py_bindfunc(mod, "led_tostring", &cfunc__led_tostring);
- py_bindfunc(mod, "led_errno", &cfunc__led_errno);
- py_bindfunc(mod, "led_errmsg", &cfunc__led_errmsg);
- py_bindfunc(mod, "mmio_new", &cfunc__mmio_new);
- py_bindfunc(mod, "mmio_open", &cfunc__mmio_open);
- py_bindfunc(mod, "mmio_open_advanced", &cfunc__mmio_open_advanced);
- py_bindfunc(mod, "mmio_ptr", &cfunc__mmio_ptr);
- py_bindfunc(mod, "mmio_read64", &cfunc__mmio_read64);
- py_bindfunc(mod, "mmio_read32", &cfunc__mmio_read32);
- py_bindfunc(mod, "mmio_read16", &cfunc__mmio_read16);
- py_bindfunc(mod, "mmio_read8", &cfunc__mmio_read8);
- py_bindfunc(mod, "mmio_read", &cfunc__mmio_read);
- py_bindfunc(mod, "mmio_write64", &cfunc__mmio_write64);
- py_bindfunc(mod, "mmio_write32", &cfunc__mmio_write32);
- py_bindfunc(mod, "mmio_write16", &cfunc__mmio_write16);
- py_bindfunc(mod, "mmio_write8", &cfunc__mmio_write8);
- py_bindfunc(mod, "mmio_write", &cfunc__mmio_write);
- py_bindfunc(mod, "mmio_close", &cfunc__mmio_close);
- py_bindfunc(mod, "mmio_free", &cfunc__mmio_free);
- py_bindfunc(mod, "mmio_base", &cfunc__mmio_base);
- py_bindfunc(mod, "mmio_size", &cfunc__mmio_size);
- py_bindfunc(mod, "mmio_tostring", &cfunc__mmio_tostring);
- py_bindfunc(mod, "mmio_errno", &cfunc__mmio_errno);
- py_bindfunc(mod, "mmio_errmsg", &cfunc__mmio_errmsg);
- py_bindfunc(mod, "pwm_new", &cfunc__pwm_new);
- py_bindfunc(mod, "pwm_open", &cfunc__pwm_open);
- py_bindfunc(mod, "pwm_enable", &cfunc__pwm_enable);
- py_bindfunc(mod, "pwm_disable", &cfunc__pwm_disable);
- py_bindfunc(mod, "pwm_close", &cfunc__pwm_close);
- py_bindfunc(mod, "pwm_free", &cfunc__pwm_free);
- py_bindfunc(mod, "pwm_get_enabled", &cfunc__pwm_get_enabled);
- py_bindfunc(mod, "pwm_get_period_ns", &cfunc__pwm_get_period_ns);
- py_bindfunc(mod, "pwm_get_duty_cycle_ns", &cfunc__pwm_get_duty_cycle_ns);
- py_bindfunc(mod, "pwm_get_period", &cfunc__pwm_get_period);
- py_bindfunc(mod, "pwm_get_duty_cycle", &cfunc__pwm_get_duty_cycle);
- py_bindfunc(mod, "pwm_get_frequency", &cfunc__pwm_get_frequency);
- py_bindfunc(mod, "pwm_get_polarity", &cfunc__pwm_get_polarity);
- py_bindfunc(mod, "pwm_set_enabled", &cfunc__pwm_set_enabled);
- py_bindfunc(mod, "pwm_set_period_ns", &cfunc__pwm_set_period_ns);
- py_bindfunc(mod, "pwm_set_duty_cycle_ns", &cfunc__pwm_set_duty_cycle_ns);
- py_bindfunc(mod, "pwm_set_period", &cfunc__pwm_set_period);
- py_bindfunc(mod, "pwm_set_duty_cycle", &cfunc__pwm_set_duty_cycle);
- py_bindfunc(mod, "pwm_set_frequency", &cfunc__pwm_set_frequency);
- py_bindfunc(mod, "pwm_set_polarity", &cfunc__pwm_set_polarity);
- py_bindfunc(mod, "pwm_chip", &cfunc__pwm_chip);
- py_bindfunc(mod, "pwm_channel", &cfunc__pwm_channel);
- py_bindfunc(mod, "pwm_tostring", &cfunc__pwm_tostring);
- py_bindfunc(mod, "pwm_errno", &cfunc__pwm_errno);
- py_bindfunc(mod, "pwm_errmsg", &cfunc__pwm_errmsg);
- py_bindfunc(mod, "serial_new", &cfunc__serial_new);
- py_bindfunc(mod, "serial_open", &cfunc__serial_open);
- py_bindfunc(mod, "serial_open_advanced", &cfunc__serial_open_advanced);
- py_bindfunc(mod, "serial_read", &cfunc__serial_read);
- py_bindfunc(mod, "serial_write", &cfunc__serial_write);
- py_bindfunc(mod, "serial_flush", &cfunc__serial_flush);
- py_bindfunc(mod, "serial_input_waiting", &cfunc__serial_input_waiting);
- py_bindfunc(mod, "serial_output_waiting", &cfunc__serial_output_waiting);
- py_bindfunc(mod, "serial_poll", &cfunc__serial_poll);
- py_bindfunc(mod, "serial_close", &cfunc__serial_close);
- py_bindfunc(mod, "serial_free", &cfunc__serial_free);
- py_bindfunc(mod, "serial_get_baudrate", &cfunc__serial_get_baudrate);
- py_bindfunc(mod, "serial_get_databits", &cfunc__serial_get_databits);
- py_bindfunc(mod, "serial_get_parity", &cfunc__serial_get_parity);
- py_bindfunc(mod, "serial_get_stopbits", &cfunc__serial_get_stopbits);
- py_bindfunc(mod, "serial_get_xonxoff", &cfunc__serial_get_xonxoff);
- py_bindfunc(mod, "serial_get_rtscts", &cfunc__serial_get_rtscts);
- py_bindfunc(mod, "serial_get_vmin", &cfunc__serial_get_vmin);
- py_bindfunc(mod, "serial_get_vtime", &cfunc__serial_get_vtime);
- py_bindfunc(mod, "serial_set_baudrate", &cfunc__serial_set_baudrate);
- py_bindfunc(mod, "serial_set_databits", &cfunc__serial_set_databits);
- py_bindfunc(mod, "serial_set_parity", &cfunc__serial_set_parity);
- py_bindfunc(mod, "serial_set_stopbits", &cfunc__serial_set_stopbits);
- py_bindfunc(mod, "serial_set_xonxoff", &cfunc__serial_set_xonxoff);
- py_bindfunc(mod, "serial_set_rtscts", &cfunc__serial_set_rtscts);
- py_bindfunc(mod, "serial_set_vmin", &cfunc__serial_set_vmin);
- py_bindfunc(mod, "serial_set_vtime", &cfunc__serial_set_vtime);
- py_bindfunc(mod, "serial_fd", &cfunc__serial_fd);
- py_bindfunc(mod, "serial_tostring", &cfunc__serial_tostring);
- py_bindfunc(mod, "serial_errno", &cfunc__serial_errno);
- py_bindfunc(mod, "serial_errmsg", &cfunc__serial_errmsg);
- py_bindfunc(mod, "spi_new", &cfunc__spi_new);
- py_bindfunc(mod, "spi_open", &cfunc__spi_open);
- py_bindfunc(mod, "spi_open_advanced", &cfunc__spi_open_advanced);
- py_bindfunc(mod, "spi_open_advanced2", &cfunc__spi_open_advanced2);
- py_bindfunc(mod, "spi_transfer", &cfunc__spi_transfer);
- py_bindfunc(mod, "spi_transfer_advanced", &cfunc__spi_transfer_advanced);
- py_bindfunc(mod, "spi_close", &cfunc__spi_close);
- py_bindfunc(mod, "spi_free", &cfunc__spi_free);
- py_bindfunc(mod, "spi_get_mode", &cfunc__spi_get_mode);
- py_bindfunc(mod, "spi_get_max_speed", &cfunc__spi_get_max_speed);
- py_bindfunc(mod, "spi_get_bit_order", &cfunc__spi_get_bit_order);
- py_bindfunc(mod, "spi_get_bits_per_word", &cfunc__spi_get_bits_per_word);
- py_bindfunc(mod, "spi_get_extra_flags", &cfunc__spi_get_extra_flags);
- py_bindfunc(mod, "spi_get_extra_flags32", &cfunc__spi_get_extra_flags32);
- py_bindfunc(mod, "spi_set_mode", &cfunc__spi_set_mode);
- py_bindfunc(mod, "spi_set_max_speed", &cfunc__spi_set_max_speed);
- py_bindfunc(mod, "spi_set_bit_order", &cfunc__spi_set_bit_order);
- py_bindfunc(mod, "spi_set_bits_per_word", &cfunc__spi_set_bits_per_word);
- py_bindfunc(mod, "spi_set_extra_flags", &cfunc__spi_set_extra_flags);
- py_bindfunc(mod, "spi_set_extra_flags32", &cfunc__spi_set_extra_flags32);
- py_bindfunc(mod, "spi_fd", &cfunc__spi_fd);
- py_bindfunc(mod, "spi_tostring", &cfunc__spi_tostring);
- py_bindfunc(mod, "spi_errno", &cfunc__spi_errno);
- py_bindfunc(mod, "spi_errmsg", &cfunc__spi_errmsg);
- py_bindfunc(mod, "periphery_version", &cfunc__periphery_version);
- py_bindfunc(mod, "periphery_version_info", &cfunc__periphery_version_info);
- /* enums */
- ADD_ENUM(GPIO_ERROR_ARG);
- ADD_ENUM(GPIO_ERROR_OPEN);
- ADD_ENUM(GPIO_ERROR_NOT_FOUND);
- ADD_ENUM(GPIO_ERROR_QUERY);
- ADD_ENUM(GPIO_ERROR_CONFIGURE);
- ADD_ENUM(GPIO_ERROR_UNSUPPORTED);
- ADD_ENUM(GPIO_ERROR_INVALID_OPERATION);
- ADD_ENUM(GPIO_ERROR_IO);
- ADD_ENUM(GPIO_ERROR_CLOSE);
- ADD_ENUM(GPIO_DIR_IN);
- ADD_ENUM(GPIO_DIR_OUT);
- ADD_ENUM(GPIO_DIR_OUT_LOW);
- ADD_ENUM(GPIO_DIR_OUT_HIGH);
- ADD_ENUM(GPIO_EDGE_NONE);
- ADD_ENUM(GPIO_EDGE_RISING);
- ADD_ENUM(GPIO_EDGE_FALLING);
- ADD_ENUM(GPIO_EDGE_BOTH);
- ADD_ENUM(GPIO_EVENT_CLOCK_REALTIME);
- ADD_ENUM(GPIO_EVENT_CLOCK_MONOTONIC);
- ADD_ENUM(GPIO_EVENT_CLOCK_HTE);
- ADD_ENUM(GPIO_BIAS_DEFAULT);
- ADD_ENUM(GPIO_BIAS_PULL_UP);
- ADD_ENUM(GPIO_BIAS_PULL_DOWN);
- ADD_ENUM(GPIO_BIAS_DISABLE);
- ADD_ENUM(GPIO_DRIVE_DEFAULT);
- ADD_ENUM(GPIO_DRIVE_OPEN_DRAIN);
- ADD_ENUM(GPIO_DRIVE_OPEN_SOURCE);
- ADD_ENUM(LED_ERROR_ARG);
- ADD_ENUM(LED_ERROR_OPEN);
- ADD_ENUM(LED_ERROR_QUERY);
- ADD_ENUM(LED_ERROR_IO);
- ADD_ENUM(LED_ERROR_CLOSE);
- ADD_ENUM(MMIO_ERROR_ARG);
- ADD_ENUM(MMIO_ERROR_OPEN);
- ADD_ENUM(MMIO_ERROR_CLOSE);
- ADD_ENUM(PWM_ERROR_ARG);
- ADD_ENUM(PWM_ERROR_OPEN);
- ADD_ENUM(PWM_ERROR_QUERY);
- ADD_ENUM(PWM_ERROR_CONFIGURE);
- ADD_ENUM(PWM_ERROR_CLOSE);
- ADD_ENUM(PWM_POLARITY_NORMAL);
- ADD_ENUM(PWM_POLARITY_INVERSED);
- ADD_ENUM(SERIAL_ERROR_ARG);
- ADD_ENUM(SERIAL_ERROR_OPEN);
- ADD_ENUM(SERIAL_ERROR_QUERY);
- ADD_ENUM(SERIAL_ERROR_CONFIGURE);
- ADD_ENUM(SERIAL_ERROR_IO);
- ADD_ENUM(SERIAL_ERROR_CLOSE);
- ADD_ENUM(PARITY_NONE);
- ADD_ENUM(PARITY_ODD);
- ADD_ENUM(PARITY_EVEN);
- ADD_ENUM(SPI_ERROR_ARG);
- ADD_ENUM(SPI_ERROR_OPEN);
- ADD_ENUM(SPI_ERROR_QUERY);
- ADD_ENUM(SPI_ERROR_CONFIGURE);
- ADD_ENUM(SPI_ERROR_TRANSFER);
- ADD_ENUM(SPI_ERROR_CLOSE);
- ADD_ENUM(SPI_ERROR_UNSUPPORTED);
- ADD_ENUM(MSB_FIRST);
- ADD_ENUM(LSB_FIRST);
- }
|