From 6f73769c30086bf6b35054b03968848f94fb8b33 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Sun, 14 Dec 2014 18:04:39 +0100 Subject: [PATCH] Make use of the pio and gpio config functions - cc1101 part --- extdrv/cc1101.c | 9 +++------ include/extdrv/cc1101.h | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/extdrv/cc1101.c b/extdrv/cc1101.c index b788648..b586b56 100644 --- a/extdrv/cc1101.c +++ b/extdrv/cc1101.c @@ -25,6 +25,7 @@ #include "core/pio.h" #include "lib/string.h" #include "drivers/ssp.h" +#include "drivers/gpio.h" #include "extdrv/cc1101.h" @@ -426,21 +427,17 @@ 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) +void cc1101_init(uint8_t ssp_num, const struct pio* cs_pin, const struct pio* miso_pin) { - 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 */ pio_copy(&(cc1101.cs_pin), cs_pin); /* Configure CS as output and set high */ - gpio->data_dir |= (1 << cc1101.cs_pin.pin); - gpio->set = (1 << cc1101.cs_pin.pin); + config_gpio(cs_pin, LPC_IO_DIGITAL, GPIO_DIR_OUT, 1); /* Copy MISO pin info (no config, should be already configured as SPI) */ pio_copy(&(cc1101.miso_pin), miso_pin); diff --git a/include/extdrv/cc1101.h b/include/extdrv/cc1101.h index 2f7b4e7..153e32d 100644 --- a/include/extdrv/cc1101.h +++ b/include/extdrv/cc1101.h @@ -260,7 +260,7 @@ void cc1101_set_address(uint8_t address); void cc1101_set_config(uint8_t byte_addr, uint8_t value); /* 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); +void cc1101_init(uint8_t ssp_num, const struct pio* cs_pin, const struct pio* miso_pin); /* Write / send all the configuration register values to the CC1101 chip */ void cc1101_config(void); -- 2.43.0