Mostly cosmetic changes from Uros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3575 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
65a6ec4693
commit
9a9ebcd417
@ -37,12 +37,12 @@
|
|||||||
* \author Uros Platise
|
* \author Uros Platise
|
||||||
* \brief STM32 Flash - Program and Data Memory
|
* \brief STM32 Flash - Program and Data Memory
|
||||||
*
|
*
|
||||||
* Provides standard flash access function, to be used also by the
|
* Provides standard flash access functions, to be used also by the
|
||||||
* drivers/mtd/progmem.c program memory flash mtd driver.
|
* drivers/mtd/progmem.c program memory flash mtd driver.
|
||||||
* The interface is to be defined in the include/nuttx/progmem.h
|
* The interface is defined in the include/nuttx/progmem.h
|
||||||
*
|
*
|
||||||
* Requirements:
|
* Requirements during write/erase operations on FLASH:
|
||||||
* - During write/erase operatoins on FLASH, HSI must be ON.
|
* - HSI must be ON.
|
||||||
* - Low Power Modes are not permitted during write/erase
|
* - Low Power Modes are not permitted during write/erase
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
#include <nuttx/progmem.h>
|
#include <nuttx/progmem.h>
|
||||||
|
|
||||||
#include <nuttx/i2c.h>
|
#include <nuttx/i2c.h>
|
||||||
#include <nuttx/sensors/st_lis331dl.h>
|
#include <nuttx/sensors/lis331dl.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -285,7 +285,7 @@ int sif_gpios_unlock(vsn_sif_state_t peripheral)
|
|||||||
* Analog Outputs
|
* Analog Outputs
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static volatile int test = 0, test_irq;
|
static volatile int test = 0, teirq;
|
||||||
|
|
||||||
|
|
||||||
static int sif_anout_isr(int irq, void *context)
|
static int sif_anout_isr(int irq, void *context)
|
||||||
@ -293,7 +293,7 @@ static int sif_anout_isr(int irq, void *context)
|
|||||||
STM32_TIM_ACKINT(vsn_sif.tim8, 0);
|
STM32_TIM_ACKINT(vsn_sif.tim8, 0);
|
||||||
|
|
||||||
test++;
|
test++;
|
||||||
test_irq = irq;
|
teirq = irq;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -531,10 +531,12 @@ int sif_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (status >= 0);
|
while (status >= 0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "erase") && argc == 3 ) {
|
else if (!strcmp(argv[1], "erase") && argc == 3 ) {
|
||||||
int page = atoi(argv[2]);
|
int page = atoi(argv[2]);
|
||||||
printf("Erase result: %d\n", up_progmem_erasepage(page) );
|
printf("Erase result: %d\n", up_progmem_erasepage(page) );
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "flash") && argc == 3 ) {
|
else if (!strcmp(argv[1], "flash") && argc == 3 ) {
|
||||||
uint16_t page = atoi(argv[2]);
|
uint16_t page = atoi(argv[2]);
|
||||||
@ -542,27 +544,28 @@ int sif_main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("Write result: %d (writing to address %xh)\n",
|
printf("Write result: %d (writing to address %xh)\n",
|
||||||
up_progmem_write( addr, "Test", 4 ), addr);
|
up_progmem_write( addr, "Test", 4 ), addr);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "i2c") && argc == 3) {
|
else if (!strcmp(argv[1], "i2c") && argc == 3) {
|
||||||
int val = atoi(argv[2]);
|
int val = atoi(argv[2]);
|
||||||
|
|
||||||
I2C_SETFREQUENCY(vsn_sif.i2c1, 100000);
|
I2C_SETFREQUENCY(vsn_sif.i2c1, 100000);
|
||||||
|
|
||||||
struct st_lis331dl_dev_s * lis = st_lis331dl_init(vsn_sif.i2c1, val);
|
struct lis331dl_dev_s * lis = lis331dl_init(vsn_sif.i2c1, val);
|
||||||
|
|
||||||
if (lis) {
|
if (lis) {
|
||||||
const struct st_lis331dl_vector_s * a;
|
const struct lis331dl_vector_s * a;
|
||||||
int i;
|
int i;
|
||||||
uint32_t time_stamp = clock_systimer();
|
uint32_t time_stamp = clock_systimer();
|
||||||
|
|
||||||
/* Set to 400 Hz : 3 = 133 Hz/axis */
|
/* Set to 400 Hz : 3 = 133 Hz/axis */
|
||||||
|
|
||||||
st_lis331dl_setconversion(lis, false, true);
|
lis331dl_setconversion(lis, false, true);
|
||||||
|
|
||||||
/* Sample some values */
|
/* Sample some values */
|
||||||
|
|
||||||
for (i=0; i<1000; ) {
|
for (i=0; i<1000; ) {
|
||||||
if ( (a = st_lis331dl_getreadings(lis)) ) {
|
if ( (a = lis331dl_getreadings(lis)) ) {
|
||||||
i++;
|
i++;
|
||||||
printf("%d %d %d\n", a->x, a->y, a->z);
|
printf("%d %d %d\n", a->x, a->y, a->z);
|
||||||
}
|
}
|
||||||
@ -574,7 +577,7 @@ int sif_main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("Time diff = %d\n", clock_systimer() - time_stamp);
|
printf("Time diff = %d\n", clock_systimer() - time_stamp);
|
||||||
|
|
||||||
st_lis331dl_deinit(lis);
|
lis331dl_deinit(lis);
|
||||||
}
|
}
|
||||||
else printf("Exit point: errno=%d\n", errno);
|
else printf("Exit point: errno=%d\n", errno);
|
||||||
|
|
||||||
|
@ -39,6 +39,6 @@ SENSOR_CSRCS =
|
|||||||
# These drivers depend on I2C support
|
# These drivers depend on I2C support
|
||||||
|
|
||||||
ifeq ($(CONFIG_I2C),y)
|
ifeq ($(CONFIG_I2C),y)
|
||||||
SENSOR_CSRCS += st_lis331dl.c
|
SENSOR_CSRCS += lis331dl.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/sensors/st_lis331dl.c
|
* drivers/sensors/lis331dl.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -47,7 +47,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/sensors/st_lis331dl.h>
|
#include <nuttx/sensors/lis331dl.h>
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* LIS331DL Internal Registers
|
* LIS331DL Internal Registers
|
||||||
@ -89,11 +89,11 @@
|
|||||||
* Private Data Types
|
* Private Data Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
struct st_lis331dl_dev_s {
|
struct lis331dl_dev_s {
|
||||||
struct i2c_dev_s * i2c;
|
struct i2c_dev_s * i2c;
|
||||||
|
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
struct st_lis331dl_vector_s a;
|
struct lis331dl_vector_s a;
|
||||||
uint8_t cr1;
|
uint8_t cr1;
|
||||||
uint8_t cr2;
|
uint8_t cr2;
|
||||||
uint8_t cr3;
|
uint8_t cr3;
|
||||||
@ -112,7 +112,7 @@ struct st_lis331dl_dev_s {
|
|||||||
* \param length when >0 it denotes read access, when <0 it denotes write access of -length
|
* \param length when >0 it denotes read access, when <0 it denotes write access of -length
|
||||||
* \return OK on success or errno is set.
|
* \return OK on success or errno is set.
|
||||||
**/
|
**/
|
||||||
int st_lis331dl_access(struct st_lis331dl_dev_s * dev, uint8_t subaddr, uint8_t *buf, int length)
|
int lis331dl_access(struct lis331dl_dev_s * dev, uint8_t subaddr, uint8_t *buf, int length)
|
||||||
{
|
{
|
||||||
uint16_t flags = 0;
|
uint16_t flags = 0;
|
||||||
int retval;
|
int retval;
|
||||||
@ -170,9 +170,9 @@ int st_lis331dl_access(struct st_lis331dl_dev_s * dev, uint8_t subaddr, uint8_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_readregs(struct st_lis331dl_dev_s * dev)
|
int lis331dl_readregs(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, 3) != 3) return ERROR;
|
if (lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, 3) != 3) return ERROR;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,24 +181,24 @@ int st_lis331dl_readregs(struct st_lis331dl_dev_s * dev)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t address)
|
struct lis331dl_dev_s * lis331dl_init(struct i2c_dev_s * i2c, uint16_t address)
|
||||||
{
|
{
|
||||||
struct st_lis331dl_dev_s * dev;
|
struct lis331dl_dev_s * dev;
|
||||||
uint8_t retval;
|
uint8_t retval;
|
||||||
|
|
||||||
ASSERT(i2c);
|
ASSERT(i2c);
|
||||||
ASSERT(address);
|
ASSERT(address);
|
||||||
|
|
||||||
if ( (dev = kmalloc( sizeof(struct st_lis331dl_dev_s) )) == NULL )
|
if ( (dev = kmalloc( sizeof(struct lis331dl_dev_s) )) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(dev, 0, sizeof(struct st_lis331dl_dev_s));
|
memset(dev, 0, sizeof(struct lis331dl_dev_s));
|
||||||
dev->i2c = i2c;
|
dev->i2c = i2c;
|
||||||
dev->address = address;
|
dev->address = address;
|
||||||
|
|
||||||
/* Probe device */
|
/* Probe device */
|
||||||
|
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_WHOAMI, &retval, 1) > 0) {
|
if (lis331dl_access(dev, ST_LIS331DL_WHOAMI, &retval, 1) > 0) {
|
||||||
|
|
||||||
/* Check chip identification, in the future several more compatible parts
|
/* Check chip identification, in the future several more compatible parts
|
||||||
* may be added here.
|
* may be added here.
|
||||||
@ -208,7 +208,7 @@ struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t add
|
|||||||
|
|
||||||
/* Copy LIS331DL registers to our private structure and power-up device */
|
/* Copy LIS331DL registers to our private structure and power-up device */
|
||||||
|
|
||||||
if (st_lis331dl_readregs(dev)==OK && st_lis331dl_powerup(dev)==OK) {
|
if (lis331dl_readregs(dev)==OK && lis331dl_powerup(dev)==OK) {
|
||||||
|
|
||||||
/* Normal exit point */
|
/* Normal exit point */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@ -232,52 +232,52 @@ struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t add
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_deinit(struct st_lis331dl_dev_s * dev)
|
int lis331dl_deinit(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
ASSERT(dev);
|
ASSERT(dev);
|
||||||
|
|
||||||
st_lis331dl_powerdown(dev);
|
lis331dl_powerdown(dev);
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_powerup(struct st_lis331dl_dev_s * dev)
|
int lis331dl_powerup(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
dev->cr1 = ST_LIS331DL_CR1_PD |
|
dev->cr1 = ST_LIS331DL_CR1_PD |
|
||||||
ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
||||||
dev->cr2 = 0;
|
dev->cr2 = 0;
|
||||||
dev->cr3 = 0;
|
dev->cr3 = 0;
|
||||||
|
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -3) == 3) return OK;
|
if (lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -3) == 3) return OK;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_powerdown(struct st_lis331dl_dev_s * dev)
|
int lis331dl_powerdown(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
dev->cr1 = ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
dev->cr1 = ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
||||||
dev->cr2 = 0;
|
dev->cr2 = 0;
|
||||||
dev->cr3 = 0;
|
dev->cr3 = 0;
|
||||||
|
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -3) == 3) return OK;
|
if (lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -3) == 3) return OK;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_setconversion(struct st_lis331dl_dev_s * dev, bool full, bool fast)
|
int lis331dl_setconversion(struct lis331dl_dev_s * dev, bool full, bool fast)
|
||||||
{
|
{
|
||||||
dev->cr1 = ST_LIS331DL_CR1_PD |
|
dev->cr1 = ST_LIS331DL_CR1_PD |
|
||||||
(full ? ST_LIS331DL_CR1_FS : 0) | (fast ? ST_LIS331DL_CR1_DR : 0) |
|
(full ? ST_LIS331DL_CR1_FS : 0) | (fast ? ST_LIS331DL_CR1_DR : 0) |
|
||||||
ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN;
|
||||||
|
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -1) == 1) return OK;
|
if (lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, -1) == 1) return OK;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_getprecision(struct st_lis331dl_dev_s * dev)
|
int lis331dl_getprecision(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
if (dev->cr1 & ST_LIS331DL_CR1_FS)
|
if (dev->cr1 & ST_LIS331DL_CR1_FS)
|
||||||
return 9200/127; /* typ. 9.2g full scale */
|
return 9200/127; /* typ. 9.2g full scale */
|
||||||
@ -285,7 +285,7 @@ int st_lis331dl_getprecision(struct st_lis331dl_dev_s * dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int st_lis331dl_getsamplerate(struct st_lis331dl_dev_s * dev)
|
int lis331dl_getsamplerate(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
if (dev->cr1 & ST_LIS331DL_CR1_DR)
|
if (dev->cr1 & ST_LIS331DL_CR1_DR)
|
||||||
return 400;
|
return 400;
|
||||||
@ -293,13 +293,13 @@ int st_lis331dl_getsamplerate(struct st_lis331dl_dev_s * dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct st_lis331dl_vector_s * st_lis331dl_getreadings(struct st_lis331dl_dev_s * dev)
|
const struct lis331dl_vector_s * lis331dl_getreadings(struct lis331dl_dev_s * dev)
|
||||||
{
|
{
|
||||||
uint8_t retval[7];
|
uint8_t retval[7];
|
||||||
|
|
||||||
ASSERT(dev);
|
ASSERT(dev);
|
||||||
|
|
||||||
if (st_lis331dl_access(dev, ST_LIS331DL_STATUS_REG, retval, 7) == 7) {
|
if (lis331dl_access(dev, ST_LIS331DL_STATUS_REG, retval, 7) == 7) {
|
||||||
|
|
||||||
/* If result is not yet ready, return NULL */
|
/* If result is not yet ready, return NULL */
|
||||||
|
|
@ -37,5 +37,5 @@ WIRELESS_ASRCS =
|
|||||||
WIRELESS_CSRCS =
|
WIRELESS_CSRCS =
|
||||||
|
|
||||||
ifeq ($(CONFIG_WIRELESS),y)
|
ifeq ($(CONFIG_WIRELESS),y)
|
||||||
WIRELESS_CSRCS += chipcon_cc1101.c
|
WIRELESS_CSRCS += cc1101.c
|
||||||
endif
|
endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/wireless/chipcon_cc1101.c
|
* drivers/wireless/cc1101.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/wireless/chipcon_cc1101.h>
|
#include <nuttx/wireless/cc1101.h>
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@ -351,7 +351,7 @@
|
|||||||
* Private Data Types
|
* Private Data Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
struct chipcon_c1101_rfsettings_s {
|
struct c1101_rfsettings_s {
|
||||||
uint8_t FSCTRL1; /* Frequency synthesizer control. */
|
uint8_t FSCTRL1; /* Frequency synthesizer control. */
|
||||||
uint8_t IOCFG0; /* GDO0 output pin configuration */
|
uint8_t IOCFG0; /* GDO0 output pin configuration */
|
||||||
uint8_t FSCTRL0; /* Frequency synthesizer control. */
|
uint8_t FSCTRL0; /* Frequency synthesizer control. */
|
||||||
@ -389,9 +389,9 @@ struct chipcon_c1101_rfsettings_s {
|
|||||||
uint8_t PKTLEN; /* Packet length. */
|
uint8_t PKTLEN; /* Packet length. */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chipcon_cc1101_dev_s {
|
struct cc1101_dev_s {
|
||||||
struct spi_dev_s * spi;
|
struct spi_dev_s * spi;
|
||||||
struct chipcon_c1101_rfsettings_s * settings;
|
struct c1101_rfsettings_s * settings;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ struct chipcon_cc1101_dev_s {
|
|||||||
* \param length when >0 it denotes read access, when <0 it denotes write access of -length
|
* \param length when >0 it denotes read access, when <0 it denotes write access of -length
|
||||||
* \return OK on success or errno is set.
|
* \return OK on success or errno is set.
|
||||||
**/
|
**/
|
||||||
int chipcon_cc1101_access(struct chipcon_cc1101_dev_s * dev, uint8_t subaddr, uint8_t *buf, int length)
|
int cc1101_access(struct cc1101_dev_s * dev, uint8_t subaddr, uint8_t *buf, int length)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -427,7 +427,7 @@ int chipcon_cc1101_access(struct chipcon_cc1101_dev_s * dev, uint8_t subaddr, ui
|
|||||||
* its callback, and it is up to peripheral to find, whether the cause
|
* its callback, and it is up to peripheral to find, whether the cause
|
||||||
* of EXTI ISR was itself.
|
* of EXTI ISR was itself.
|
||||||
**/
|
**/
|
||||||
void chipcon_cc1101_eventcb(void)
|
void cc1101_eventcb(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ void chipcon_cc1101_eventcb(void)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct chipcon_cc1101_dev_s * chipcon_cc1101_init(struct spi_dev_s * spi)
|
struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi)
|
||||||
{
|
{
|
||||||
/* Powerup or wake-up, if it was previously set into some power-down state */
|
/* Powerup or wake-up, if it was previously set into some power-down state */
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ struct chipcon_cc1101_dev_s * chipcon_cc1101_init(struct spi_dev_s * spi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_deinit(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_deinit(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
/* Power down chip, possibly in some inactive state */
|
/* Power down chip, possibly in some inactive state */
|
||||||
|
|
||||||
@ -460,55 +460,55 @@ int chipcon_cc1101_deinit(struct chipcon_cc1101_dev_s * dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_setgdo(struct chipcon_cc1101_dev_s * dev, uint8_t pin, uint8_t function)
|
int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_setrf(struct chipcon_cc1101_dev_s * dev, uint32_t frequency, int modulation)
|
int cc1101_setrf(struct cc1101_dev_s * dev, uint32_t frequency, int modulation)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_read(struct chipcon_cc1101_dev_s * dev, uint8_t * data, size_t size)
|
int cc1101_read(struct cc1101_dev_s * dev, uint8_t * data, size_t size)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_write(struct chipcon_cc1101_dev_s * dev, const uint8_t * data, size_t size)
|
int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * data, size_t size)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_listen(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_listen(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_send(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_send(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_idle(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_idle(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_powerup(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_powerup(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int chipcon_cc1101_powerdown(struct chipcon_cc1101_dev_s * dev)
|
int cc1101_powerdown(struct cc1101_dev_s * dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -41,6 +41,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/sensors/st_lis331dl.h
|
* include/nuttx/sensors/lis331dl.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -39,8 +39,8 @@
|
|||||||
* \brief ST LIS331DL I2C Device Driver
|
* \brief ST LIS331DL I2C Device Driver
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __INCLUDE_NUTTX_SENSORS_ST_LIS331DL_H
|
#ifndef __INCLUDE_NUTTX_SENSORS_LIS331DL_H
|
||||||
#define __INCLUDE_NUTTX_SENSORS_ST_LIS331DL_H
|
#define __INCLUDE_NUTTX_SENSORS_LIS331DL_H
|
||||||
|
|
||||||
#include <nuttx/i2c.h>
|
#include <nuttx/i2c.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@ -64,9 +64,9 @@ extern "C" {
|
|||||||
* Public Data Types
|
* Public Data Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
struct st_lis331dl_dev_s;
|
struct lis331dl_dev_s;
|
||||||
|
|
||||||
struct st_lis331dl_vector_s {
|
struct lis331dl_vector_s {
|
||||||
int8_t x, y, z;
|
int8_t x, y, z;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,21 +86,21 @@ struct st_lis331dl_vector_s {
|
|||||||
* - EFAULT: When there is no device at given address.
|
* - EFAULT: When there is no device at given address.
|
||||||
* - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
|
* - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
|
||||||
**/
|
**/
|
||||||
EXTERN struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t address);
|
EXTERN struct lis331dl_dev_s * lis331dl_init(struct i2c_dev_s * i2c, uint16_t address);
|
||||||
|
|
||||||
/** Deinitialize ST LIS331DL Chip
|
/** Deinitialize ST LIS331DL Chip
|
||||||
*
|
*
|
||||||
* \param dev Device to LIS331DL device structure, as returned by the st_lis331dl_init()
|
* \param dev Device to LIS331DL device structure, as returned by the lis331dl_init()
|
||||||
* \return OK On success
|
* \return OK On success
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
EXTERN int st_lis331dl_deinit(struct st_lis331dl_dev_s * dev);
|
EXTERN int lis331dl_deinit(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
/** Power up device, start conversion */
|
/** Power up device, start conversion */
|
||||||
EXTERN int st_lis331dl_powerup(struct st_lis331dl_dev_s * dev);
|
EXTERN int lis331dl_powerup(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
/** Power down device, stop conversion */
|
/** Power down device, stop conversion */
|
||||||
EXTERN int st_lis331dl_powerdown(struct st_lis331dl_dev_s * dev);
|
EXTERN int lis331dl_powerdown(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
/** Configure conversion
|
/** Configure conversion
|
||||||
*
|
*
|
||||||
@ -109,19 +109,19 @@ EXTERN int st_lis331dl_powerdown(struct st_lis331dl_dev_s * dev);
|
|||||||
* \param fast When set, conversion operates at 400 Hz, otherwise at 100 Hz
|
* \param fast When set, conversion operates at 400 Hz, otherwise at 100 Hz
|
||||||
* \return OK on success or errno is set
|
* \return OK on success or errno is set
|
||||||
**/
|
**/
|
||||||
EXTERN int st_lis331dl_setconversion(struct st_lis331dl_dev_s * dev, bool full, bool fast);
|
EXTERN int lis331dl_setconversion(struct lis331dl_dev_s * dev, bool full, bool fast);
|
||||||
|
|
||||||
/** Get precision
|
/** Get precision
|
||||||
*
|
*
|
||||||
* \return Precision of 1 LSB in terms of unit [mg]
|
* \return Precision of 1 LSB in terms of unit [mg]
|
||||||
**/
|
**/
|
||||||
EXTERN int st_lis331dl_getprecision(struct st_lis331dl_dev_s * dev);
|
EXTERN int lis331dl_getprecision(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
/** Get sample rate
|
/** Get sample rate
|
||||||
*
|
*
|
||||||
* \return Sample rate in unit of [Hz]
|
* \return Sample rate in unit of [Hz]
|
||||||
**/
|
**/
|
||||||
EXTERN int st_lis331dl_getsamplerate(struct st_lis331dl_dev_s * dev);
|
EXTERN int lis331dl_getsamplerate(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
/** Get readings, updates internal data structure
|
/** Get readings, updates internal data structure
|
||||||
*
|
*
|
||||||
@ -130,8 +130,7 @@ EXTERN int st_lis331dl_getsamplerate(struct st_lis331dl_dev_s * dev);
|
|||||||
* If data is not yet ready to be read from the LIS331 then errno is set to EAGAIN otherwise
|
* If data is not yet ready to be read from the LIS331 then errno is set to EAGAIN otherwise
|
||||||
* errno is set by I2C_TRANSFER().
|
* errno is set by I2C_TRANSFER().
|
||||||
*/
|
*/
|
||||||
EXTERN const struct st_lis331dl_vector_s * st_lis331dl_getreadings(struct st_lis331dl_dev_s * dev);
|
EXTERN const struct lis331dl_vector_s * lis331dl_getreadings(struct lis331dl_dev_s * dev);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@ -140,5 +139,4 @@ EXTERN const struct st_lis331dl_vector_s * st_lis331dl_getreadings(struct st_lis
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __INCLUDE_NUTTX_SENSORS_ST_LIS331DL_H */
|
#endif /* __INCLUDE_NUTTX_SENSORS_LIS331DL_H */
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/wireless/chipcon_cc1101.h
|
* include/nuttx/wireless/cc1101.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -39,8 +39,8 @@
|
|||||||
* \brief Chipcon CC1101 Device Driver
|
* \brief Chipcon CC1101 Device Driver
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H
|
#ifndef __INCLUDE_NUTTX_WIRELESS_CC1101_H
|
||||||
#define __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H
|
#define __INCLUDE_NUTTX_WIRELESS_CC1101_H
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/spi.h>
|
#include <nuttx/spi.h>
|
||||||
@ -67,7 +67,7 @@ extern "C" {
|
|||||||
* Public Data Types
|
* Public Data Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
struct chipcon_cc1101_dev_s;
|
struct cc1101_dev_s;
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@ -84,24 +84,24 @@ struct chipcon_cc1101_dev_s;
|
|||||||
* - EFAULT: When there is no device
|
* - EFAULT: When there is no device
|
||||||
* - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
|
* - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
|
||||||
**/
|
**/
|
||||||
EXTERN struct chipcon_cc1101_dev_s * chipcon_cc1101_init(struct spi_dev_s * spi);
|
EXTERN struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi);
|
||||||
|
|
||||||
/** Deinitialize Chipcon CC1101 Chip
|
/** Deinitialize Chipcon CC1101 Chip
|
||||||
*
|
*
|
||||||
* \param dev Device to CC1101 device structure, as returned by the chipcon_cc1101_init()
|
* \param dev Device to CC1101 device structure, as returned by the cc1101_init()
|
||||||
* \return OK On success
|
* \return OK On success
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
EXTERN int chipcon_cc1101_deinit(struct chipcon_cc1101_dev_s * dev);
|
EXTERN int cc1101_deinit(struct cc1101_dev_s * dev);
|
||||||
|
|
||||||
/** Power up device, start conversion */
|
/** Power up device, start conversion */
|
||||||
EXTERN int chipcon_cc1101_powerup(struct chipcon_cc1101_dev_s * dev);
|
EXTERN int cc1101_powerup(struct cc1101_dev_s * dev);
|
||||||
|
|
||||||
/** Power down device, stop conversion */
|
/** Power down device, stop conversion */
|
||||||
EXTERN int chipcon_cc1101_powerdown(struct chipcon_cc1101_dev_s * dev);
|
EXTERN int cc1101_powerdown(struct cc1101_dev_s * dev);
|
||||||
|
|
||||||
/** Set Multi Purpose Output Function */
|
/** Set Multi Purpose Output Function */
|
||||||
EXTERN int chipcon_cc1101_setgdo(struct chipcon_cc1101_dev_s * dev, uint8_t pin, uint8_t function);
|
EXTERN int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function);
|
||||||
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@ -109,5 +109,4 @@ EXTERN int chipcon_cc1101_setgdo(struct chipcon_cc1101_dev_s * dev, uint8_t pin,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H */
|
#endif /* __INCLUDE_NUTTX_WIRELESS_CC1101_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user