本文整理汇总了C++中palReadPad函数的典型用法代码示例。如果您正苦于以下问题:C++ palReadPad函数的具体用法?C++ palReadPad怎么用?C++ palReadPad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了palReadPad函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
palSetPad(IOPORT1, LED1);
WDGConfig WDG_config = {
.pause_on_sleep = 0,
.pause_on_halt = 0,
.timeout_ms = 5000,
.callback = timeout_callback
};
wdgStart(&WDGD1, &WDG_config);
/*
* Normal main() thread activity, in this demo it does nothing.
*/
while (true) {
if (palReadPad(IOPORT1, BTN1) == 0) {
palTogglePad(IOPORT1, LED1);
wdgReset(&WDGD1);
}
chThdSleepMilliseconds(500);
}
}
开发者ID:ChibiOS,项目名称:ChibiOS-Contrib,代码行数:37,代码来源:main.c
示例2: ssi_read
/**
* @brief Single word read from the SSI encoder
* @return Most recent SSI byte (may also be buffered in stream mode)
*/
uint32_t ssi_read(void)
{
uint8_t bit = SSI_LENGTH; // Set length counter
uint32_t working_buffer = 0;
if(ssi_mode == SSI_MODE_STREAM)
{
led_count = (led_count+1)%25;// LED handling
if(!led_count)
led_toggle();
}
while(bit > 0)
{
// Falling edge
palClearPad(SSI_SIGNAL_PORT, SSI_CLK_PIN); // Toggle clock
ssi_delay();
ssi_delay();
ssi_delay();
// Rising edge
palSetPad(SSI_SIGNAL_PORT, SSI_CLK_PIN); // Toggle clock
working_buffer = (working_buffer << 1) + palReadPad(SSI_SIGNAL_PORT, SSI_DATA_PIN);
ssi_delay();
bit--; // Decrement bit counter
}
working_buffer = ((1<<SSI_LENGTH) - 1) & (~working_buffer); // Invert bits in buffer to simulate
return working_buffer;
}
开发者ID:hymanc,项目名称:lram-casting,代码行数:30,代码来源:ssi.c
示例3: Th2
static msg_t Th2(void *p) {
(void)p;
chRegSetThreadName("Th2");
while (TRUE) {
/////DEVICE 2///////////
if(palReadPad(GPIO1_PORT, GPIO1_PAD) != PAL_HIGH)
{
palWritePad(GPIO22_PORT,GPIO22_PAD,PAL_HIGH);
chSemWait(&mySemaphore);
chprintf((BaseSequentialStream *)&SD1, "D2ON\r\n");
chSemSignal(&mySemaphore);
}else{
palWritePad(GPIO22_PORT,GPIO22_PAD,PAL_LOW);
chSemWait(&mySemaphore);
chprintf((BaseSequentialStream *)&SD1, "D2OFF\r\n");
chSemSignal(&mySemaphore);
}
chThdSleepMilliseconds(1000);
}
return 0;
}
开发者ID:jesshack10,项目名称:iotwebmanager,代码行数:28,代码来源:main4Threads.c
示例4: main
/*
* Application entry point.
*/
int main(void) {
halInit();
chSysInit();
/*
* Serial port initialization.
*/
sdStart(&SD1, NULL);
chprintf((BaseSequentialStream *)&SD1, "BCM2835 GPIO Demonstration\r\n");
ioportid_t ledPort = ONBOARD_LED_PORT;
uint32_t ledPad = ONBOARD_LED_PAD;
palSetPadMode(ledPort, ledPad, PAL_MODE_OUTPUT);
palSetPad(ledPort, ledPad);
palSetPadMode(GPIO4_PORT, GPIO4_PAD, PAL_MODE_INPUT_PULLUP);
for (;;) {
uint32_t button_state = palReadPad(GPIO4_PORT, GPIO4_PAD);
if (button_state) {
palSetPad(ledPort, ledPad);
}
else {
palClearPad(ledPort, ledPad);
}
}
/*
* Events servicing loop.
*/
chThdWait(chThdSelf());
return 0;
}
开发者ID:jesshack10,项目名称:iotwebmanager,代码行数:38,代码来源:main.c
示例5: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
/*
* Starts the LED blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
while(TRUE) {
if (!palReadPad(IOPORT5, PORTE_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
return 0;
}
开发者ID:CNCBASHER,项目名称:ChibiOS,代码行数:33,代码来源:main.c
示例6: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 2 using the driver default configuration.
* PA2(TX) and PA3(RX) are routed to USART2.
*/
sdStart(&SD2, NULL);
palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));
/*
* Creates the example thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it just performs
* a shell respawn upon its termination.
*/
while (TRUE) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
}
开发者ID:GuzTech,项目名称:senoko-chibios-3,代码行数:38,代码来源:main.c
示例7: sdc_lld_is_card_inserted
/**
* @brief SDC card detection.
*/
bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
static bool_t last_status = FALSE;
if (blkIsTransferring(sdcp))
return last_status;
return last_status = (bool_t)palReadPad(GPIOC, GPIOC_SD_D3);
}
开发者ID:i386ex,项目名称:ChibiOS-JS,代码行数:10,代码来源:board.c
示例8: extcb4
/*Callback function for the interrupt on RC Channel 4.
*/
static void extcb4(EXTDriver *extp, expchannel_t channel) {
(void)extp ;
(void)channel ;
chSysLockFromIsr() ;
if(palReadPad(RC4_PORT, RC4_PIN) == PAL_HIGH) {
start[3] = halGetCounterValue() ;
}
else if(start[3] && (palReadPad(RC4_PORT, RC4_PIN) == PAL_LOW)) {
float tmp = convertCounterToMilliseconds(start[3], halGetCounterValue()) ;
if(RC_IN_RANGE(tmp))
RCInput[3] = tmp ;
start[3] = 0 ;
}
chSysUnlockFromIsr() ;
}
开发者ID:153rd,项目名称:navstik-base,代码行数:18,代码来源:RCInput.c
示例9: main
/*
* Entry point, note, the main() function is already a thread in the system
* on entry.
*/
int main(int argc, char **argv) {
(void)argc;
(void)argv;
/*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (TRUE) {
if (palReadPad(IOPORT1, GPIOA_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
return 0;
}
开发者ID:Nitrokey,项目名称:nitrokey-start-firmware,代码行数:30,代码来源:main.c
示例10: main
/*
* Application entry point.
*/
void main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 1 using the driver default configuration.
* The STM8L-Discovery requires USART1 pins remapping on PA2 and PA3.
*/
SYSCFG->RMPCR1 = 0x1C;
sdStart(&SD1, NULL);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity.
*/
while (TRUE) {
if (palReadPad(GPIOC, PC_BUTTON) == PAL_LOW)
TestThread(&SD1);
chThdSleepMilliseconds(1000);
}
}
开发者ID:jesshack10,项目名称:iotwebmanager,代码行数:36,代码来源:main.c
示例11: i2c_clear_bus
/**
* @brief Function for detecting stuck slaves (SDA = 0 and SCL = 1) and tries to clear the bus.
*
* @return
* @retval false Bus is stuck.
* @retval true Bus is clear.
*/
static void i2c_clear_bus(I2CDriver *i2cp) {
const I2CConfig *cfg = i2cp->config;
uint8_t i;
IOPORT1->PIN_CNF[cfg->scl_pad] = I2C_PIN_CNF;
IOPORT1->PIN_CNF[cfg->sda_pad] = I2C_PIN_CNF;
I2C_HIGH(cfg->sda_pad);
I2C_HIGH(cfg->scl_pad);
IOPORT1->PIN_CNF[cfg->scl_pad] = I2C_PIN_CNF_CLR;
IOPORT1->PIN_CNF[cfg->sda_pad] = I2C_PIN_CNF_CLR;
nrf_delay_us(4);
for(i = 0; i < 9; i++) {
if (palReadPad(IOPORT1, cfg->sda_pad)) {
if(i > 0)
break;
else
return;
}
I2C_LOW(cfg->scl_pad);
nrf_delay_us(4);
I2C_HIGH(cfg->scl_pad);
nrf_delay_us(4);
}
I2C_LOW(cfg->sda_pad);
nrf_delay_us(4);
I2C_HIGH(cfg->sda_pad);
}
开发者ID:ChibiOS,项目名称:ChibiOS-Contrib,代码行数:40,代码来源:hal_i2c_lld.c
示例12: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
}
开发者ID:0110,项目名称:stm32f103playground,代码行数:35,代码来源:main.c
示例13: encoder_reset
/**
* Reset the encoder counter. Should be called from the index interrupt.
*/
void encoder_reset(void) {
// Only reset if the pin is still high to avoid too short pulses, which
// most likely are noise.
__NOP();
__NOP();
__NOP();
__NOP();
if (palReadPad(HW_HALL_ENC_GPIO3, HW_HALL_ENC_PIN3)) {
const unsigned int cnt = HW_ENC_TIM->CNT;
static int bad_pulses = 0;
const unsigned int lim = enc_counts / 20;
if (index_found) {
// Some plausibility filtering.
if (cnt > (enc_counts - lim) || cnt < lim) {
HW_ENC_TIM->CNT = 0;
bad_pulses = 0;
} else {
bad_pulses++;
if (bad_pulses > 5) {
index_found = 0;
}
}
} else {
HW_ENC_TIM->CNT = 0;
index_found = true;
bad_pulses = 0;
}
}
}
开发者ID:vedderb,项目名称:bldc,代码行数:34,代码来源:encoder.c
示例14: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the SD1 and SPI1 drivers.
*/
sdStart(&SD4, NULL); /* Default: 38400,8,N,1. */
/*
* Creates the blinker threads.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity.
*/
while (TRUE) {
if (!palReadPad(GPIO3, GPIO3_SW_USER1)) {
TestThread(&SD4);
}
chThdSleepMilliseconds(100);
}
}
开发者ID:GotoHack,项目名称:ChibiOS,代码行数:36,代码来源:main.c
示例15: pyro_continuity
bool_t pyro_continuity(uint8_t pad)
{
if((palReadPad(GPIOE, pad)) == PAL_LOW)
return TRUE;
else
return FALSE;
}
开发者ID:ac942,项目名称:avionics14,代码行数:7,代码来源:pyro.c
示例16: main
int main(void) {
halInit();
chSysInit();
/*
* This initialization requires the OS already active because it uses delay
* APIs inside.
*/
int active = GPIOB_LED4;
int inactive = GPIOB_LED3;
palSetPadMode(GPIOB, GPIOB_LED4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, GPIOB_LED3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOB, active);
palClearPad(GPIOB, inactive);
while (1) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
int store = active;
active = inactive;
inactive = store;
palSetPad(GPIOB, active);
palClearPad(GPIOB, inactive);
}
chThdSleepMilliseconds(500);
}
}
开发者ID:justindthomas,项目名称:arm-development,代码行数:30,代码来源:main.c
示例17: isUserButtonPressed
int isUserButtonPressed(unsigned int timeOut) {
const int FIVE_HUNDRED_MILLISECONDS = 500;
// User button is connected to PA0.
palSetPadMode(GPIOA, 0, PAL_MODE_INPUT);
int userButtonPressed = 0;
while (timeOut > 0) {
timeOut--;
if (!userButtonPressed) {
userButtonPressed = palReadPad(GPIOA, 0);
}
// Indicate the checking process by blinking the LEDs
if (userButtonPressed) {
changeStateLED(RED, ON);
chThdSleepMilliseconds(FIVE_HUNDRED_MILLISECONDS);
changeStateLED(RED, OFF);
chThdSleepMilliseconds(FIVE_HUNDRED_MILLISECONDS);
}
else {
changeStateLED(BLUE, ON);
chThdSleepMilliseconds(FIVE_HUNDRED_MILLISECONDS);
changeStateLED(BLUE, OFF);
chThdSleepMilliseconds(FIVE_HUNDRED_MILLISECONDS);
}
}
return userButtonPressed;
}
开发者ID:Jessie-SEM,项目名称:MiniatureSmartVehicle,代码行数:31,代码来源:UserButton.c
示例18: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 1 using the driver default configuration.
*/
sdStart(&SD1, NULL);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* checking a button and run a test suite if button was pressed.
*/
while (TRUE) {
if (!palReadPad(IOPORT6, P6_I_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
}
return 0;
}
开发者ID:Rossano,项目名称:ez430_ChibiOS,代码行数:36,代码来源:main.c
示例19: main
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 1 using the driver default configuration.
*/
sdStart(&SD1, NULL);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Creates the LWIP threads (it changes priority internally).
*/
chThdCreateStatic(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, NORMALPRIO + 1,
lwip_thread, NULL);
/*
* Creates the HTTP thread (it changes priority internally).
*/
chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1,
http_server, NULL);
/*
* Normal main() thread activity.
*/
while (TRUE) {
chThdSleepMilliseconds(500);
if (!palReadPad(IOPORT2, PIOB_SW1))
sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14);
if (!palReadPad(IOPORT2, PIOB_SW2))
TestThread(&SD1);
}
return 0;
}
开发者ID:jesshack10,项目名称:iotwebmanager,代码行数:50,代码来源:main.c
示例20: ow_read_bit
/**
* @brief Function performing read of single bit.
* @note It must be callable from any context.
*/
static ioline_t ow_read_bit(onewireDriver *owp) {
#if ONEWIRE_SYNTH_SEARCH_TEST
(void)owp;
return _synth_ow_read_bit();
#else
return palReadPad(owp->config->port, owp->config->pad);
#endif
}
开发者ID:awygle,项目名称:ChibiOS-Contrib,代码行数:12,代码来源:hal_onewire.c
注:本文中的palReadPad函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论