Exemple #1
0
void osd_spi_write(int8_t addr, int8_t byte)
{
	OSD_CS = 0;                 // Set active-low CS low to start the SPI cycle 
	spi_write_raw_byte(addr);   // Send the Address
	spi_write_raw_byte(byte);   // Send the data
	OSD_CS = 1;                 // Set active-low CS high to end the SPI cycle 
}
Exemple #2
0
void osd_spi_write(int8_t addr, int8_t byte)
{
    OSD_CS = 1;                 // Make sure we start with active-low CS high
    OSD_SCK = 0;                // and CK low
    OSD_CS = 0;                 // Set active-low CS low to start the SPI cycle
    spi_write_raw_byte(addr);   // Send the Address
    spi_write_raw_byte(byte);   // Send the data
    OSD_CS = 1;                 // Set active-low CS high to end the SPI cycle
    Nop();
    Nop();
    Nop();
    Nop(); // Kill some time with CS high to make a more solid pulse
    OSD_MOSI = 0;
}
Exemple #3
0
uint8_t osd_spi_read(int8_t addr)
{
	uint8_t SPIData;

	OSD_CS = 0;                     // Set active-low CS low to start the SPI cycle 
	spi_write_raw_byte(addr);       // Send the Address
	__delay32(20000UL * OSD_SF);
	SPIData = spi_xfer_raw_byte(0);
	OSD_CS = 1;                     // Set active-low CS high to end the SPI cycle 
	return SPIData;
}
Exemple #4
0
unsigned char osd_spi_read(char addr)
{
    unsigned char SPIData = 0 ;

    OSD_CS = 1 ;				// Make sure we start with active-low CS high
    OSD_SCK = 0 ;				// and CK low

    OSD_CS = 0 ;				// Set active-low CS low to start the SPI cycle
    spi_write_raw_byte(addr) ;	// Send the Address
    OSD_MOSI = 0 ;
    SPIData = spi_read_raw_byte() ;	// Send the data

    OSD_CS = 1 ;				// Set active-low CS high to end the SPI cycle

    Nop();
    Nop();
    Nop();
    Nop();	// Kill some time with CS high to make a more solid pulse

    return SPIData ;
}