- Código: Selecionar todos
__task void tarefa2(void){
for (;;){
os_evt_wait_and(0x0002, 0xffff);
os_evt_clr (0x0002, t_tarefa2);
while(1){
adc();
envia_display();
}
}
}
tem goto no rtos? hehehe!
Moderadores: 51, guest2003, Renie, gpenga
__task void tarefa2(void){
for (;;){
os_evt_wait_and(0x0002, 0xffff);
os_evt_clr (0x0002, t_tarefa2);
while(1){
adc();
envia_display();
}
}
}
__task void tarefa2(void){
for (;;){
os_evt_wait_and(0x0002, 0xffff);
adc();
envia_display();
}
}
The os_evt_wait_and function returns when all of the events specified in the wait_flags have occurred or when the timeout expires. If all events specified in wait_flags have arrived, this function clears them before the function returns. The function actually clears the events whose corresponding flags have been set to 1 in the wait_flags parameter. The other event flags are not changed.
tcpipchip escreveu:Este tal de rtos nao tem signal() e wait() ?
//*****************************************************************************
// Function name: INTERRUPÇÃO EXTERNA 3
//***************************************************************************/
void extint0(void) {
LPC_GPIO2->FIODIR &= ~(1 << 13); /* PORT2.13 entrada */
LPC_GPIOINT->IO2IntEnF |= (1 << 13); /* enable falling edge irq */
NVIC_EnableIRQ(EINT3_IRQn); /*habilita irq */
}
void EINT3_IRQHandler()
{
LPC_GPIOINT->IO2IntClr |= (1 << 13); /* limpa pedido */
isr_evt_set(0x0003, t_tarefa3); // envia flag de evento
}
//*****************************************************************************
// Function name: INTERRUPÇÃO EXTERNA 2
//***************************************************************************/
void extint0(void) {
LPC_GPIO2->FIODIR &= ~(1 << 12); /* PORT2.12 entrada */
LPC_GPIOINT->IO2IntEnF |= (1 << 12); /* enable falling edge irq */
NVIC_EnableIRQ(EINT2_IRQn); /* habilita irq */
}
void EINT2_IRQHandler()
{
LPC_GPIOINT->IO2IntClr |= (1 << 12); /* limpa pedido */
isr_evt_set(0x0003, t_tarefa3); // envia flag de evento
}
isr_evt_set(0x0003, t_tarefa3); // envia flag de evento
isr_evt_set((1<<3), t_tarefa3); // envia flag de evento
__task void task1 (void) {
OS_RESULT result;
result = os_evt_wait_and (flag, time-out);
if (result == OS_R_TMO) {
Atualize com o display com o adc;
}
else {
Trate eventos de teclas;
}
..
}
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante