Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * ds18b20.h
- *
- * Created on: 8 sty 2015
- * Author: miszczo
- */
- #ifndef DS18B20_DS18B20_H_
- #define DS18B20_DS18B20_H_
- // connection to ds18b20
- #define ONE_WIRE_PORT B
- #define ONE_WIRE_PIN 4
- //DDR
- #define WIRE_DDR_S(s) GLUE(DDR,s)
- #define WIRE_DDR WIRE_DDR_S(ONE_WIRE_PORT) // DDRX
- //PORT
- #define WIRE_PORT_S(s) GLUE(PORT,s)
- #define WIRE_PORT WIRE_PORT_S(ONE_WIRE_PORT) // PORTX
- //PIN
- #define WIRE_PIN_S(s) GLUE(PIN,s)
- #define WIRE_PIN WIRE_PIN_S(ONE_WIRE_PORT) // PINX
- //direction
- #define WIRE_OUT WIRE_DDR|=(1<<ONE_WIRE_PIN) // out
- #define WIRE_IN WIRE_DDR&=~(1<<ONE_WIRE_PIN) // in
- // state
- #define WIRE_HI WIRE_PORT|=(1<<ONE_WIRE_PIN) // hi
- #define WIRE_LO WIRE_PORT&=~(1<<ONE_WIRE_PIN) // lo
- // get state
- #define WIRE_STATE (WIRE_PIN &(1<<ONE_WIRE_PIN))
- void ds18b20_get_meas( uint8_t *decimal ,uint8_t *fractal );
- #endif /* DS18B20_DS18B20_H_ */
- /*
- * ds18b20.c
- *
- * Created on: 8 sty 2015
- * Author: miszczo
- */
- #include <avr/io.h>
- #include "ds18b20.h"
- void ds18b20_get_meas( uint8_t *decimal ,uint8_t *fractal ){
- WIRE_HI;
- //reset pulse
- //ONE_WIRE_LO;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement