Beispiel #1
0
	Mode_GPIO,
	Mode_PWM
} internal_mode_t;

// GPIO control information
static struct {
	const char *name;       // e.g. "P8.15"
	internal_mode_t mode;   // highest Mode_XXX possible
	internal_mode_t active; // Mode_XXX current
	int pwm_chip;           // pwmchipN numeric value
	int pwm_channel;        // channel number
	int pwm_state;          // index of a state file for multiplexor control
	int fd;                 // open fd to value/duty_cycle file for fast access
} gpio_info[] = {
	// Connector P8
	MAKE_PIN("P8.03", 1, 6),   //  GPIO1_6
	MAKE_PIN("P8.04", 1, 7),   //  GPIO1_7
	MAKE_PIN("P8.05", 1, 2),   //  GPIO1_2
	MAKE_PIN("P8.06", 1, 3),   //  GPIO1_3
	MAKE_PIN("P8.07", 2, 2),   //  GPIO2_2   TIMER4
	MAKE_PIN("P8.08", 2, 3),   //  GPIO2_3   TIMER7
	MAKE_PIN("P8.09", 2, 5),   //  GPIO2_5   TIMER5
	MAKE_PIN("P8.10", 2, 4),   //  GPIO2_4   TIMER6
	MAKE_PIN("P8.11", 1, 13),  //  GPIO1_13
	MAKE_PIN("P8.12", 1, 12),  //  GPIO1_12
	MAKE_PIN("P8.13", 0, 23),  //  GPIO0_23  EHRPWM2B
	MAKE_PIN("P8.14", 0, 26),  //  GPIO0_26
	MAKE_PIN("P8.15", 1, 15),  //  GPIO1_15
	MAKE_PIN("P8.16", 1, 14),  //  GPIO1_14
	MAKE_PIN("P8.17", 0, 27),  //  GPIO0_27
	MAKE_PIN("P8.18", 2, 1),   //  GPIO2_1
Beispiel #2
0


#define NUM_PINS   50
const uint16_t _vhalpinnums = NUM_PINS;

#define PA PORT_A
#define PB PORT_B
#define PC PORT_C
#define PD PORT_D
#define PH PORT_H

PinStatus _vhalpinstatus[NUM_PINS];

const PinInfo const _vhalpinmap[] STORED = {
    /* D0   */ MAKE_PIN(PA, 3,  HAS_EXT | HAS_ATM | HAS_SER | HAS_ADC),
    /* D1   */ MAKE_PIN(PA, 2,  HAS_EXT | HAS_ATM | HAS_SER | HAS_ADC),
    /* D2   */ MAKE_PIN(PA, 10, HAS_EXT | HAS_ATM | HAS_SER),
    /* D3   */ MAKE_PIN(PB, 3, HAS_EXT | HAS_ATM | HAS_I2C | HAS_SPI),
    /* D4   */ MAKE_PIN(PB, 5, HAS_EXT | HAS_ATM | HAS_SPI),
    /* D5   */ MAKE_PIN(PB, 4, HAS_EXT | HAS_ATM | HAS_I2C | HAS_SPI),
    /* D6   */ MAKE_PIN(PB, 10, HAS_EXT | HAS_ATM | HAS_I2C),
    /* D7   */ MAKE_PIN(PA, 8, HAS_EXT | HAS_ATM | HAS_I2C),
    /* D8   */ MAKE_PIN(PA, 9, HAS_EXT | HAS_ATM | HAS_SER),
    /* D9   */ MAKE_PIN(PC, 7, HAS_EXT | HAS_ATM | HAS_SER),
    /* D10  */ MAKE_PIN(PB, 6, HAS_EXT | HAS_ATM | HAS_SER | HAS_I2C),
    /* D11  */ MAKE_PIN(PA, 7, HAS_EXT | HAS_PWM | HAS_ADC | HAS_SPI),
    /* D12  */ MAKE_PIN(PA, 6, HAS_EXT | HAS_ATM | HAS_ADC | HAS_SPI),
    /* D13  */ MAKE_PIN(PA, 5, HAS_EXT | HAS_ATM | HAS_ADC | HAS_SPI),
    /* D14  */ MAKE_PIN(PB, 9, HAS_EXT | HAS_ATM | HAS_I2C),
    /* D15  */ MAKE_PIN(PB, 8, HAS_EXT | HAS_ATM | HAS_I2C),