Home > other >  Small functions for help
Small functions for help

Time:11-18

Requirements, three microcontroller IO port, respectively do 3 buttons, one of the keys to support long according to the function,
IO port pins are respectively PA3. PA4. PF2, has defined the following
# define AD_PREV_INIT () {GPIOADIR |=BIT (4); GPIOADE |=BIT (4); GPIOAPU |=BIT (4); }
# define AD_PREV_IS () (GPIOA & amp; BIT (4))

# define AD_NEXT_INIT () {GPIOADIR |=BIT (3); GPIOADE |=BIT (3); GPIOAPU |=BIT (3); }
# define AD_NEXT_IS () (GPIOA & amp; BIT (3))

# define AD_PLAY_INIT () {GPIOFDIR |=BIT (2); GPIOFDE |=BIT (2); GPIOFPU |=BIT (2); }
# define AD_PLAY_IS () (GPIOF & amp; BIT (2))

When press the button to create a low level of 65 ms, and then has been high,
When continuous press will produce a low level of 65 ms, and then buy 750 ms, high and buy low 65 ms, buy high 750 ms, so cycle,
Program have tmr5ms_isr, tmr1ms_isr timer, such as time delay function have delay_5ms, delay_us, delay_ms
Short on time to send out a message to msg_enqueue (KU)
Long time to send out a message to msg_enqueue (KL)

What a great god help me write a function
  • Related