From: Nathael Pajani Date: Mon, 28 Jul 2014 08:51:23 +0000 (+0200) Subject: Argh ! hidden, silent bug, as I always used port 0 for the pins. (Thank you cyprien... X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=07acdbd4c4c4f3bd1e022b6c6108a682c9ac2190;p=soft%2Flpc122x%2Fcore Argh ! hidden, silent bug, as I always used port 0 for the pins. (Thank you cyprien for seeing this one :) Use the port number from the provided pio struct, not from our onw un-initialized one. And make sure both pio struct pointers are not NULL before using them .... --- diff --git a/drivers/cc1101.c b/drivers/cc1101.c index 0550bbf..b0a228e 100644 --- a/drivers/cc1101.c +++ b/drivers/cc1101.c @@ -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 */