本文整理汇总了C++中PIO_Configure函数的典型用法代码示例。如果您正苦于以下问题:C++ PIO_Configure函数的具体用法?C++ PIO_Configure怎么用?C++ PIO_Configure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PIO_Configure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SensorsTestInit
void SensorsTestInit()
{
char pinDirection = 0;
int i;
PIO_Configure(aDigitalOuts, PIO_LISTSIZE(aDigitalOuts));
PIO_Configure(digitalIns, PIO_LISTSIZE(digitalIns));
PIO_Configure(sensorsPower, PIO_LISTSIZE(sensorsPower));
PMC_EnablePeripheral(AT91C_ID_PIOB);
PMC_EnablePeripheral(AT91C_ID_PIOA);
SelectAng0(); // select analog port 0 to be mesured instead of BattVoltage
SensorPowerOn(); // turn on the Vcc line
if(PMC_IsPeriphEnabled(AT91C_ID_TWI) == 0){
PIO_Configure(twiPortPins, PIO_LISTSIZE(twiPortPins));
PMC_EnablePeripheral(AT91C_ID_TWI);
TWI_ConfigureMaster(AT91C_BASE_TWI,TWCK,MCK);
}
// set all pins on pullup chip to output
WritePullupData(0x00,&pinDirection,1);
WritePullupData(0x01,&pinDirection,1);
for(i = 0;i < 8;i++){
if(i>1) AnalogPullup(i,0); // disable Analog pullups for output test
DigitalPullup(i,1); // enable all digital pullups
}
}
示例2: PIO_Configure
//------------------------------------------------------------------------------
void SdSpi::begin() {
PIO_Configure(
g_APinDescription[PIN_SPI_MOSI].pPort,
g_APinDescription[PIN_SPI_MOSI].ulPinType,
g_APinDescription[PIN_SPI_MOSI].ulPin,
g_APinDescription[PIN_SPI_MOSI].ulPinConfiguration);
PIO_Configure(
g_APinDescription[PIN_SPI_MISO].pPort,
g_APinDescription[PIN_SPI_MISO].ulPinType,
g_APinDescription[PIN_SPI_MISO].ulPin,
g_APinDescription[PIN_SPI_MISO].ulPinConfiguration);
PIO_Configure(
g_APinDescription[PIN_SPI_SCK].pPort,
g_APinDescription[PIN_SPI_SCK].ulPinType,
g_APinDescription[PIN_SPI_SCK].ulPin,
g_APinDescription[PIN_SPI_SCK].ulPinConfiguration);
pmc_enable_periph_clk(ID_SPI0);
#if USE_SAM3X_DMAC
pmc_enable_periph_clk(ID_DMAC);
dmac_disable();
DMAC->DMAC_GCFG = DMAC_GCFG_ARB_CFG_FIXED;
dmac_enable();
#if USE_SAM3X_BUS_MATRIX_FIX
MATRIX->MATRIX_WPMR = 0x4d415400;
MATRIX->MATRIX_MCFG[1] = 1;
MATRIX->MATRIX_MCFG[2] = 1;
MATRIX->MATRIX_SCFG[0] = 0x01000010;
MATRIX->MATRIX_SCFG[1] = 0x01000010;
MATRIX->MATRIX_SCFG[7] = 0x01000010;
#endif // USE_SAM3X_BUS_MATRIX_FIX
#endif // USE_SAM3X_DMAC
}
示例3: PIO_Configure
// hardware SPI
void HAL::spiBegin()
{
// Configre SPI pins
PIO_Configure(
g_APinDescription[SCK_PIN].pPort,
g_APinDescription[SCK_PIN].ulPinType,
g_APinDescription[SCK_PIN].ulPin,
g_APinDescription[SCK_PIN].ulPinConfiguration);
PIO_Configure(
g_APinDescription[MOSI_PIN].pPort,
g_APinDescription[MOSI_PIN].ulPinType,
g_APinDescription[MOSI_PIN].ulPin,
g_APinDescription[MOSI_PIN].ulPinConfiguration);
PIO_Configure(
g_APinDescription[MISO_PIN].pPort,
g_APinDescription[MISO_PIN].ulPinType,
g_APinDescription[MISO_PIN].ulPin,
g_APinDescription[MISO_PIN].ulPinConfiguration);
// set master mode, peripheral select, fault detection
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR |
SPI_MR_MODFDIS | SPI_MR_PS);
SPI_Enable(SPI0);
PIO_Configure(
g_APinDescription[SPI_PIN].pPort,
g_APinDescription[SPI_PIN].ulPinType,
g_APinDescription[SPI_PIN].ulPin,
g_APinDescription[SPI_PIN].ulPinConfiguration);
spiInit(1);
}
示例4: pmc_enable_periph_clk
/*************************************************************************
Initialization of the I2C bus interface. Need to be called only once
*************************************************************************/
void HAL::i2cInit(unsigned long clockSpeedHz)
{
// enable TWI
pmc_enable_periph_clk(TWI_ID);
// Configure pins
#if SDA_PIN >= 0
PIO_Configure(g_APinDescription[SDA_PIN].pPort,
g_APinDescription[SDA_PIN].ulPinType,
g_APinDescription[SDA_PIN].ulPin,
g_APinDescription[SDA_PIN].ulPinConfiguration);
#endif
#if SCL_PIN >= 0
PIO_Configure(g_APinDescription[SCL_PIN].pPort,
g_APinDescription[SCL_PIN].ulPinType,
g_APinDescription[SCL_PIN].ulPin,
g_APinDescription[SCL_PIN].ulPinConfiguration);
#endif
/*
// Set to Master mode with known state
TWI_INTERFACE->TWI_CR = TWI_CR_SVEN;
TWI_INTERFACE->TWI_CR = TWI_CR_SWRST;
//TWI_INTERFACE->TWI_RHR; // no action???
TWI_INTERFACE->TWI_IMR = 0;
TWI_INTERFACE->TWI_CR = TWI_CR_SVDIS;
TWI_INTERFACE->TWI_CR = TWI_CR_MSDIS;
TWI_INTERFACE->TWI_CR = TWI_CR_MSEN; */
// Set to Master mode with known state
TWI_INTERFACE->TWI_CR = TWI_CR_SWRST;// Reset
TWI_INTERFACE->TWI_CR = TWI_CR_SVDIS;// Slave disable
TWI_INTERFACE->TWI_CR = TWI_CR_MSEN; //Master enable
i2cSetClockspeed(clockSpeedHz);
}
示例5: AccelInit
unsigned char AccelInit(void)
{
PIO_Configure(accIntPins, PIO_LISTSIZE(accIntPins));
if(PMC_IsPeriphEnabled(AT91C_ID_TWI) == 0){
PIO_Configure(twiPins, PIO_LISTSIZE(twiPins));
PMC_EnablePeripheral(AT91C_ID_TWI);
TWI_ConfigureMaster(AT91C_BASE_TWI,TWCK,MCK);
}
usleep(10000);
#ifdef STACCEL
// ST Accelerometer
char setup[4];
setup[0] = (1<<5)|(2<<3)|7; // Normal power, data rate = 400Hz, ZYX axis enabled
setup[1] = 0; // Do not add filter stuff
setup[2] = (2<<0); // Data ready interrupt on INT 2 pad
setup[3] = (0<<4); // do update between reads, and set scale to +/- 2g's
WriteAccelData(0x20|(1<<7),setup,4);
#else
// Freescale Accelerometer
//AccelCalibration();
AccelSetScale(2);
AccelSetCalibration();
#endif
SetPitCallback(AccelCallback,3);
return 0;
}
示例6: glcd_init
//---------------------------
void glcd_init(void)
{
unsigned int tcmr,tfmr;
unsigned char i;
PIO_Configure(GLcdpins,PIO_LISTSIZE(GLcdpins));
PIO_Configure(sscPins, PIO_LISTSIZE(sscPins));
PIO_Set(&GLcdpins[3]);
PIO_Set(&GLcdpins[4]);
SSC_Configure(AT91C_BASE_SSC,AT91C_ID_SSC,500000,BOARD_MCK);
tcmr=AT91C_SSC_CKS_TK|AT91C_SSC_CKO_DATA_TX|AT91C_SSC_START_CONTINOUS;
tfmr=SSC_DATLEN(8)|SSC_DATNB(15)|SSC_FSLEN(16)|AT91C_SSC_FSOS_LOW|AT91C_SSC_FSDEN ;
SSC_ConfigureTransmitter(AT91C_BASE_SSC,tcmr,tfmr);
SSC_EnableTransmitter(AT91C_BASE_SSC);
PIO_Set(&GLcdpins[5]);
//PIO_Clear(&GLcdpins[5]);
for(i = 0; i < 3; i++);
GLCD_WriteCommand((DISPLAY_ON_CMD | ON), i);
}
示例7: _ILI9488_Spi_HW_Initialize
/**
* \brief ILI9488 Hardware Initialization for SPI/SMC LCD.
*/
static void _ILI9488_Spi_HW_Initialize(void)
{
/* Pin configurations */
PIO_Configure(&lcd_spi_reset_pin, 1);
PIO_Configure(&lcd_spi_cds_pin, 1);
PIO_Configure(lcd_pins, PIO_LISTSIZE(lcd_pins));
PIO_Configure(&lcd_spi_pwm_pin, 1);
/* Enable PWM peripheral clock */
PMC_EnablePeripheral(ID_PWM0);
PMC_EnablePeripheral(ID_SPI0);
/* Set clock A and clock B */
// set for 14.11 KHz for CABC control
//mode = PWM_CLK_PREB(0x0A) | (PWM_CLK_DIVB(110)) |
//PWM_CLK_PREA(0x0A) | (PWM_CLK_DIVA(110));
PWMC_ConfigureClocks(PWM0, 14200, 0, BOARD_MCK);
/* Configure PWM channel 1 for LED0 */
PWMC_DisableChannel(PWM0, CHANNEL_PWM_LCD);
PWMC_ConfigureChannel(PWM0, CHANNEL_PWM_LCD, PWM_CMR_CPRE_CLKA, 0,
PWM_CMR_CPOL);
PWMC_SetPeriod(PWM0, CHANNEL_PWM_LCD, 16);
PWMC_SetDutyCycle(PWM0, CHANNEL_PWM_LCD, 8);
PWMC_EnableChannel(PWM0, CHANNEL_PWM_LCD);
SPI_Configure(ILI9488_SPI, ID_SPI0, (SPI_MR_MSTR | SPI_MR_MODFDIS
| SPI_PCS(SMC_EBI_LCD_CS)));
SPI_ConfigureNPCS(ILI9488_SPI,
SMC_EBI_LCD_CS,
SPI_CSR_CPOL | SPI_CSR_BITS_8_BIT | SPI_DLYBS(6, BOARD_MCK)
| SPI_DLYBCT(100, BOARD_MCK) | SPI_SCBR(20000000, BOARD_MCK));
SPI_Enable(ILI9488_SPI);
}
示例8: ADS7843_Initialize
/**
* \brief Initialization of the SPI for communication with ADS7843 component.
*/
extern void ADS7843_Initialize( void )
{
volatile uint32_t uDummy;
/* Configure pins */
PIO_Configure(pinsSPI, PIO_LISTSIZE(pinsSPI));
PIO_Configure(pinBusy, PIO_LISTSIZE(pinBusy));
SPI_Configure(BOARD_TSC_SPI_BASE,
BOARD_TSC_SPI_ID,
SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_PCS(BOARD_TSC_NPCS) /* Value of the SPI configuration register. */
);
SPI_ConfigureNPCS(BOARD_TSC_SPI_BASE, BOARD_TSC_NPCS,
SPI_CSR_NCPHA | SPI_CSR_DLYBS(DELAY_BEFORE_SPCK) |
SPI_CSR_DLYBCT(DELAY_BETWEEN_CONS_COM) | SPI_CSR_SCBR(0xC8) );
SPI_Enable(BOARD_TSC_SPI_BASE);
for (uDummy=0; uDummy<100000; uDummy++);
uDummy = REG_SPI_SR;
uDummy = REG_SPI_RDR;
SendCommand(CMD_ENABLE_PENIRQ);
}
示例9: stepper_set_output_current
void stepper_set_output_current(const uint16_t current) {
Pin pin = PIN_PWR_DAC;
const uint16_t new_current = BETWEEN(VREF_RES_MIN_CURRENT,
current,
VREF_MAX_CURRENT);
if(new_current < VREF_RES_MAX_CURRENT) {
pin.type = PIO_OUTPUT_0;
pin.attribute = PIO_DEFAULT;
PIO_Configure(&pin, 1);
DACC_SetConversionData(DACC, SCALE(new_current,
VREF_RES_MIN_CURRENT,
VREF_RES_MAX_CURRENT,
VOLTAGE_MIN_VALUE,
VOLTAGE_MAX_VALUE));
} else {
DACC_SetConversionData(DACC, SCALE(new_current,
VREF_MIN_CURRENT,
VREF_MAX_CURRENT,
VOLTAGE_MIN_VALUE,
VOLTAGE_MAX_VALUE));
pin.type = PIO_INPUT;;
pin.attribute = PIO_DEFAULT;
PIO_Configure(&pin, 1);
}
stepper_output_current = new_current;
}
示例10: spiBegin
//------------------------------------------------------------------------------
void spiBegin(uint8_t csPin) {
pinMode(csPin,OUTPUT);
digitalWrite(csPin,HIGH);
PIO_Configure(
g_APinDescription[PIN_SPI_MOSI].pPort,
g_APinDescription[PIN_SPI_MOSI].ulPinType,
g_APinDescription[PIN_SPI_MOSI].ulPin,
g_APinDescription[PIN_SPI_MOSI].ulPinConfiguration);
PIO_Configure(
g_APinDescription[PIN_SPI_MISO].pPort,
g_APinDescription[PIN_SPI_MISO].ulPinType,
g_APinDescription[PIN_SPI_MISO].ulPin,
g_APinDescription[PIN_SPI_MISO].ulPinConfiguration);
PIO_Configure(
g_APinDescription[PIN_SPI_SCK].pPort,
g_APinDescription[PIN_SPI_SCK].ulPinType,
g_APinDescription[PIN_SPI_SCK].ulPin,
g_APinDescription[PIN_SPI_SCK].ulPinConfiguration);
pmc_enable_periph_clk(ID_SPI0);
#if USE_SAM3X_DMAC
pmc_enable_periph_clk(ID_DMAC);
dmac_disable();
DMAC->DMAC_GCFG = DMAC_GCFG_ARB_CFG_FIXED;
dmac_enable();
#if USE_SAM3X_BUS_MATRIX_FIX
MATRIX->MATRIX_WPMR = 0x4d415400;
MATRIX->MATRIX_MCFG[1] = 1;
MATRIX->MATRIX_MCFG[2] = 1;
MATRIX->MATRIX_SCFG[0] = 0x01000010;
MATRIX->MATRIX_SCFG[1] = 0x01000010;
MATRIX->MATRIX_SCFG[7] = 0x01000010;
#endif // USE_SAM3X_BUS_MATRIX_FIX
#endif // USE_SAM3X_DMAC
}
示例11: motors_init
void motors_init()
{
PIO_Configure(&pin_m0_en, 1);
PIO_Configure(&pin_m1_en, 1);
PIO_Configure(&pin_m2_en, 1);
PIO_Configure(&pin_m_brake, 1);
PIO_Configure(&pin_m0_dir, 1);
PIO_Configure(&pin_m1_dir, 1);
PIO_Configure(&pin_m2_dir, 1);
PMC_EnablePeripheral(ID_PWM); // power up pwm controller plz
PIO_Configure(&pin_m0_vref, 1); // PWML0
PIO_Configure(&pin_m1_vref, 1); // PWMH1
PIO_Configure(&pin_m2_vref, 1); // PWMH3
PWM->PWM_CH_NUM[0].PWM_CMR = 0; // pass-through divider. 64 MHz clock.
PWM->PWM_CH_NUM[0].PWM_CPRD = 255; // 8-bit current control, 125 kHz cycle
PWM->PWM_CH_NUM[0].PWM_CDTY = 0; // zero duty for now
PWM->PWM_CH_NUM[1].PWM_CMR = 0;
PWM->PWM_CH_NUM[1].PWM_CPRD = 255;
PWM->PWM_CH_NUM[1].PWM_CDTY = 255;
PWM->PWM_CH_NUM[3].PWM_CMR = 0;
PWM->PWM_CH_NUM[3].PWM_CPRD = 255;
PWM->PWM_CH_NUM[3].PWM_CDTY = 255;
PWM->PWM_ENA = 0xb; // enable channels 0,1,3
PIO_Set(&pin_m_brake);
PIO_Set(&pin_m0_en);
PIO_Set(&pin_m1_en);
PIO_Set(&pin_m2_en);
}
示例12: ILI9488_InitInterface
static void ILI9488_InitInterface(void)
{
PIO_Configure(ILI9488_Reset, PIO_LISTSIZE(ILI9488_Reset));
PIO_Configure(spi_pins, PIO_LISTSIZE(spi_pins));
PIO_Configure(ILI9488_Pwm, PIO_LISTSIZE(ILI9488_Pwm));
/* Enable PWM peripheral clock */
PMC_EnablePeripheral(ID_PWM0);
/* Set clock A and clock B */
// set for 14.11 KHz for CABC control
// mode = PWM_CLK_PREB(0x0A) | (PWM_CLK_DIVB(110)) |
// PWM_CLK_PREA(0x0A) | (PWM_CLK_DIVA(110));
PWMC_ConfigureClocks(PWM0, 14200, 0, BOARD_MCK);
/* Configure PWM channel 1 for LED0 */
PWMC_DisableChannel(PWM0, CHANNEL_PWM_LCD);
PWMC_ConfigureChannel(PWM0, CHANNEL_PWM_LCD, PWM_CMR_CPRE_CLKA,0,PWM_CMR_CPOL);
PWMC_SetPeriod(PWM0, CHANNEL_PWM_LCD, 16);
PWMC_SetDutyCycle(PWM0, CHANNEL_PWM_LCD, 8);
PWMC_EnableChannel(PWM0, CHANNEL_PWM_LCD);
SPI_Configure(ILI9488, ILI9488_ID, (SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_PCS( ILI9488_cs )));
SPI_ConfigureNPCS( ILI9488, ILI9488_cs,
SPI_CSR_CPOL | SPI_CSR_BITS_9_BIT |
SPI_DLYBS(100, BOARD_MCK) | SPI_DLYBCT(100, BOARD_MCK) |
SPI_SCBR( 35000000, BOARD_MCK) ) ;
SPI_Enable(ILI9488);
}
示例13: UART_Configure
extern void UART_Configure( uint32_t baudrate, uint32_t masterClock)
{
#if 0
const Pin pPins[] = CONSOLE_PINS;
/* Configure PIO */
PIO_Configure(pPins, PIO_LISTSIZE(pPins));
uint32_t mode = US_MR_USART_MODE_RS485 | US_MR_USCLKS_MCK
| US_MR_CHRL_8_BIT | US_MR_PAR_NO | US_MR_NBSTOP_1_BIT
| US_MR_CHMODE_NORMAL;
PMC->PMC_PCER0 = 1 << CONSOLE_ID;
USART_Configure( USART1, mode, CONSOLE_BAUDRATE, BOARD_MCK ) ;
USART1->US_IDR = 0xFFFFFFFF ;
NVIC_EnableIRQ( USART1_IRQn ) ;
USART_SetTransmitterEnabled( USART1, 1 ) ;
#else
#ifdef CONSOLE_USART_USE_UART1
const Pin pPins[] = {{1 << 3, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT}};
Uart *pUart = CONSOLE_USART;
#else
const Pin pPins[] = CONSOLE_PINS;
Uart *pUart = (Uart *)CONSOLE_USART;
#endif
/* Configure PIO */
PIO_Configure(pPins, PIO_LISTSIZE(pPins));
/* Configure PMC */
#ifdef CONSOLE_USART_USE_UART1
PMC->PMC_PCER0 = 1 << ID_UART1;
#else
PMC->PMC_PCER0 = 1 << CONSOLE_ID;
#endif
/* Reset and disable receiver & transmitter */
pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX
| UART_CR_RXDIS | UART_CR_TXDIS;
/* Configure mode */
pUart->UART_MR = UART_MR_PAR_NO | US_MR_CHRL_8_BIT;
/* Configure baudrate */
/* Asynchronous, no oversampling */
pUart->UART_BRGR = (masterClock / baudrate) / 16;
/* Disable PDC channel */
pUart->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
/* Enable receiver and transmitter */
pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
#endif
}
示例14: PIO_Configure
// Initialize ADC channels
void HAL::analogStart(void)
{
#if MOTHERBOARD == 500 || MOTHERBOARD == 501
PIO_Configure(
g_APinDescription[58].pPort,
g_APinDescription[58].ulPinType,
g_APinDescription[58].ulPin,
g_APinDescription[58].ulPinConfiguration);
PIO_Configure(
g_APinDescription[59].pPort,
g_APinDescription[59].ulPinType,
g_APinDescription[59].ulPin,
g_APinDescription[59].ulPinConfiguration);
#endif // (MOTHERBOARD==500) || (MOTHERBOARD==501)
// ensure we can write to ADC registers
ADC->ADC_WPMR = 0x41444300u; //ADC_WPMR_WPKEY(0);
pmc_enable_periph_clk(ID_ADC); // enable adc clock
for (int i = 0; i < ANALOG_INPUTS; i++)
{
osAnalogInputValues[i] = 0;
adcSamplesMin[i] = 100000;
adcSamplesMax[i] = 0;
adcEnable |= (0x1u << osAnalogInputChannels[i]);
osAnalogSamplesSum[i] = 2048 * ANALOG_INPUT_MEDIAN;
for (int j = 0; j < ANALOG_INPUT_MEDIAN; j++)
osAnalogSamples[i][j] = 2048; // we want to prevent early error from bad starting values
}
// enable channels
ADC->ADC_CHER = adcEnable;
ADC->ADC_CHDR = !adcEnable;
// Initialize ADC mode register (some of the following params are not used here)
// HW trigger disabled, use external Trigger, 12 bit resolution
// core and ref voltage stays on, normal sleep mode, normal not free-run mode
// startup time 16 clocks, settling time 17 clocks, no changes on channel switch
// convert channels in numeric order
// set prescaler rate MCK/((PRESCALE+1) * 2)
// set tracking time (TRACKTIM+1) * clock periods
// set transfer period (TRANSFER * 2 + 3)
ADC->ADC_MR = ADC_MR_TRGEN_DIS | ADC_MR_TRGSEL_ADC_TRIG0 | ADC_MR_LOWRES_BITS_12 |
ADC_MR_SLEEP_NORMAL | ADC_MR_FWUP_OFF | ADC_MR_FREERUN_OFF |
ADC_MR_STARTUP_SUT64 | ADC_MR_SETTLING_AST17 | ADC_MR_ANACH_NONE |
ADC_MR_USEQ_NUM_ORDER |
ADC_MR_PRESCAL(AD_PRESCALE_FACTOR) |
ADC_MR_TRACKTIM(AD_TRACKING_CYCLES) |
ADC_MR_TRANSFER(AD_TRANSFER_CYCLES);
ADC->ADC_IER = 0; // no ADC interrupts
ADC->ADC_CGR = 0; // Gain = 1
ADC->ADC_COR = 0; // Single-ended, no offset
// start first conversion
ADC->ADC_CR = ADC_CR_START;
}
示例15: platform_pio_op
pio_type platform_pio_op( unsigned port, pio_type pinmask, int op )
{
Pin* pin;
pio_type retval = 1;
pin = pio_port_desc + port;
pin->mask = pinmask;
switch( op )
{
case PLATFORM_IO_PORT_SET_VALUE:
case PLATFORM_IO_PIN_SET:
PIO_Set( pin );
break;
case PLATFORM_IO_PIN_CLEAR:
PIO_Clear( pin );
break;
case PLATFORM_IO_PORT_DIR_INPUT:
pin->mask = 0x7FFFFFFF;
case PLATFORM_IO_PIN_DIR_INPUT:
pin->type = PIO_INPUT;
PIO_Configure( pin, 1 );
break;
case PLATFORM_IO_PORT_DIR_OUTPUT:
pin->mask = 0x7FFFFFFF;
case PLATFORM_IO_PIN_DIR_OUTPUT:
pin->type = PIO_OUTPUT_0;
PIO_Configure( pin, 1 );
break;
case PLATFORM_IO_PORT_GET_VALUE:
pin->mask = 0x7FFFFFFF;
pin->type = PIO_INPUT;
retval = PIO_Get( pin );
break;
case PLATFORM_IO_PIN_GET:
retval = PIO_Get( pin ) & pinmask ? 1 : 0;
break;
case PLATFORM_IO_PIN_PULLUP:
pin->pio->PIO_PPUER = pinmask;
break;
case PLATFORM_IO_PIN_NOPULL:
pin->pio->PIO_PPUDR = pinmask;
break;
default:
retval = 0;
break;
}
return retval;
}