working better example of alternating On Off Frame test with MAX7219

spi
polymurph 3 years ago
parent 734647f637
commit 6214d67393

@ -157,6 +157,8 @@ uint8_t spiTrx(spiCH_t spi_hw_ch, uint8_t tx_data)
//SPI1->DR = tx_data; // send data //SPI1->DR = tx_data; // send data
// this masking must be done. otherwise 16bits frame will be used
*(uint8_t*)&(SPI_BASE->DR) = tx_data; *(uint8_t*)&(SPI_BASE->DR) = tx_data;
// Wait for RXNE to set -> This will indicate that the Rx buffer is not empty // Wait for RXNE to set -> This will indicate that the Rx buffer is not empty

@ -11,27 +11,29 @@ void max7219_test_display(spi_ch_t* spi_ch)
{ {
// set mode to display test // set mode to display test
/*
pinWrite(spi_ch->pin, 0); pinWrite(spi_ch->pin, 0);
spiTrx(spi_ch->spi, 0x0F); spiTrx(spi_ch->spi, 0x0F);
spiTrx(spi_ch->spi, 0x00); spiTrx(spi_ch->spi, 0x01);
pinWrite(spi_ch->pin,1); pinWrite(spi_ch->pin,1);
*/
//spiWrite16bit(spi_ch, 0x0C01); spiWriteReg(spi_ch,0x0F,0x01);
// spiWrite16bit(spi_ch, 0x0F01);
//delayMs(50); //delayMs(50);
// spiWrite16bit(spi_ch, 0x0F01); // spiWrite16bit(spi_ch, 0x0F01);
delayMs(1000); delayMs(1000);
/*
pinWrite(spi_ch->pin, 0); pinWrite(spi_ch->pin, 0);
spiTrx(spi_ch->spi, 0x0C); spiTrx(spi_ch->spi, 0x0F);
spiTrx(spi_ch->spi, 0x01); spiTrx(spi_ch->spi, 0x00);
pinWrite(spi_ch->pin,1); pinWrite(spi_ch->pin,1);
*/
// set mode to shutdown // set mode to shutdown
// spiWrite16bit(spi_ch, 0x0C00); spiWrite16bit(spi_ch, 0x0F00);
delayMs(1000); delayMs(1000);
/*
pinWrite(spi_ch->pin, 0); pinWrite(spi_ch->pin, 0);
spiTrx(spi_ch->spi, 0x0C); spiTrx(spi_ch->spi, 0x0C);
spiTrx(spi_ch->spi, 0x00); spiTrx(spi_ch->spi, 0x00);
@ -40,7 +42,7 @@ void max7219_test_display(spi_ch_t* spi_ch)
// set mode to shutdown // set mode to shutdown
// spiWrite16bit(spi_ch, 0x0C00); // spiWrite16bit(spi_ch, 0x0C00);
delayMs(1000); delayMs(1000);*/
} }
void max7219_setIntensity(spi_ch_t* spi_ch, uint8_t intensity) void max7219_setIntensity(spi_ch_t* spi_ch, uint8_t intensity)

Loading…
Cancel
Save