コード例 #1
0
void init_8x8()
{
#ifdef USE_HW_VERSION
	DISP8x8_DDR &= ~MISO; // MISO as input
#endif
	DISP8x8_DDR |= DISP8x8_CS + DISP8x8_DIN + DISP8x8_CLK;  // SS, MOSI, SCK pin as output
	DISP8x8_PORT = DISP8x8_CS + MISO + DISP8x8_CLK; 
	wait(1);
	
	// SPI mode 0: leading edge = sample rising, trailing edge = setup falling
	// no interrupt, SPI enable, MSB first, master, mode 00, prescaler 16 (1 usec delay)
	SPSR = 0;

#ifdef USE_HW_VERSION	
	SPCR = 0b01010001;
#else
	SPCR = 0; 
#endif

	set_8x8_intensity(0x4);
	// scan limit 7
	send_spi_data(0x0b, 0x07);
	// decode mode 0 = led matrix (no digit decoding)
	send_spi_data(0x09, 0x0);
	// not shutdown mode
	send_spi_data(0x0c, 0x1);
	// not display test
	send_spi_data(0x0f, 0x0);
}
コード例 #2
0
static status_t peripheral_write(uint8_t *src, uint32_t writeLength)
{
    status_t status = kStatus_Success;

    switch (g_buspalState)
    {
        case kBuspal_I2c:
            status = send_i2c_data(src, writeLength);
            break;
        case kBuspal_Spi:
            send_spi_data(src, writeLength);
            break;
        case kBuspal_FlexCAN:
            send_can_data(src, writeLength);
            break;
        default:
            status = kStatus_Fail;
            break;
    }

    return status;
}
コード例 #3
0
void set_8x8_intensity(uint8_t intensity)
{
	send_spi_data(0x0a, intensity);
}
コード例 #4
0
void set_8x8_segment(uint8_t segm, uint8_t data)
{
	send_spi_data(segm, data);
}