Added some SPI test code, temporary.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14260 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-04-22 11:57:25 +00:00
parent 570bc7b49b
commit e28f9182b4
1 changed files with 16 additions and 9 deletions

View File

@ -22,13 +22,6 @@ void spi_cb(SPIDriver *spip) {
(void)spip;
}
SPIConfig spicfg1 = {
.end_cb = spi_cb,
.ssline = 4U,
.SSPCR0 = 0U,
.SSPCPSR = 0U
};
semaphore_t blinker_sem;
/*
@ -71,9 +64,23 @@ int main(void) {
palSetLineMode(25U, PAL_MODE_OUTPUT_PUSHPULL | PAL_RP_PAD_DRIVE12);
/*
* Settin up SPI0.
* Setting up SPI0.
*/
spiStart(&SPID0, &spicfg1);
{
static SPIConfig spicfg1 = {
.end_cb = spi_cb,
.ssline = 4U,
.SSPCR0 = SPI_SSPCR0_FRF_MOTOROLA | SPI_SSPCR0_DSS_8BIT,
.SSPCPSR = 0U
};
spicfg1.SSPCPSR = hal_lld_get_clock(clk_peri) / 1000000U;
spiStart(&SPID0, &spicfg1);
static const uint16_t txbuf[16] = {0, 1, 2, 3, 4, 5, 6, 7,
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF};
static uint16_t rxbuf[16];
spiExchange(&SPID0, 16U, txbuf, rxbuf);
}
/*
* Creates the blinker thread.