Beispiel #1
0
void mpu6k_writeRegister(uint8_t addr, uint8_t data)
{
	spi_CS_low();
	spi_sendByte(addr & ~(1<<7));
	spi_sendByte(data);
	spi_CS_high();
}
Beispiel #2
0
void mpu6k_readRegisters(uint8_t addr, uint8_t num, uint8_t* data)
{
	spi_CS_low();
	spi_sendByte(addr | (1<<7));

	for(;num > 0;--num, ++data)
		*data = spi_sendByte(0x00);

	spi_CS_high();
}
Beispiel #3
0
// Note: Make sure there is an adequate time between successive calls to readRegister/writeRegister for the chip
// to recognise the CS deassert! If in doubt, insert a mpu6k_cs_wait() call in between.
uint8_t mpu6k_readRegister(uint8_t addr)
{
	uint8_t ret;

	spi_CS_low();
	delay_us(1);
	spi_sendByte(addr | (1<<7));
	ret = spi_sendByte(0x00);
	spi_CS_high();

	return ret;
}
Beispiel #4
0
void lcd_sendDAT(byte dat) 
{
  PTAD_PTAD2 = 0; /*  nahodit -SS */
  PTAD_PTAD3 = 1;
  spi_sendByte(dat);
  while(!SPI2S_SPTEF);
  delay(50);
  PTAD_PTAD2 = 1;   /*  shodit -SS */
  delay(50);
}
Beispiel #5
0
void lcd_sendCMD(byte cmd) 
{
  PTAD_PTAD2 = 0; /*  nahodit -SS */
  PTAD_PTAD3 = 0;
  spi_sendByte(cmd);
  while(!SPI2S_SPTEF);
  delay(50);
  PTAD_PTAD2 = 1;   /*  shodit -SS */
  delay(50);
}