static void nand_wp_assert(void) { palClearPad(GPIOB, GPIOB_NAND_WP); }
static void ledoff(void *p) { (void)p; palClearPad(GPIOC, GPIOC_LED4); }
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; }
/* * Turn LED on * Arguments * num GPIOB_LED1, GPIOB_LED2 */ void ledon2(void *num) { (void)num; palClearPad(IOPORT2, GPIOB_LED2); }
void lcd_cmd(uint8_t c){ palClearPad(GPIOB, RS); lcd_sendByte(c); chThdSleepMicroseconds(50); }
/* * Application entry point. */ int main(void) { /* Initialization of all the imported components in the order specified in the application wizard. The function is generated automatically.*/ componentsInit(); palClearPad(PORT11, P11_LED4); /* * Initializes the PWM driver 8 and ICU driver 1. * PIN80 is the PWM output. * PIN63 is the ICU input. * The two pins have to be externally connected together. */ /* Sets PIN63 alternative function.*/ SIU.PCR[179].R = 0b0000011000001100; /* Sets PIN65 alternative function.*/ SIU.PCR[181].R = 0b0000010100001100; icuStart(&ICUD2, &icucfg); icuEnable(&ICUD2); pwmStart(&PWMD1, &pwmcfg); chThdSleepMilliseconds(2000); /* * Starts the PWM channel 0 using 75% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 50% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 25% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500)); chThdSleepMilliseconds(5000); /* * Changes PWM period and the PWM channel 0 to 50% duty cycle. */ pwmChangePeriod(&PWMD1, 25000); pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Disables PWM channel 0 and stops the drivers. */ pwmDisableChannel(&PWMD1, 0); pwmStop(&PWMD1); /* * Disables and stops the ICU drivers. */ icuDisable(&ICUD2); icuStop(&ICUD2); palClearPad(PORT11, P11_LED3); palClearPad(PORT11, P11_LED4); /* * Normal main() thread activity, in this demo it does nothing. */ while (TRUE) { chThdSleepMilliseconds(500); } return 0; }
static void icuperiodcb(ICUDriver *icup) { palClearPad(GPIOB, GPIOB_LED2); last_period = icuGetPeriodX(icup); }
/* * 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 the PWM driver 1 and ICU driver 1. * GPIOD10 is the PWM output. * GPIOA0 is the ICU input. * The two pins have to be externally connected together. */ icuStart(&ICUD1, &icucfg); icuEnable(&ICUD1); /* Sets A0 alternative function.*/ SIU.PCR[0].R = 0b0100010100000100; pwmStart(&PWMD1, &pwmcfg); /* Sets D10 alternative function.*/ SIU.PCR[58].R = 0b0100010100000100; chThdSleepMilliseconds(2000); /* * Starts the PWM channel 0 using 75% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 50% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 25% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500)); chThdSleepMilliseconds(5000); /* * Changes PWM period and the PWM channel 0 to 50% duty cycle. */ pwmChangePeriod(&PWMD1, 25000); pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Disables channel 0 and stops the drivers. */ pwmDisableChannel(&PWMD1, 0); pwmStop(&PWMD1); icuDisable(&ICUD1); icuStop(&ICUD1); palClearPad(PORT_D, PD_LED3); palClearPad(PORT_D, PD_LED4); /* * Normal main() thread activity, in this demo it does nothing. */ while (TRUE) { chThdSleepMilliseconds(500); } return 0; }
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)); } }
static void ledoff(void *p) { (void)p; palClearPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); }
static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; palClearPad(PORT_D, PD_LED1); }
static inline void green_led_off(void) {palClearPad(GPIOI, GPIOI_LED_G);}
static inline void red_led_off(void) {palClearPad(GPIOI, GPIOI_LED_R);}
static void red_led_off(void) { palClearPad(GPIOE, GPIOE_LED_R); }
static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; palClearPad(PORT11, P11_LED1); }
static void led4off(void *arg) { (void)arg; palClearPad(GPIOB, GPIOB_LED4); }
static void icuperiodcb(ICUDriver *icup) { palClearPad(PORT11, P11_LED2); last_period = icuGetPeriod(icup); }
static THD_FUNCTION(Thread1, arg) { (void)arg; chRegSetThreadName("blinker"); 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)); } }
static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; palClearPad(GPIOB, GPIOB_LED1); }
static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; palClearPad(GPIOD, GPIOD_LED5); }
/* * 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 the PWM driver 1 and ICU driver 2. * GPIOE9 is the PWM output. * GPIOA0 is the ICU input. * The two pins have to be externally connected together. */ pwmStart(&PWMD1, &pwmcfg); pwmEnablePeriodicNotification(&PWMD1); icuStart(&ICUD2, &icucfg); icuStartCapture(&ICUD2); icuEnableNotifications(&ICUD2); chThdSleepMilliseconds(2000); /* * Starts the PWM channel 0 using 75% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500)); pwmEnableChannelNotification(&PWMD1, 0); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 50% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 25% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500)); chThdSleepMilliseconds(5000); /* * Changes PWM period to half second the duty cycle becomes 50% * implicitly. */ pwmChangePeriod(&PWMD1, 5000); chThdSleepMilliseconds(5000); /* * Disables channel 0 and stops the drivers. */ pwmDisableChannel(&PWMD1, 0); pwmStop(&PWMD1); icuStopCapture(&ICUD2); icuStop(&ICUD2); palClearPad(GPIOB, GPIOB_LED1); palClearPad(GPIOB, GPIOB_LED2); /* * Normal main() thread activity, in this demo it does nothing. */ while (true) { chThdSleepMilliseconds(500); } return 0; }
static void icuperiodcb(ICUDriver *icup) { palClearPad(GPIOD, GPIOD_LED4); last_period = icuGetPeriod(icup); }
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)); } }
/* * 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 the PWM driver 2 and ICU driver 3. * GPIOA8 is the PWM output. * GPIOC6 is the ICU input. * The two pins have to be externally connected together. */ pwmStart(&PWMD1, &pwmcfg); palSetPadMode(GPIOA, 8, PAL_MODE_ALTERNATE(1)); icuStart(&ICUD3, &icucfg); palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(2)); icuEnable(&ICUD3); chThdSleepMilliseconds(2000); /* * Starts the PWM channel 0 using 75% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 50% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); chThdSleepMilliseconds(5000); /* * Changes the PWM channel 0 to 25% duty cycle. */ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500)); chThdSleepMilliseconds(5000); /* * Changes PWM period to half second the duty cycle becomes 50% * implicitly. */ pwmChangePeriod(&PWMD1, 5000); chThdSleepMilliseconds(5000); /* * Disables channel 0 and stops the drivers. */ pwmDisableChannel(&PWMD1, 0); pwmStop(&PWMD1); icuDisable(&ICUD3); icuStop(&ICUD3); palClearPad(GPIOD, GPIOD_LED4); palClearPad(GPIOD, GPIOD_LED5); /* * Normal main() thread activity, in this demo it does nothing. */ while (TRUE) { chThdSleepMilliseconds(500); } return 0; }
static void led5off(void *p) { (void)p; palClearPad(GPIOD, GPIOD_LED5); }
void hw_init_gpio(void) { // GPIO clock enable RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); // LEDs palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); // ENABLE_GATE palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); // Disable BMI160 palSetPadMode(GPIOA, 15, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPad(GPIOA, 15); // Disable DCCAL palSetPadMode(GPIOD, 2, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palClearPad(GPIOD, 2); ENABLE_GATE(); // GPIOA Configuration: Channel 1 to 3 as alternate function push-pull palSetPadMode(GPIOA, 8, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); // Hall sensors palSetPadMode(HW_HALL_ENC_GPIO1, HW_HALL_ENC_PIN1, PAL_MODE_INPUT_PULLUP); palSetPadMode(HW_HALL_ENC_GPIO2, HW_HALL_ENC_PIN2, PAL_MODE_INPUT_PULLUP); palSetPadMode(HW_HALL_ENC_GPIO3, HW_HALL_ENC_PIN3, PAL_MODE_INPUT_PULLUP); // Fault pin palSetPadMode(GPIOB, 7, PAL_MODE_INPUT_PULLUP); // ADC Pins palSetPadMode(GPIOA, 0, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOA, 1, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOA, 6, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_ANALOG); palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_ANALOG); drv8323s_init(); }
void powerSetup() { pilotSetup(); palSetPadMode(POWER_PORT, POWER_PAD, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(POWER_PORT, POWER_PAD); chVTSet(&vt, MS2ST(POLL_INTERVAL), checkFunc, NULL); }
static void led5off(void *arg) { (void)arg; palClearPad(GPIOD, GPIOD_LED6); }
/** * @brief Asserts the slave select signal and prepares for transfers. * * @param[in] spip pointer to the @p SPIDriver object * * @notapi */ void spi_lld_select(SPIDriver *spip) { palClearPad(spip->config->ssport, spip->config->sspad); }
/* * GPT3 callback. */ static void gpt3cb(GPTDriver *gptp) { (void)gptp; palClearPad(GPIOD, GPIOD_LED5); }