Argh ! hidden, silent bug, as I always used port 0 for the pins. (Thank you cyprien...
authorNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 28 Jul 2014 08:51:23 +0000 (10:51 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:04 +0000 (17:03 +0100)
drivers/cc1101.c

index 0550bbf..b0a228e 100644 (file)
@@ -404,7 +404,12 @@ static uint8_t paTable[] = {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 /* Configure pins, reset the CC1101, and put the CC1101 chip in idle state */
 void cc1101_init(uint8_t ssp_num, struct pio* cs_pin, struct pio* miso_pin)
 {
-       struct lpc_gpio* gpio = LPC_GPIO_REGS(cc1101.cs_pin.port);;
+       struct lpc_gpio* gpio = NULL;
+
+       if ((cs_pin == NULL) || (miso_pin == NULL)) {
+               return;
+       }
+       gpio = LPC_GPIO_REGS(cs_pin->port);
 
        cc1101.spi_num = ssp_num;
        /* Copy CS pin info and configure pin as GPIO output */