esden on master
Update to recent libopencm3 (compare)
esden on master
Updated LOCM3. Improved the clean target. Ignore if st-link/dfu-util is n… and 9 more (compare)
0xdec on v2.0a
More WIP (compare)
0xdec on v2.0a
WIP migration + v2.0a (compare)
esden on master
Fix formatting, typos, grammar … (compare)
kbob on master
Improve audio clock calculation. Experiment with different color… Added bit definitions for the g… and 1 more (compare)
So far this is what I'm trying
static void spi_setup(void) {
/* INIT SPI GPIO */
gpio_mode_setup(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO13|GPIO14|GPIO15);
gpio_set_af(GPIOB, GPIO_AF5, GPIO13|GPIO14|GPIO15);
/* INIT SPI SS GPIO */
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO12);
gpio_set(GPIOB, GPIO12);
spi_set_master_mode(SPI2);
spi_set_baudrate_prescaler(SPI2, SPI_CR1_BR_FPCLK_DIV_64);
spi_set_clock_polarity_0(SPI2);
spi_set_clock_phase_0(SPI2);
spi_set_full_duplex_mode(SPI2);
spi_send_msb_first(SPI2);
spi_set_nss_high(SPI2);
spi_enable(SPI2);
}
Then in main, I will do:
spi_send(SPI2, 0xDE);
spi_send(SPI2, 0xAD);
spi_send(SPI2, 0xBE);
spi_send(SPI2, 0xEF);
spi_xfer
rather than spi_send
then it will return once the byte has been completely sent. This can be important in controlling displays where they want you to send the control byte first, then set a pin to indicate data, and send data bytes next.
A number of people have run into issues when their code does
uint8_t *cmd_buf;
spi_send(*cmd_buf++);
gpio_set(<pin to set data/command line>);
spi_send(*cmd_buf++);
...
gpio_clear(<pin to set data/command>);
That ends up setting the command/data line about 3 or 4 bits into the first transmission and often confuses the heck out of an SPI driven display.