From ddac0aa483dd5f7bca31b0c042949eca370a8fdc Mon Sep 17 00:00:00 2001 From: Sylvain Miermont Date: Thu, 8 Aug 2013 15:49:31 +0200 Subject: Beta 3 - modified 'native' SPI module to align with the way resource pointers are managed in 'ftdi' variant (void pointers) - better check of channel frequency + bandwidth vs. authorized band - improved Makefile --- loragw_hal/inc/loragw_hal.h | 3 ++- loragw_hal/inc/loragw_spi.h | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'loragw_hal/inc') diff --git a/loragw_hal/inc/loragw_hal.h b/loragw_hal/inc/loragw_hal.h index feecf5c..eeccaf2 100644 --- a/loragw_hal/inc/loragw_hal.h +++ b/loragw_hal/inc/loragw_hal.h @@ -43,7 +43,8 @@ Description: #define LGW_PKT_FIFO_SIZE 8 #define LGW_DATABUFF_SIZE 1024 -#define LGW_RF_BANDWIDTH 800000 +#define LGW_RADIO_BW 500000 /* bandwidth of the radio */ +#define LGW_REF_BW 125000 /* typical bandwidth of data channel */ /* SX1275 frequency setting : diff --git a/loragw_hal/inc/loragw_spi.h b/loragw_hal/inc/loragw_spi.h index 3ad857f..68d8bcf 100644 --- a/loragw_hal/inc/loragw_spi.h +++ b/loragw_hal/inc/loragw_spi.h @@ -35,57 +35,57 @@ Description: /** @brief Lora gateway SPI setup (configure I/O and peripherals) -@param spi_device pointer to SPI file descriptor to be written +@param spi_target_ptr pointer on a generic pointer to SPI target (implementation dependant) @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_open(int *spi_device); +int lgw_spi_open(void **spi_target_ptr); /** @brief Lora gateway SPI close -@param spi_device SPI file descriptor of the port to close +@param spi_target generic pointer to SPI target (implementation dependant) @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_close(int spi_device); +int lgw_spi_close(void *spi_target); /** @brief Lora gateway SPI single-byte write -@param spi_device SPI file descriptor of the target port +@param spi_target generic pointer to SPI target (implementation dependant) @param address 7-bit register address @param data data byte to write @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_w(int spi_device, uint8_t address, uint8_t data); +int lgw_spi_w(void *spi_target, uint8_t address, uint8_t data); /** @brief Lora gateway SPI single-byte read -@param spi_device SPI file descriptor of the target port +@param spi_target generic pointer to SPI target (implementation dependant) @param address 7-bit register address @param data data byte to write @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_r(int spi_device, uint8_t address, uint8_t *data); +int lgw_spi_r(void *spi_target, uint8_t address, uint8_t *data); /** @brief Lora gateway SPI burst (multiple-byte) write -@param spi_device SPI file descriptor of the target port +@param spi_target generic pointer to SPI target (implementation dependant) @param address 7-bit register address @param data pointer to byte array that will be sent to the Lora gateway @param size size of the transfer, in byte(s) @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_wb(int spi_device, uint8_t address, uint8_t *data, uint16_t size); +int lgw_spi_wb(void *spi_target, uint8_t address, uint8_t *data, uint16_t size); /** @brief Lora gateway SPI burst (multiple-byte) read -@param spi_device SPI file descriptor of the target port +@param spi_target generic pointer to SPI target (implementation dependant) @param address 7-bit register address @param data pointer to byte array that will be written from the Lora gateway @param size size of the transfer, in byte(s) @return status of register operation (LGW_SPI_SUCCESS/LGW_SPI_ERROR) */ -int lgw_spi_rb(int spi_device, uint8_t address, uint8_t *data, uint16_t size); +int lgw_spi_rb(void *spi_target, uint8_t address, uint8_t *data, uint16_t size); #endif -- cgit v1.2.3