1-Wire and ENS210 driver stack
Functions | Variables
one_wire.c File Reference

General 1-Wire API using the DS2485 1-Wire master. More...

#include <stdint.h>
#include <string.h>
#include "one_wire.h"
#include "DS2485.h"
Include dependency graph for one_wire.c:

Functions

int OneWire_ResetPulse ()
 
int OneWire_WriteByte (unsigned char byte)
 
int OneWire_WriteBlock (unsigned char *data, int data_length)
 
unsigned char OneWire_ReadByte ()
 
void OneWire_ReadBlock (unsigned char *data, int data_length)
 
int OneWire_Search (OneWire_ROM_ID_T *romid, bool search_reset, bool *last_device_found)
 
int OneWire_WriteBytePower (int send_byte)
 
void OneWire_Script_Clear (void)
 
int OneWire_Script_Execute (void)
 
int OneWire_Script_Add_OW_RESET (uint8_t *response_index, one_wire_speeds spd, bool ignore)
 
int OneWire_Script_Add_OW_WRITE_BIT (uint8_t *response_index, bool bit_value)
 
int OneWire_Script_Add_OW_READ_BIT (uint8_t *response_index)
 
int OneWire_Script_Add_OW_WRITE_BYTE (uint8_t *response_index, uint8_t txByte)
 
int OneWire_Script_Add_OW_READ_BYTE (uint8_t *response_index)
 
int OneWire_Script_Add_OW_TRIPLET (uint8_t *response_index, bool t_value)
 
int OneWire_Script_Add_OV_SKIP (uint8_t *response_index)
 
int OneWire_Script_Add_SKIP (uint8_t *response_index)
 
int OneWire_Script_Add_OW_READ_BLOCK (uint8_t *response_index, uint8_t rxBytes)
 
int OneWire_Script_Add_OW_WRITE_BLOCK (uint8_t *response_index, const uint8_t *txData, uint8_t txData_length)
 
void OneWire_Script_Add_DELAY (uint8_t ms)
 
void OneWire_Script_Add_PRIME_SPU (void)
 
void OneWire_Script_Add_SPU_OFF (void)
 
int OneWire_Script_Add_SPEED (one_wire_speeds spd, bool ignore)
 
int OneWire_Script_Add_VERIFY_TOGGLE (uint8_t *response_index)
 
int OneWire_Script_Add_VERIFY_BYTE (uint8_t *response_index, uint8_t byte)
 
void OneWire_Script_Add_CRC16_START (void)
 
void OneWire_Script_Add_VERIFY_CRC16 (uint8_t *response_index, unsigned short hex_value)
 
void OneWire_Script_Add_SET_GPIO (uint8_t *response_index, gpio_settings pioac)
 
void OneWire_Script_Add_READ_GPIO (uint8_t *response_index)
 
void OneWire_Script_Add_VERIFY_GPIO (uint8_t *response_index, gpio_verify_level_detection pioal)
 
void OneWire_Script_Add_CONFIG_RPUP_BUF (unsigned short hex_value)
 
int OneWire_Enable_APU (bool apu)
 
int OneWire_Enable_SPU (bool spu)
 
int OneWire_Enable_OneWirePowerDown (bool pdn)
 
int OneWire_Set_OneWireMasterSpeed (one_wire_speeds spd)
 
int OneWire_Get_OneWireMasterSpeed (one_wire_speeds *spd)
 
int OneWire_Set_Custom_RPUP_BUF (vth_values vth, viapo_values viapo, rwpu_values rwpu)
 
int OneWire_Get_Custom_RPUP_BUF (vth_values *vth, viapo_values *viapo, rwpu_values *rwpu)
 
int OneWire_Set_tRSTL_Standard_Predefined (one_wire_timing_presets trstl)
 
int OneWire_Set_tRSTL_Overdrive_Predefined (one_wire_timing_presets trstl)
 
int OneWire_Set_tRSTL_Standard_Custom (double trstl)
 
int OneWire_Set_tRSTL_Overdrive_Custom (double trstl)
 
int OneWire_Get_tRSTL (double *trstl, one_wire_speeds spd)
 
int OneWire_Set_tRSTH_Standard_Predefined (one_wire_timing_presets trsth)
 
int OneWire_Set_tRSTH_Overdrive_Predefined (one_wire_timing_presets trsth)
 
int OneWire_Set_tRSTH_Standard_Custom (double trsth)
 
int OneWire_Set_tRSTH_Overdrive_Custom (double trsth)
 
int OneWire_Get_tRSTH (double *trsth, one_wire_speeds spd)
 
int OneWire_Set_tW0L_Standard_Predefined (one_wire_timing_presets tw0l)
 
int OneWire_Set_tW0L_Overdrive_Predefined (one_wire_timing_presets tw0l)
 
int OneWire_Set_tW0L_Standard_Custom (double tw0l)
 
int OneWire_Set_tW0L_Overdrive_Custom (double tw0l)
 
int OneWire_Get_tW0L (double *tw0l, one_wire_speeds spd)
 
int OneWire_Set_tREC_Standard_Predefined (one_wire_timing_presets trec)
 
int OneWire_Set_tREC_Overdrive_Predefined (one_wire_timing_presets trec)
 
int OneWire_Set_tREC_Standard_Custom (double trec)
 
int OneWire_Set_tREC_Overdrive_Custom (double trec)
 
int OneWire_Get_tREC (double *trec, one_wire_speeds spd)
 
int OneWire_Set_tMSI_Standard_Predefined (one_wire_timing_presets tmsi)
 
int OneWire_Set_tMSI_Overdrive_Predefined (one_wire_timing_presets tmsi)
 
int OneWire_Set_tMSI_Standard_Custom (double tmsi)
 
int OneWire_Set_tMSI_Overdrive_Custom (double tmsi)
 
int OneWire_Get_tMSI (double *tmsi, one_wire_speeds spd)
 
int OneWire_Set_tMSP_Standard_Predefined (one_wire_timing_presets tmsp)
 
int OneWire_Set_tMSP_Overdrive_Predefined (one_wire_timing_presets tmsp)
 
int OneWire_Set_tMSP_Standard_Custom (double tmsp)
 
int OneWire_Set_tMSP_Overdrive_Custom (double tmsp)
 
int OneWire_Get_tMSP (double *tmsp, one_wire_speeds spd)
 
int OneWire_Set_tW1L_Standard_Predefined (one_wire_timing_presets tw1l)
 
int OneWire_Set_tW1L_Overdrive_Predefined (one_wire_timing_presets tw1l)
 
int OneWire_Set_tW1L_Standard_Custom (double tw1l)
 
int OneWire_Set_tW1L_Overdrive_Custom (double tw1l)
 
int OneWire_Get_tW1L (double *tw1l, one_wire_speeds spd)
 
int OneWire_Set_tMSR_Standard_Predefined (one_wire_timing_presets tmsr)
 
int OneWire_Set_tMSR_Overdrive_Predefined (one_wire_timing_presets tmsr)
 
int OneWire_Set_tMSR_Standard_Custom (double tmsr)
 
int OneWire_Set_tMSR_Overdrive_Custom (double tmsr)
 
int OneWire_Get_tMSR (double *tmsr, one_wire_speeds spd)
 
int OneWire_Init (void)
 

Variables

uint8_t oneWireScript [126]
 
uint8_t oneWireScript_length = 0
 
double oneWireScript_accumulativeOneWireTime = 0
 
uint8_t oneWireScript_commandsCount = 0
 
uint8_t oneWireScriptResponse [126]
 
uint8_t oneWireScriptResponse_length = 0
 

Detailed Description

General 1-Wire API using the DS2485 1-Wire master.

Function Documentation

◆ OneWire_Search()

int OneWire_Search ( OneWire_ROM_ID_T romid,
bool  search_reset,
bool *  last_device_found 
)

Perform the 1-Wire Search Algorithm on the 1-Wire bus parameter: search_reset: start a new search? (false: continue on to next device) Return 0: no error return parameter: last_device_found - True: no more devices