CuVoodoo STM32F1 firmware template
|
library for 1-wire protocol as master (code) More...
Go to the source code of this file.
Macros | |
#define | ONEWIRE_SLAVE_TIMER 2 |
timer ID | |
#define | ONEWIRE_SLAVE_PORT A |
GPIO port. | |
#define | ONEWIRE_SLAVE_PIN 4 |
GPIO pin. | |
Functions | |
static uint8_t | onewire_slave_crc (uint8_t *data, uint32_t length) |
compute CRC for 1-Wire More... | |
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... | |
void EXTI_ISR() | ONEWIRE_SLAVE_PIN (void) |
interrupt service routine called when 1-Wire signal changes | |
void TIM_ISR() | ONEWIRE_SLAVE_TIMER (void) |
interrupt service routine called for timer | |
Variables | |
static enum { ... } | onewire_slave_state = ONEWIRE_STATE_IDLE |
state of 1-Wire communication | |
static uint8_t | onewire_slave_rom_code [8] = {0} |
slave ROM code | |
volatile bool | onewire_slave_function_code_received = false |
set when a function command code has been received More... | |
volatile uint8_t | onewire_slave_function_code = 0 |
last function command code received | |
volatile bool | onewire_slave_transfer_complete = false |
set when data read/write transfer has been completed More... | |
static volatile uint8_t | bits_buffer = 0 |
buffer for the incoming bits (up to one byte) | |
static volatile uint32_t | bits_bit = 0 |
number of incoming bits | |
static volatile uint8_t * | onewire_slave_transfer_data = NULL |
data to transfer (read or write) | |
static volatile uint32_t | onewire_slave_transfer_bits = 0 |
number of bits to transfer | |
library for 1-wire protocol as master (code)
Definition in file onewire_slave.c.
anonymous enum |
state of 1-Wire communication
Definition at line 57 of file onewire_slave.c.
|
static |
compute CRC for 1-Wire
[in] | data | bytes on which to calculate CRC checksum on |
[in] | length | number of bytes in data |
Definition at line 92 of file onewire_slave.c.
bool onewire_slave_function_read | ( | uint8_t * | data, |
size_t | size | ||
) |
read data from master
[out] | data | buffer to save read bits |
[in] | size | number of bytes to read |
Definition at line 157 of file onewire_slave.c.
bool onewire_slave_function_write | ( | const uint8_t * | data, |
size_t | size | ||
) |
write data to master
[in] | data | data to write |
[in] | size | number of bytes to write |
Definition at line 176 of file onewire_slave.c.
void onewire_slave_setup | ( | uint8_t | family, |
uint64_t | serial | ||
) |
setup 1-wire peripheral
[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.
volatile bool onewire_slave_function_code_received = false |
set when a function command code has been received
Definition at line 77 of file onewire_slave.c.
volatile bool onewire_slave_transfer_complete = false |
set when data read/write transfer has been completed
Definition at line 79 of file onewire_slave.c.