本文整理汇总了C++中shellInit函数的典型用法代码示例。如果您正苦于以下问题:C++ shellInit函数的具体用法?C++ shellInit怎么用?C++ shellInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shellInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
/*
* Initializes a serial-over-USB CDC driver.
*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
/*
* Activates the USB driver and then the USB bus pull-up on D+.
* Note, a delay is inserted in order to not have to disconnect the cable
* after a reset.
*/
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
/*
* LSM303DLHC Object Initialization
*/
lsm303dlhcObjectInit(&LSM303DLHCD1);
/*
* Activates the LSM303DLHC driver.
*/
lsm303dlhcStart(&LSM303DLHCD1, &lsm303dlhccfg);
/*
* Shell manager initialization.
*/
shellInit();
while(TRUE) {
if (SDU1.config->usbp->state == USB_ACTIVE) {
thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,
"shell", NORMALPRIO + 1,
shellThread, (void *)&shell_cfg1);
chThdWait(shelltp); /* Waiting termination. */
}
chThdSleepMilliseconds(1000);
}
lsm303dlhcStop(&LSM303DLHCD1);
return 0;
}
示例2: main
/*
* Application entry point.
*/
int main(void) {
static const evhandler_t evhndl[] = {
InsertHandler,
RemoveHandler
};
Thread *shelltp = NULL;
struct EventListener el0, el1;
/*
* 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);
/*
* Shell manager initialization.
*/
shellInit();
/*
* Initializes the MMC driver to work with SPI2.
*/
palSetPadMode(IOPORT2, GPIOB_SPI2NSS, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(IOPORT2, GPIOB_SPI2NSS);
mmcObjectInit(&MMCD1, &SPID2,
&ls_spicfg, &hs_spicfg,
mmc_is_protected, mmc_is_inserted);
mmcStart(&MMCD1, 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 listen for events.
*/
chEvtRegister(&MMCD1.inserted_event, &el0, 0);
chEvtRegister(&MMCD1.removed_event, &el1, 1);
while (TRUE) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
chEvtDispatch(evhndl, chEvtWaitOne(ALL_EVENTS));
}
return 0;
}
示例3: main
/**
* Main function.
*/
int main(void){
halInit();
chSysInit();
chThdCreateStatic(blinkWA, sizeof(blinkWA), NORMALPRIO, blink_thd, NULL);
#if !WAKEUP_TEST
/* switch off wakeup */
rtcSetPeriodicWakeup_v2(&RTCD1, NULL);
/* Shell initialization.*/
sdStart(&SD2, &ser_cfg);
shellInit();
static WORKING_AREA(waShell, 1024);
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
/* wait until user do not want to test wakeup */
while (TRUE){
chThdSleepMilliseconds(200);
}
#else
/* set wakeup */
wakeupspec.wakeup = ((uint32_t)4) << 16; /* select 1 Hz clock source */
wakeupspec.wakeup |= 9; /* set counter value to 9. Period will be 9+1 seconds. */
rtcSetPeriodicWakeup_v2(&RTCD1, &wakeupspec);
chThdSleepSeconds(3);
func_sleep();
#endif /* !WAKEUP_TEST */
return 0;
}
示例4: main
int main(void) {
Thread *shelltp = NULL;
halInit();
chSysInit();
palSetPadMode(GPIOA,9,PAL_MODE_STM32_ALTERNATE_PUSHPULL);
palSetPadMode(GPIOA,10,PAL_MODE_INPUT);
sdStart(&SD1, NULL);
shellInit();
palSetPadMode(GPIOA,8,PAL_MODE_OUTPUT_PUSHPULL);
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
Lcd_Init();
Lcd_Clear();
Lcd_Example();
while (TRUE) {
if (!shelltp){
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);}
else if (chThdTerminated(shelltp)) {
chThdRelease(shelltp);
shelltp = NULL;
}
chThdSleepMilliseconds(500);
}
}
示例5: main
/**
* Main function.
*/
int main(void){
halInit();
chSysInit();
chThdCreateStatic(blinkWA, sizeof(blinkWA), NORMALPRIO, blink_thd, NULL);
sdStart(&SD1, NULL); /* Default is 38400-8-N-1.*/
if (LPC_SC->PCON & (1UL << 11)) {
chprintf(chp1, "Woke from Deep power-down\r\n");
LPC_SC->PCON |= (1UL << 11);
}
if (LPC_SC->PCON & (1UL << 9)) {
chprintf(chp1, "Woke from Deep-sleep mode\r\n");
LPC_SC->PCON |= (1UL << 9);
}
/* Shell initialization.*/
shellInit();
static WORKING_AREA(waShell, 1024);
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
/* wait until user do not want to test wakeup */
while (TRUE){
chThdSleepMilliseconds(200);
}
return 0;
}
示例6: main
int main(void) {
thread_t *sh = NULL;
PollerData.temp = 0;
PollerData.press = 0;/*
PollerData.uTime = 0;*/
halInit();
chSysInit();
shellInit();
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1000);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
// SPI-related pins (for display)
palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5));
palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5));
spiStart(&SPID1, &spi1cfg);
spiStart(&SPID2, &spi2cfg);
i2cStart(&I2CD1, &i2cconfig);
initGyro();
initAccel();
initMag();
// nunchuk_status = nunchuk_init();
bmp085_status = bmp085_init();
lcd5110Init();
lcd5110SetPosXY(0, 0);
lcd5110WriteText("P :: ");
lcd5110SetPosXY(0, 1);
lcd5110WriteText("T :: ");
chThdCreateStatic(waThreadBlink, sizeof(waThreadBlink), NORMALPRIO, ThreadBlink, NULL);
chThdCreateStatic(waThreadButton, sizeof(waThreadButton), NORMALPRIO, ThreadButton, NULL);
chThdCreateStatic(waPoller, sizeof(waPoller), NORMALPRIO, ThreadPoller, NULL);
while (TRUE) {
if (!sh) {
sh = shellCreate(&shCfg, SHELL_WA_SIZE, NORMALPRIO);
}
else if (chThdTerminatedX(sh)) {
chThdRelease(sh);
sh = NULL;
}
chThdSleepMilliseconds(1000);
}
return 0; // never returns, lol
}
示例7: main
/*
* Application entry point.
*/
int main(void) {
/* Shell thread */
Thread *shelltp = NULL;
/* UART Configuration Structure */
SerialConfig sc;
// Dummy ADC Configuration structure
ADCConfig adc_conf;
/*
* 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();
GPIO_Configuration();
//ADC_Configuration();
I2C_Configuration();
/* Start Serial Driver */
sc.sc_speed = 115200;
sc.sc_cr1 = 0;
sc.sc_cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN;
sc.sc_cr3 = 0;
sdStart(&SD1, &sc);
/* Shell manager initialization. */
shellInit();
/*
* Creates the example thread.
*/
chThdCreateStatic(waThread1, sizeof(waI2CThread), NORMALPRIO, I2CThread, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched with output on the serial
* driver 1.
*/
while (TRUE) {
if(!shelltp)
{
shelltp = shellCreate( &shell_cfg, THD_WA_SIZE(2048), NORMALPRIO);
}
else if(chThdTerminated(shelltp))
{
// Recovers memory of the previous shell.
chThdRelease(shelltp);
shelltp = NULL;
}
}
}
示例8: main
int main(void) {
halInit();
chSysInit();
uint8_t i;
event_listener_t tel;
// Serial Port Setup
sdStart(&SD1, NULL);
palSetPadMode(GPIOC, 4, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOC, 5, PAL_MODE_ALTERNATE(7));
chprintf((BaseSequentialStream*)&SD1, "Up and Running\n\r");
palSetPadMode(GPIOB, 3, PAL_MODE_ALTERNATE(6)); /* SCK. */
palSetPadMode(GPIOB, 4, PAL_MODE_ALTERNATE(6)); /* MISO.*/
palSetPadMode(GPIOB, 5, PAL_MODE_ALTERNATE(6)); /* MOSI.*/
palSetPadMode(GPIOC, GPIOC_PIN1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOC, GPIOC_PIN1);
palSetPadMode(GPIOC, GPIOC_PIN2, PAL_MODE_OUTPUT_PUSHPULL);
palClearPad(GPIOC, GPIOC_PIN2);
palSetPadMode(GPIOC, GPIOC_PIN3, PAL_MODE_INPUT_PULLUP);
spiStart(&SPID3, &nrf24l01SPI);
chMtxObjectInit(&nrfMutex);
//FROM RX---
extStart(&EXTD1, &extcfg);
//---
nrf24l01ObjectInit(&nrf24l01);
nrf24l01Start(&nrf24l01, &nrf24l01Config);
//FROM RX ---
extChannelEnable(&EXTD1, 3);
//-----
initNRF24L01(&nrf24l01);
chprintf((BaseSequentialStream*)&SD1, "\n\rUp and Running\n\r");
shellInit();
chEvtRegister(&shell_terminated, &tel, 0);
shelltp1 = shellCreate(&shell_cfg1, sizeof(waShell), NORMALPRIO);
//FROM RX---
chThdCreateStatic(recieverWorkingArea, sizeof(recieverWorkingArea), NORMALPRIO, receiverThread, NULL);
//FROM RX^^^^
/*
for (i=0;i<32;i++) {
serialOutBuf[i] = 3;
}
*/
for (;;) {
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
}
}
示例9: main
int main(void){
halInit();
chSysInit();
Thread *sh = NULL;
sdStart(&SD1,&sd1conf);
//sdStart(&SD1,NULL);
chThdSleepMilliseconds(200);
#if USE_I2C_STUFF
I2CInit_pns();
#if USE_I2C_POLL_THD
/* Create accelerometer thread */
chThdCreateStatic(PollAccelThreadWA,
sizeof(PollAccelThreadWA),
NORMALPRIO,
PollAccelThread,
NULL);
chThdCreateStatic(PollColorThreadWA,
sizeof(PollColorThreadWA),
NORMALPRIO,
PollColorThread,
NULL);
#endif
#endif
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
#if USE_SER_OUT_THD
chThdCreateStatic(waSerOutThr1, sizeof(waSerOutThr1), NORMALPRIO, SerOutThr1, NULL);
#endif
palSetPadMode(GPIOA, GPIOA_PA2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
//TestThread(&SD1);
shellInit();
while (TRUE){
//palSetPad(GPIOA, 3);
//TestThread(&SD1);
//chThdSleepMilliseconds(500);
//palClearPad(GPIOA, 3);
//chThdSleepMilliseconds(500);
if (!sh){
chprintf((BaseSequentialStream *)&SD1,"Starting ChibiOS/RT Shell\n\r");
sh = shellCreate(&shCfg, SHELL_WA_SIZE, NORMALPRIO+1);
} else if (chThdTerminated(sh)) {
chThdRelease(sh);
sh = NULL;
}
// chThdSleepMilliseconds(1000);
}
}
示例10: 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();
/*
* Initialize USB serial console
*/
usbcdc_init(commands);
/*
* Shell manager initialization.
*/
shellInit();
/*
* Activates the serial driver 6 and SDC driver 1 using default
* configuration.
*/
sdStart(&SD6, NULL);
chThdSleep(MS2ST(100));
UPRINT("\x1b[1J\x1b[0;0HStarting ChibiOS\r\n");
UPRINT("Start blinker thread ...");
chThdCreateStatic(waThreadBlink, sizeof(waThreadBlink), NORMALPRIO,
blinkerThread, NULL);
UPRINT( " Done\r\n");
shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched with output on the serial
* driver 2.
*/
while (TRUE)
{
usbcdc_process();
if (palReadPad(GPIOA, GPIOA_BUTTON))
{
palSetPad(GPIOD, GPIOD_LED5); /* Red On*/
usbcdc_print("Button pressed\r\n");
}
/* Wait some time, to make the scheduler running tasks with lower prio */
chThdSleep(MS2ST(500));
}
}
示例11: main
/*
* Application entry point.
*/
int main(void) {
Thread *shelltp = NULL;
/*
* 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 USB driver and then the USB bus pull-up on D+.
*/
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1000);
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
usbConnectBus(serusbcfg.usbp);
palClearPad(GPIOC, GPIOC_USB_DISC);
/*
* Shell manager initialization.
*/
shellInit();
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waBurner, sizeof(waBurner), NORMALPRIO, Burner, &SDU1);
i2cStart(&I2CD1, &i2cfg1);
EepromOpen(&EepromFile);
/* tune ports for I2C1*/
palSetPadMode(IOPORT2, 6, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
palSetPadMode(IOPORT2, 7, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
// BKP->DR1 = 0;
// BKP->DR2 = 0;
// BKP->DR3 = 0;
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (TRUE) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
chThdSleepMilliseconds(1000);
}
}
示例12: main
/*
* Application entry point.
*/
int main(void) {
Thread *shelltp = NULL;
/*
* 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(&SERIAL_DRIVER, NULL);
/*
* Initializes the PWM driver.
*/
pwmStart(&PWM_DRIVER, &pwmcfg);
/*
* Initializes the GPT driver.
*/
gptStart(&GPT_DRIVER, &gptcfg);
/*
* Initializes the EXT driver.
*/
extStart(&EXT_DRIVER, &extcfg);
/*
* Shell manager initialization.
*/
shellInit();
/*
* 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 (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
chThdRelease(shelltp);
shelltp = NULL;
}
chprintf(&SERIAL_DRIVER, "M: %6umm T1: %6u T2: %6u\r\n", measure / 2, tmp1, tmp2);
chThdSleepMilliseconds(200);
}
}
示例13: 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();
/*
* Initializes a serial-over-USB CDC driver.
*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
/*
* Configuring USB DP and DM PINs.
*/
palSetPadMode(GPIOA, GPIOA_PIN11, PAL_MODE_INPUT);
palSetPadMode(GPIOA, GPIOA_PIN12, PAL_MODE_INPUT);
/*
* Activates the USB driver and then the USB bus pull-up on D+.
* Note, a delay is inserted in order to not have to disconnect the cable
* after a reset.
*/
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
/*
* Shell manager initialization.
*/
shellInit();
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, spawning shells.
*/
while (true) {
if (SDU1.config->usbp->state == USB_ACTIVE) {
thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,
"shell", NORMALPRIO + 1,
shellThread, (void *)&shell_cfg1);
chThdWait(shelltp); /* Waiting termination. */
}
chThdSleepMilliseconds(1000);
}
}
示例14: main
/*
* Application entry point.
*/
int main(void) {
thread_t *shelltp = NULL;
/*
* 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();
#if defined(DEBUG_USB)
palSetPadMode(GPIOA, 1, PAL_MODE_ALTERNATIVE_2);
palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATIVE_2);
sdStart(&SD1, &s0cfg);
#endif /* DEBUG_USB */
/*
* Initializes a serial-over-USB CDC driver.
*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
/*
* Activates the USB driver and then the USB bus pull-up on D+.
* Note, a delay is inserted in order to not have to disconnect the cable
* after a reset.
*/
usbDisconnectBus(serusbcfg.usbp);
#if defined(DEBUG_USB)
usb_debug_init();
#endif /* DEBUG_USB */
chThdSleepMilliseconds(1000);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
/*
* Shell manager initialization.
*/
shellInit();
while (!chThdShouldTerminateX()) {
if (!shelltp && (serusbcfg.usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
chThdSleepMilliseconds(1000);
palTogglePad(GPIOB, GPIOB_LED);
}
return 0;
}
示例15: main
/*
* Application entry point.
*/
int main(void) {
static const evhandler_t evhndl[] = {
InsertHandler,
RemoveHandler
};
Thread *shelltp = NULL;
struct EventListener el0, el1;
/*
* 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 and SDC driver 1 using default
* configuration.
*/
sdStart(&SD1, NULL);
sdcStart(&SDCD1, NULL);
/*
* Shell manager initialization.
*/
shellInit();
/*
* Activates the card insertion monitor.
*/
tmr_init(&SDCD1);
/*
* 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 listen for events.
*/
chEvtRegister(&inserted_event, &el0, 0);
chEvtRegister(&removed_event, &el1, 1);
while (TRUE) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
chEvtDispatch(evhndl, chEvtWaitOne(ALL_EVENTS));
}
}