MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / main

Function main

bsp/hc32l136/applications/main.c:62–85  ·  view source on GitHub ↗

******************************************************************************* ** \brief Main function of GPIO output ** ** \param None ** ** \retval int32_t Return value, if needed ** ******************************************************************************/

Source from the content-addressed store, hash-verified

60 **
61 ******************************************************************************/
62int main(void)
63{
64 rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
65 rt_pin_attach_irq(KEY_PIN, PIN_IRQ_MODE_FALLING, key_handler, RT_NULL);
66 rt_pin_irq_enable(KEY_PIN, PIN_IRQ_ENABLE);
67
68 while(1)
69 {
70 if (flag == 0)
71 {
72 rt_pin_write(LED_PIN, PIN_HIGH);
73 rt_thread_delay(500);
74 rt_pin_write(LED_PIN, PIN_LOW);
75 rt_thread_delay(500);
76 }
77 else
78 {
79 rt_pin_write(LED_PIN, PIN_HIGH);
80 rt_thread_delay(2000);
81 rt_pin_write(LED_PIN, PIN_LOW);
82 rt_thread_delay(2000);
83 }
84 }
85}
86
87/*******************************************************************************
88 * EOF (not truncated)

Callers

nothing calls this directly

Calls 5

rt_pin_attach_irqFunction · 0.85
rt_pin_irq_enableFunction · 0.85
rt_thread_delayFunction · 0.85
rt_pin_modeFunction · 0.50
rt_pin_writeFunction · 0.50

Tested by

no test coverage detected