1-Wire and ENS210 driver stack
|
General library for the DS2485, supports the higher-level one_wire.c/.h API. More...
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | DS2485_I2C_7BIT_ADDRESS 0x40U |
will be shifted left one bit, then or'd with RW (R=1, W=0) bit on I2C | |
#define | DS2485_I2C_CLOCKRATE 1000000U |
1MHz | |
#define | DFC_WRITE_MEMORY 0x96; |
#define | DFC_READ_MEMORY 0x44; |
#define | DFC_READ_STATUS 0xAA; |
#define | DFC_SET_I2C_ADDRESS 0x75; |
#define | DFC_SET_PAGE_PROTECTION 0xC3; |
#define | DFC_READ_ONE_WIRE_PORT_CONFIG 0x52; |
#define | DFC_WRITE_ONE_WIRE_PORT_CONFIG 0x99; |
#define | DFC_MASTER_RESET 0x62; |
#define | DFC_ONE_WIRE_SCRIPT 0x88; |
#define | DFC_ONE_WIRE_BLOCK 0xAB; |
#define | DFC_ONE_WIRE_READ_BLOCK 0x50; |
#define | DFC_ONE_WIRE_WRITE_BLOCK 0x68; |
#define | DFC_ONE_WIRE_SEARCH 0x11; |
#define | DFC_FULL_COMMAND_SEQUENCE 0x57; |
#define | DFC_COMPUTE_CRC16 0xCC; |
#define | RB_SUCCESS 0 |
#define | RB_ALREADY_PROTECTED -100 |
#define | RB_INVALID_PARAMETER -101 |
#define | RB_SET_ADDRESS_FAIL -102 |
#define | RB_MASTER_RESET_FAIL -103 |
#define | RB_COMMS_FAIL -104 |
#define | RB_NO_PRESENCE -105 |
#define | RB_NO_MATCH_WRITES -106 |
#define | RB_NOT_DETECTED -107 |
#define | RB_INCORRECT_CRC -108 |
#define | RB_INVALID_LENGTH -109 |
#define | RB_LENGTH_MISMATCH -110 |
#define | RB_WRITE_PROTECTED -111 |
#define | RB_UNKNOWN -112 |
#define | tOP_USEC 40 |
#define | tSEQ_USEC 20 |
#define | tRM_MSEC 50 |
#define | tWM_MSEC 100 |
#define | tWS_MSEC 15 |
Functions | |
int | DS2485_WriteMemory (DS2485_memory_page_T pgNumber, const uint8_t *pgData) |
int | DS2485_ReadMemory (DS2485_memory_page_T pgNumber, uint8_t *pgData) |
int | DS2485_ReadStatus (DS2485_status_outputs_T output, uint8_t *status) |
int | DS2485_SetI2cAddress (uint8_t newAddress) |
int | DS2485_SetPageProtection (DS2485_memory_page_T pgNumber, DS2485_page_protection_T protection) |
int | DS2485_ReadOneWirePortConfig (DS2485_configuration_register_address_T reg, uint8_t *regData) |
int | DS2485_WriteOneWirePortConfig (DS2485_configuration_register_address_T reg, const uint8_t *regData) |
int | DS2485_MasterReset (void) |
int | DS2485_OneWireScript (const uint8_t *script, uint8_t script_length, double accumulativeOneWireTime, uint8_t commandsCount, uint8_t *scriptResponse, uint8_t scriptResponse_length) |
int | DS2485_OneWireBlock (const uint8_t *blockData, int blockData_Length, uint8_t *ow_data, bool ow_reset, bool ignore, bool spu, bool pe) |
int | DS2485_OneWireWriteBlock (const uint8_t *writeData, int writeData_Length, bool ow_reset, bool ignore, bool spu) |
int | DS2485_OneWireReadBlock (uint8_t *readData, uint8_t bytes) |
int | DS2485_OneWireSearch (uint8_t *romId, uint8_t code, bool ow_reset, bool ignore, bool search_rst, bool *flag) |
int | DS2485_FullCommandSequence (const uint8_t *owData, int owData_Length, uint8_t *rom_id, DS2485_full_command_sequence_delays_msecs_T ow_delay_msecs, uint8_t *ow_rslt_data, uint8_t ow_rslt_len) |
int | DS2485_ComputeCrc16 (const uint8_t *crcData, int crcData_Length, uint8_t *crc16) |
int | DS2485_ExecuteCommand (const uint8_t *packet, int packetSize, int delay_uSec, uint8_t *response, int responseSize) |
General library for the DS2485, supports the higher-level one_wire.c/.h API.
int DS2485_ExecuteCommand | ( | const uint8_t * | packet, |
int | packetSize, | ||
int | delay_uSec, | ||
uint8_t * | response, | ||
int | responseSize | ||
) |
< Bit mask of options for the transfer. Set to 0 or kLPI2C_TransferDefaultFlag for normal transfers.
< The 7-bit slave address.
< Either kLPI2C_Read or kLPI2C_Write.
< Sub address. Transferred MSB first.
< Length of sub address to send in bytes. Maximum size is 4 bytes.
< Pointer to data to transfer.
< Number of bytes to transfer.
< Bit mask of options for the transfer. Set to 0 or kLPI2C_TransferDefaultFlag for normal transfers.
< The 7-bit slave address.
< Either kLPI2C_Read or kLPI2C_Write.
< Sub address. Transferred MSB first.
< Length of sub address to send in bytes. Maximum size is 4 bytes.
< Pointer to data to transfer.
< Number of bytes to transfer.