22 #include "libpruio/pruio.h"
23 #include "libpruio/pruio_pins.h"
24 #include "../c_include/pruw1.h"
28 int main(
int argc,
char **argv)
35 pruIo *
io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0);
38 printf(
"libpruio CTOR failed (%s)\n",
io->Errr);
break;}
46 printf(
"libpruw1 CTOR failed (%s)\n",
w1->Errr);
break;}
48 printf(
"\ntrying to scan devices ...");
49 if (pruw1_scanBus(
w1)) {
50 printf(
"scanBus failed (%s)\n",
w1->Errr);
break;}
58 for (n = 0; n <= 10; n++) {
70 if (typ != 0x10)
continue;
88 printf(
"\nsensor %llX --> %s %3.4f °C",
id, txt, val);
VAR res
pointer to measurement data
VAR io
Pointer to libpruio instance.
VAR crc
The checksum (0 = OK).
VAR w1
Create new libpruw1 instance.
int main(int argc, char **argv)
The main function.
@ PRUW1_PULLUP
Activate internal pull up resistor (default)
Int16 T_FAM10(UInt8 *Rom)
Compute the temperature for a series 10 sensor (old format).
unsigned char UInt8
8 bit unsigned integer data type.
FUNCTION_CDECL_ALIAS_AS_UInt8 pruw1_recvBlock(BYVAL_AS_PruW1_PTR W1, BYVAL_AS_UInt8 N)
Wrapper function for PruW1::recvBlock().
SUB_CDECL_ALIAS pruw1_sendRom(BYVAL_AS_PruW1_PTR W1, BYVAL_AS_UInt64 V)
Wrapper function for PruW1::sendRom().
FUNCTION_CDECL_ALIAS_AS_UInt64 pruw1_getId(BYVAL_AS_PruW1_PTR W1, BYVAL_AS_UInt32 N)
Function to get ID from the array PruW1::Slots from C.
SUB_CDECL_ALIAS pruw1_destroy(BYVAL_AS_PruW1_PTR W1)
Wrapper function for destructor PruW1::~PruW1.
FUNCTION_CDECL_ALIAS_AS_UInt8 pruw1_resetBus(BYVAL_AS_PruW1_PTR W1)
Wrapper function for PruW1::resetBus().
FUNCTION_CDECL_ALIAS_AS_UInt8 pruw1_calcCrc(BYVAL_AS_PruW1_PTR W1, BYVAL_AS_UInt8 N)
Wrapper function for PruW1::calcCrc().
SUB_CDECL_ALIAS pruw1_sendByte(BYVAL_AS_PruW1_PTR W1, BYVAL_AS_UInt8 V)
Wrapper function for PruW1::sendByte().
FUNCTION_CDECL_ALIAS_AS_Int32 pruw1_getSlotMax(BYVAL_AS_PruW1_PTR W1)
Property to get size of array PruW1::Slots from C.
FUNCTION_CDECL_ALIAS_AS_PruW1_PTR pruw1_new(BYVAL_AS_PruIo_PTR P, BYVAL_AS_Uint8 B, BYVAL_AS_Uint8 M)
Wrapper function for constructor PruW1::PruW1().
The PruW1 C wrapper structure.