onewire_slave.h File Reference

library for 1-wire protocol as slave (API) More...

Go to the source code of this file.

## Functions

void | onewire_slave_setup (uint8_t family, uint64_t serial)
| setup 1-wire peripheral More...
bool | onewire_slave_function_read (uint8_t *data, size_t size)
| read data from master More...
bool | onewire_slave_function_write (const uint8_t *data, size_t size)
| write data to master More...

## Variables

volatile bool | onewire_slave_function_code_received
| set when a function command code has been received More...
volatile uint8_t | onewire_slave_function_code
| last function command code received
volatile bool | onewire_slave_transfer_complete
| set when data read/write transfer has been completed More...

## Detailed Description

library for 1-wire protocol as slave (API)

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2017

Note
  peripherals used: timer timer used to measure 1-wire signal timing, GPIO GPIO used for 1-wire signal
  overdrive mode is not supported

Definition in file onewire_slave.h.

## Function Documentation

## onewire_slave_function_read()

bool onewire_slave_function_read | ( | uint8_t * | data,
|  | size_t | size
| ) |  |

read data from master

Parameters

  [out] | data | buffer to save read bits
  [in] | size | number of bytes to read

Returns
  if transfer initialization succeeded

Note
  onewire_slave_transfer_complete is set when transfer is completed

Definition at line 157 of file onewire_slave.c.

## onewire_slave_function_write()

bool onewire_slave_function_write | ( | const uint8_t * | data,
|  | size_t | size
| ) |  |

write data to master

Parameters

  [in] | data | data to write
  [in] | size | number of bytes to write

Returns
  if transfer initialization succeeded

Note
  onewire_slave_transfer_complete is set when transfer is completed

Definition at line 176 of file onewire_slave.c.

## onewire_slave_setup()

void onewire_slave_setup | ( | uint8_t | family,
|  | uint64_t | serial
| ) |  |

setup 1-wire peripheral

Parameters

  [in] | family | family code for slave ROM code (8 bits)
  [in] | serial | serial number for slave ROM code (48 bits)

Definition at line 112 of file onewire_slave.c.

## Variable Documentation

## onewire_slave_function_code_received

volatile bool onewire_slave_function_code_received

set when a function command code has been received

Note
  needs to be cleared by user

Definition at line 77 of file onewire_slave.c.

## onewire_slave_transfer_complete

volatile bool onewire_slave_transfer_complete

set when data read/write transfer has been completed

Note
  needs to be cleared by user

Definition at line 79 of file onewire_slave.c.