hcsr501.h 639 Bytes
#ifndef __HCSR501_H__
#define __HCSR501_H__
#include <stdint.h>

#define HCSR_PIN NRF_GPIO_PIN_MAP(1,6) //Set P1.06 as temperature sensor out interface  
#define PIN_HCSR_OUT   (nrf_gpio_cfg_output(HCSR_PIN));   
#define PIN_HCSR_IN    (nrf_gpio_cfg_input(HCSR_PIN,NRF_GPIO_PIN_NOPULL));    
 
 
#define PIN_HCSR_SET    (nrf_gpio_pin_set(HCSR_PIN));
#define PIN_HCSR_CLEAR  (nrf_gpio_pin_clear(HCSR_PIN));
 
#define HCSR_SUCCESS   NRF_SUCCESS  
#define HCSR_NACK      0xFE     


typedef struct
{
	uint8_t hcsr_value;	                 
}HCSR_Data_t;
 
uint32_t Read_HCSR(HCSR_Data_t *HCSR_Data);         
 
#endif