/*
 * periph.h
 *
 *  Created on: 28 Jun 2018
 *      Author: nats
 */

#ifndef PERIPH_H_
#define PERIPH_H_

#include "stm32f10x_gpio.h"
#include "stm32f10x_i2c.h"

#define		I2C_SPEED		50000
#define		I2C_LMK_ADDR	0x59

#define 	NODMA			0
#define		WITHDMA			1

/* PORT A */
#define		SI_CTS			GPIO_Pin_1
#define		SI_CS			GPIO_Pin_4
#define		SCK				GPIO_Pin_5
#define     MISO			GPIO_Pin_6
#define		MOSI			GPIO_Pin_7
#define		UTX				GPIO_Pin_9
#define		URX				GPIO_Pin_10
#define		LED				GPIO_Pin_12

/* PORT B */
#define		SI_SHDN			GPIO_Pin_1
#define		PLL_EN			GPIO_Pin_4

void initGPIO();
void initI2C();
uint8_t validPLL(uint8_t addr, uint8_t ref);
void writeTIPLL(uint8_t addr, uint8_t value);
void initSPI(uint8_t withDMA);
void initUART();

#endif /* PERIPH_H_ */
