/*
 * hal_ENC424J600.h
 *
 *  Created on: Nov 14, 2011
 *      Author: RomanM
 */

#ifndef HAL_ENC424J600_H_
#define HAL_ENC424J600_H_

#include <stdint.h>

#define	hal_ENC424J600_SPIx			SPI1

#define hal_ENC424J600_PORT			GPIOA
#define hal_ENC424J600_PORT_CLK		RCC_APB2Periph_GPIOA

#define	hal_ENC424J600_NSS_PIN		GPIO_Pin_4
#define	hal_ENC424J600_INT_PIN		GPIO_Pin_3

#define	hal_Enc424j600_Wait25us()	hal_Enc424j600_Delay(600)
#define hal_Enc424j600_Wait256us()	hal_Enc424j600_Delay(6100)

void hal_Enc424j600_Init(void);
void hal_Enc424j600_GPIO_Config(void);
void hal_Enc424j600_RCC_Config(void);
void hal_Enc424j600_EXTI_Config(void);
void hal_Enc424j600_NVIC_Config(void);

void hal_ENC424J600_NSS_Low(void);
void hal_ENC424J600_NSS_High(void);

uint8_t hal_Enc424j600_RW(uint8_t data);
void hal_Enc424j600_WriteN(uint8_t *outBuff, uint8_t n);
void hal_Enc424j600_ReadN(uint8_t *inBuff, uint8_t n);

void hal_Enc424j600_Delay(uint32_t nTick);

#endif /* HAL_ENC424J600_H_ */
