
#ifndef _SN_MSP_H
#define _SN_MSP_H

#include "bioscnfg.h"

#define DelayBusReset         4000   /* 500us */
#define DelayBusMaxPresence    560   /* 70 us */
#define DelayBusMaxResetIdle  2000   /* 250 us */

// #define DelayBusResetWait  4000   /* 500 us */
// #define DelayResetRecover  3520   /* 440us */
#define DelayBusWrite0         330   /* 66us */
// #define DelayBusWrite1       32   /* 4us */
#define DelayBusWrite1Wait     496   /* 62 us */
#define DelayWriteRecover       24   /* 3 us */
// #define DelayBusRead          8   /* < 1 us */
// #define DelayBusReadSample   88   /* 11us */
#define DelayBusReadRecover   4480   /* 56us */



/* 4us */
#define SN_Wait_DelayBusWrite1()       _NOP()        
#define SN_Wait_DelayBusRead()         _NOP()              
#define SN_Wait_DelayBusReadSample()   _NOP();_NOP()

#define SN_OneWireBusPinHigh()        (SN_DIR &= ~(SN_PIN)) // set as input pull up 
#define SN_OneWireBusPinLow()         (SN_DIR |=  (SN_PIN)) // set as output to null
#define SN_OneWireBusReadPin()        (SN_IN  &   (SN_PIN))  // read input, 
// note that it is only posible te read valid input is SN_OneWireBusPinHigh() is called !!


void SN_WaitMicroSeconds(unsigned int nMicroSeconds);
void SN_OneWireBusInit(void);

#endif //_SN_MSP_H
