-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathonewire.h
More file actions
32 lines (26 loc) · 766 Bytes
/
onewire.h
File metadata and controls
32 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* 1-Wire implementation for MSP430
*
* @author: David Siroky <siroky@dasir.cz>
* @license: MIT
*/
#ifndef __ONEWIRE_H
#define __ONEWIRE_H
#include <stdint.h>
typedef struct {
volatile uint8_t *port_out;
const volatile uint8_t *port_in;
volatile uint8_t *port_ren;
volatile uint8_t *port_dir;
int pin;
} onewire_t;
//########################################################################
int onewire_reset(onewire_t *ow);
void onewire_write_bit(onewire_t *ow, int bit);
int onewire_read_bit(onewire_t *ow);
void onewire_write_byte(onewire_t *ow, uint8_t byte);
uint8_t onewire_read_byte(onewire_t *ow);
void onewire_line_low(onewire_t *ow);
void onewire_line_high(onewire_t *ow);
void onewire_line_release(onewire_t *ow);
#endif