Q1:I want led on when establish a connection,and off when go to sleep,
my code as the below
void periph_init(void)
{
....
GPIO_ConfigurePin(GPIO_LED_PORT,GPIO_LED_PIN, OUTPUT, PID_GPIO, false);//P03 set to low
}
void user_before_sleep(void)
{
...
GPIO_ConfigurePin(GPIO_LED_PORT,GPIO_LED_PIN, OUTPUT, PID_GPIO, false);//set to low before sleep for Power saving
}
void user_on_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param)
{
GPIO_ConfigurePin(GPIO_LED_PORT,GPIO_LED_PIN, OUTPUT, PID_GPIO, true);//when connected set high
}
can you tell me why the pin is still output low,I had establish connected although.
how can I change it?
Q2:
What's the meaning of this GetBits16(SYS_STAT_REG, PER_IS_DOWN ?Can I need it when device wake up??
if(GetBits16(SYS_STAT_REG, PER_IS_DOWN))
{
periph_init();
}
thank you