setup example with spi CH. Problem with linking still not solved

pull/2/head
polymurph 3 years ago
parent 60a9a2cf6c
commit 2962ebd6e3

@ -27,6 +27,7 @@ typedef struct{
/**
* \brief Set up SPI channel
* Set up a SPI channel by passig a hardware SPI channel and a chipselect pin.
* The chipselect pin will be set to high (chipselect is lowactive).
* \param *ch pointer to SPI channel
* \param spi_hw_ch SPI hardware channel
* \param chipslectPin designated pin for chipslect

@ -6,6 +6,7 @@ void spiCH_setupCH(spi_ch_t *ch, spiCH_t spi_hw_ch, pinNo_t chipslectPin)
{
ch->pin = chipselectPin;
ch->spi = spi_hw_ch;
pinWrite(chipslectPin, 0);
}
uint8_t spiCH_readReg(spi_ch_t *spi_ch,

@ -43,20 +43,18 @@ int main(int argc, char *argv[])
delayMs(100);
}
spiCH_setupCH(spi_test_channel, SPI_CH_1, pinA4);
pinWrite(pinB3,0);
pinInit(pinA5);
pinInit(pinA6);
pinInit(pinA7);
pinInit(pinA4);
pinConfig(pinA5, alternate, pushPull, none, veryFast);
pinConfig(pinA6, alternate, pushPull, none, veryFast);
pinConfig(pinA7, alternate, pushPull, none, veryFast);
//pinConfig(pinA6, alternate, floating, pullDown, veryFast);
pinConfig(pinA4, output, pushPulkl, none, veryFast);
pinConfig(pinA4, output, pushPull, none, veryFast);
@ -66,7 +64,7 @@ int main(int argc, char *argv[])
spi_init(SPI_CH_1);
spiCH_setupCH(spi_test_channel, SPI_CH_1, pinA4);
spiCH_setupCH(&spi_test_channel, SPI_CH_1, pinA4);
for(i = 0 ; i < 20 ; i++) {
delayMs(50);
@ -74,8 +72,10 @@ int main(int argc, char *argv[])
delayMs(50);
}
for(i = 10; i > 0; i--) {
spi_trx(SPI_CH_1, 0xAE);
for(i = 10; i > 0; i--) {
spiCH_writeReg(&spi_test_channel,0xAE,0xAE);
//spi_trx(SPI_CH_1, 0xAE);
}
for(i = 0 ; i < 100 ; i++) {

Loading…
Cancel
Save