Nuvo-4000 Series User’s Manual
Copyright © 2014 Neousys Technology Inc. All Right Reserved.
Page 75 of 76
COS_INT_SETUP setup;
memset(&setup, 0, sizeof(setup));
setup.portMask = 0x0f; // 00001111b, enable ch.0~3
setup.edgeMode = 0x00; // generate interrupt on level change
setup.edgeType = 0x00; // rising/falling edge, only effective when edgeMode = 1
if ( ! SetupDICOS(&setup, sizeof(setup)) )
{
printf("SetupDICOS --> FAILED\n");
return -2;
}
printf("SetupDICOS --> PASSED\n");
//Step 3, register the callback function
if ( ! RegisterCallbackDICOS(callback_function) )
{
printf("RegisterCallbackDICOS --> FAILED\n");
return -3;
}
printf("RegisterCallbackDICOS --> PASSED\n");
//Step 4, start the DI Change-of-State Interrupt
if ( ! StartDICOS() )
{
printf("StartDICOS --> FAILED\n");
return -4;
}
printf("StartDICOS --> PASSED\n");
printf("\npress any key to stop...\n");
system("pause >nul");
//Step 5, stop the DI Change-of-State Interrupt operation
if ( ! StopDICOS() )
{
printf("StopDICOS --> FAILED\n");
return -5;
}