Beispiel #1
0

static u8 idata[sizeof(odata)];

static struct spi_dev *dev;
static const struct spi_ibuf ibuf = {
	.len = sizeof(idata),
	.buf = idata,
};
static const struct spi_obuf obuf = {
	.len = sizeof(idata),
	.buf = odata,
};
/* Test config: SPI0 with CS on p0.9 */
const struct spi_cfg spi_config = {
	.gpio_cs = GPIO_NR(0,9),
	.freq= HZ / 100,
	.pol = 0,
	.phase = 0,
	.devn = 0
};

static struct spi_dev spi_device = {
	.cfg = &spi_config,
};

static struct spi_dev *dev;

static int spi_test_init(void *unused)
{
	dev = spi_create(&spi_device);
Beispiel #2
0
#include "../hw.h"

#define COM_LEN 15

int motors[18];
int saveIndex;		/* from 0 to 17, index of motors */
int frameIndex;		/* from 0 to 19, index of frames */
int portNow;            /* GPIO number of this frame */
int portLast;           /* GPIO number of last frame */
char tmp[80];		/* debug string */
int commands[COM_LEN] = {0,0,0,0,0,
			 0,0,0,0,0,
			 0,0,0,0,0};
int waitTime = 0;
static uint8_t used_gpio[18] = {
        GPIO_NR(1,9),   GPIO_NR(1,8),   GPIO_NR(1,10),
        GPIO_NR(1,11),  GPIO_NR(2,0),   GPIO_NR(2,1),
        GPIO_NR(2,2),   GPIO_NR(2,3),   GPIO_NR(2,4),
        GPIO_NR(2,5),   GPIO_NR(2,6),   GPIO_NR(2,7),
        GPIO_NR(2,8),   GPIO_NR(2,9),   GPIO_NR(2,10),
        GPIO_NR(2,11),  GPIO_NR(3,0),   GPIO_NR(3,1),
};

/* Handshake */
int spidy_main(void *unused)
{
	int found=0, i=0;
	saveIndex=0;

        /* Gpio initialization */
        gpio_init();
Beispiel #3
0
			 * 3 = + CHAR_CLOOP (no buffer read)
			 */

int frameIndex;		/* from 0 to 19, index of frames */
int portNow;		/* GPIO number of this frame */
int portLast;		/* GPIO number of last frame */
char tmp[80];		/* debug string */

int motors[18];		/* degrees copied from commands */
int commands[18] = {-1,-1,-1,-1,-1,-1,
		    -1,-1,-1,-1,-1,-1,
		    -1,-1,-1,-1,-1,-1}; /* degrees from sender */

int waitTime = 0;
static uint8_t used_gpio[18] = {
	GPIO_NR(3,1),	GPIO_NR(3,2),	GPIO_NR(3,3),	/* 00-01-02 */
	GPIO_NR(2,6),	GPIO_NR(2,7),	GPIO_NR(3,0),	/* 10-11-12 */
	GPIO_NR(2,5),	GPIO_NR(2,4),	GPIO_NR(2,3),	/* 20-21-22 */
	GPIO_NR(2,2),	GPIO_NR(2,1),	GPIO_NR(2,0),	/* 30-31-32 */
	GPIO_NR(1,3),	GPIO_NR(1,4),	GPIO_NR(1,5),	/* 40-41-42 */
	GPIO_NR(1,2),	GPIO_NR(1,1),	GPIO_NR(1,0),	/* 50-51-52 */
};

/* Handshake */
int spidy_main(void *unused)
{
	int found=0, i=0;

	/* Gpio initialization */
	gpio_init();
Beispiel #4
0
#include "includes.h"
#include "led.h"
#include "gpio.h"
#if (DEVICE_STM32_LED_EN > 0)
#define GPIO_MODULE
typedef struct{
	int			  gpio;
	BOOL		  active_low;
	struct LED_Device	  led;
}STM32LED;

#define LSW100_LED(_gpio) \
		{ .gpio = _gpio, .active_low = 1}

static STM32LED stm32_led_list[] = {
	LSW100_LED(GPIO_NR(PE,2)),
	LSW100_LED(GPIO_NR(PE,3)),
	LSW100_LED(GPIO_NR(PE,4)),
	LSW100_LED(GPIO_NR(PE,5)),
};


#define LED1 		GPIO_PORTE|GPIO_OUT_PP|GPIO_50MHZ|2
#define LED2 		GPIO_PORTE|GPIO_OUT_PP|GPIO_50MHZ|3
#define LED3 		GPIO_PORTE|GPIO_OUT_PP|GPIO_50MHZ|4
#define LED4 		GPIO_PORTE|GPIO_OUT_PP|GPIO_50MHZ|5

unsigned int mode[] = {
		LED1,
		LED2,
		LED3,