コード例 #1
0
ファイル: pal_lld.c プロジェクト: DroneBuster/lpc_gsm
/**
 * @brief   Pads mode setup.
 * @details This function programs a pads group belonging to the same port
 *          with the specified mode.
 * @note    @p PAL_MODE_UNCONNECTED is implemented as push pull output with
 *          high state.
 * @note    This function does not alter the @p PINSELx registers. Alternate
 *          functions setup must be handled by device-specific code.
 *
 * @param[in] port      the port identifier
 * @param[in] mask      the group mask
 * @param[in] mode      the mode
 *
 * @notapi
 */
void _pal_lld_setgroupmode(ioportid_t port,
                           ioportmask_t mask,
                           iomode_t mode) {

  switch (mode) {
  case PAL_MODE_RESET:
  case PAL_MODE_INPUT:
    LPC_GPIO_PORT->DIR[port] &= ~mask;
    break;
  case PAL_MODE_UNCONNECTED:
    palSetPort(port, PAL_WHOLE_PORT);
  case PAL_MODE_OUTPUT_PUSHPULL:
    LPC_GPIO_PORT->DIR[port] |=  mask;
    break;
  }
}
コード例 #2
0
ファイル: main.c プロジェクト: MultiCalorNV/verventa-web_Int
static THD_FUNCTION(Thread1, arg) {

  (void)arg;
  chRegSetThreadName("blinker");

  while (true) {
    unsigned i;

    for (i = 0; i < 4; i++) {
      palClearPad(PORT11, P11_LED1);
      chThdSleepMilliseconds(100);
      palClearPad(PORT11, P11_LED2);
      chThdSleepMilliseconds(100);
      palClearPad(PORT11, P11_LED3);
      chThdSleepMilliseconds(100);
      palClearPad(PORT11, P11_LED4);
      chThdSleepMilliseconds(100);
      palSetPad(PORT11, P11_LED1);
      chThdSleepMilliseconds(100);
      palSetPad(PORT11, P11_LED2);
      chThdSleepMilliseconds(100);
      palSetPad(PORT11, P11_LED3);
      chThdSleepMilliseconds(100);
      palSetPad(PORT11, P11_LED4);
      chThdSleepMilliseconds(300);
    }

    for (i = 0; i < 4; i++) {
      palTogglePad(PORT11, P11_LED1);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT11, P11_LED1);
      palTogglePad(PORT11, P11_LED2);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT11, P11_LED2);
      palTogglePad(PORT11, P11_LED3);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT11, P11_LED3);
      palTogglePad(PORT11, P11_LED4);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT11, P11_LED4);
    }

    palSetPort(PORT11,
               PAL_PORT_BIT(P11_LED1) | PAL_PORT_BIT(P11_LED2) |
               PAL_PORT_BIT(P11_LED3) | PAL_PORT_BIT(P11_LED4));
  }
}
コード例 #3
0
ファイル: main.c プロジェクト: 153rd/ChibiOS-RT
static msg_t Thread1(void *arg) {

  (void)arg;
  chRegSetThreadName("blinker");

  while (TRUE) {
    unsigned i;

    for (i = 0; i < 4; i++) {
      palClearPad(PORT_D, PD_LED1);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_D, PD_LED2);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_D, PD_LED3);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_D, PD_LED4);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_D, PD_LED1);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_D, PD_LED2);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_D, PD_LED3);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_D, PD_LED4);
      chThdSleepMilliseconds(300);
    }

    for (i = 0; i < 4; i++) {
      palTogglePort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
                            PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
      chThdSleepMilliseconds(500);
      palTogglePort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
                            PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
      chThdSleepMilliseconds(500);
    }

    for (i = 0; i < 4; i++) {
      palTogglePad(PORT_D, PD_LED1);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_D, PD_LED1);
      palTogglePad(PORT_D, PD_LED2);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_D, PD_LED2);
      palTogglePad(PORT_D, PD_LED3);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_D, PD_LED3);
      palTogglePad(PORT_D, PD_LED4);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_D, PD_LED4);
    }

    for (i = 0; i < 4; i++) {
      palClearPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
      palSetPort(PORT_D, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
      chThdSleepMilliseconds(500);
      palClearPort(PORT_D, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
      palSetPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
      chThdSleepMilliseconds(500);
    }

    palSetPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
                       PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
  }
  return 0;
}
コード例 #4
0
ファイル: main.c プロジェクト: mabl/ChibiOS
static THD_FUNCTION(Thread1, arg) {

  (void)arg;

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  while (true) {
    unsigned i;

    for (i = 0; i < 4; i++) {
      palClearPad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(300);
    }

    for (i = 0; i < 4; i++) {
      palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                            PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
      palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                            PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
    }

    for (i = 0; i < 4; i++) {
      palTogglePad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED1);
      palTogglePad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED2);
      palTogglePad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED3);
      palTogglePad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED4);
    }

    for (i = 0; i < 4; i++) {
      palClearPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
      palSetPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
      palClearPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
      palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
      chThdSleepMilliseconds(500);
    }

    palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                       PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
  }
}
コード例 #5
0
ファイル: main.c プロジェクト: Tambralinga/ChibiOS
static THD_FUNCTION(Thread1, arg) {

  (void)arg;

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  while (TRUE) {
    unsigned i;

    chnWriteTimeout(&SD1, (uint8_t *)"Hello World!\r\n", 14, TIME_INFINITE);

    for (i = 0; i < 4; i++) {
      palClearPad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(100);
      palClearPad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(100);
      palSetPad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(300);
    }

    for (i = 0; i < 4; i++) {
      palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                            PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
      palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                            PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
    }

    for (i = 0; i < 4; i++) {
      palTogglePad(PORT_E, PE_LED1);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED1);
      palTogglePad(PORT_E, PE_LED2);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED2);
      palTogglePad(PORT_E, PE_LED3);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED3);
      palTogglePad(PORT_E, PE_LED4);
      chThdSleepMilliseconds(250);
      palTogglePad(PORT_E, PE_LED4);
    }

    for (i = 0; i < 4; i++) {
      palClearPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
      palSetPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
      chThdSleepMilliseconds(500);
      palClearPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
      palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
      chThdSleepMilliseconds(500);
    }

    palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
                       PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
  }
}