libpruw1  0.4
One wire (W1) driver for Beaglebone hardware based on libpruio
pruw1.bas File Reference

The function bodies for the PruW1 class, tools for decoding. More...

#include "w1_prucode.bi"
#include "pruw1.hp"
#include "BBB/pruio_prussdrv.bi"
#include "BBB/pruio_intc.bi"
#include "pruw1.bi"
Include dependency graph for pruw1.bas:

Go to the source code of this file.

Macros

#define PRUCALL(_C_, _V_, _T_)
 Macro to call a function on the PRU, monitoring features disabled. More...
 
#define PRUCALL(_C_, _V_, _T_)
 Macro to call a function on the PRU, monitoring features disabled. More...
 

Functions

FUNCTION_AS_SHORT T_fam10 (BYVAL_AS_UBYTE_PTR Rom)
 Compute the temperature for a series 10 sensor (old format). More...
 
FUNCTION_AS_SHORT T_fam20 (BYVAL_AS_UBYTE_PTR Rom)
 Compute the temperature for a series 20 sensor (new format). More...
 

Detailed Description

The function bodies for the PruW1 class, tools for decoding.

This file contains the function bodies for the PruW1 class and some functions to decode the temperature from the received data.

Since
0.0

Definition in file pruw1.bas.

Macro Definition Documentation

◆ PRUCALL [1/2]

#define PRUCALL (   _C_,
  _V_,
  _T_ 
)
Value:
/* (multi line FreeBASIC #MACRO)
WHILE DRam[0] : SLEEP 1 : WEND
_V_
DRam[0] = _C_ + PruLMod
WHILE DRam[0] : SLEEP 1 : WEND
#ENDMACRO */

Macro to call a function on the PRU, monitoring features disabled.

Macro to call a function on the PRU, monitoring features enabled.

Definition at line 21 of file pruw1.bas.

◆ PRUCALL [2/2]

#define PRUCALL (   _C_,
  _V_,
  _T_ 
)
Value:
/* (multi line FreeBASIC #MACRO)
WHILE DRam[0] : SLEEP 1 : ?"."; : WEND
_V_
DRam[0] = _C_ + PruLMod
?!"\n";_T_; " command=&h"; HEX(DRam[0], 4); " ";
WHILE DRam[0] : SLEEP 1 : ?"."; : WEND
prot()
#ENDMACRO */

Macro to call a function on the PRU, monitoring features disabled.

Macro to call a function on the PRU, monitoring features enabled.

Definition at line 21 of file pruw1.bas.

Function Documentation

◆ T_fam10()

FUNCTION_AS_SHORT T_fam10 ( BYVAL_AS_UBYTE_PTR  Rom)

Compute the temperature for a series 10 sensor (old format).

Parameters
RomThe pointer where to find the data received from the device.
Returns
The temperature (high byte = decimal value, low byte = digits).

This function decodes the temperature value from a DS18S20 sensor (such sensors have &h10 in the lowest byte of their ID). The returned value contains the temperature in grad Celsius in the high byte and the decimal places in the low byte. Divide the value by 256 to get a real number containing the temperatur in grad Celsius.

Parameter Rom is usually the adress of PruW1::DRam[4].

Since
0.0

Definition at line 344 of file pruw1.bas.

◆ T_fam20()

FUNCTION_AS_SHORT T_fam20 ( BYVAL_AS_UBYTE_PTR  Rom)

Compute the temperature for a series 20 sensor (new format).

Parameters
RomThe pointer where to find the data received from the device.
Returns
The temperature (high byte = decimal value, low byte = digits).

This function decodes the temperature value from a newer Dallas sensor (the lowest byte in the ID of such sensors is either &h20, &h22, &h28, &h3B or &h42). The returned value contains the temperature in grad Celsius in the high byte and the decimal places in the low byte. Divide the value by 256 to get a real number containing the temperatur in grad Celsius.

Parameter Rom is usually the adress of PruW1::DRam[4].

Since
0.0

Definition at line 364 of file pruw1.bas.