Solved! Go to Solution.
Hi Shicai Sun,
Please take as reference the JN516x Integrated Peripherals API User Guide Chapter 5.1 Using the DIOs
Example; Input Pin configuration
PUBLIC bool_t APP_bButtonInitialise(void)
{
/* Set DIO lines to inputs with buttons connected */
vAHI_DioSetDirection(APP_BUTTONS_DIO_MASK, 0);
/* Turn on pull-ups for DIO lines with buttons connected */
vAHI_DioSetPullup(APP_BUTTONS_DIO_MASK, 0);
/* Set the edge detection for falling edges */
vAHI_DioInterruptEdge(0, APP_BUTTONS_DIO_MASK);
/* Enable interrupts to occur on selected edge */
vAHI_DioInterruptEnable(APP_BUTTONS_DIO_MASK, 0);
uint32 u32Buttons = u32AHI_DioReadInput() & APP_BUTTONS_DIO_MASK;
/* If we came out of deep sleep; perform an appropriate action as well based
on button press.*/
APP_cbTimerButtonScan(NULL);
if (u32Buttons != APP_BUTTONS_DIO_MASK)
{
return TRUE;
}
return FALSE;
}
Hope it helps,
Mario
Hi,
Please see below:
In some of the above functions, a 32-bit bitmap is used to represent the set of DIOs. In the bitmap, each of bits 0 to 19 represents a DIO pin, where bit 0 represents DIO0 and bit 19 represents DIO19 (bits 20-31 are unused).
I want to know ,1 is set or 0 is set.
(I feel like an idiot)
Thank for you !
BR
Arvin
Hi Shica,
For example;
/* Set DIO lines to inputs with buttons connected */
vAHI_DioSetDirection(APP_BUTTONS_DIO_MASK, 0);
APP_BUTTONS_DIO_MASK = (1 << APP_BUTTONS_BUTTON_1) and the APP_BUTTONS_BUTTON_1 is equal to 8.
So, for setting the direction in this case 1 is to set.
Please let me if you have more questions.
Mario
How to set up DIO?
Hi,
APP_BUTTONS_DIO_MASK?
BR
Arvin
Hi Shicai Sun,
Please take as reference the JN516x Integrated Peripherals API User Guide Chapter 5.1 Using the DIOs
Example; Input Pin configuration
PUBLIC bool_t APP_bButtonInitialise(void)
{
/* Set DIO lines to inputs with buttons connected */
vAHI_DioSetDirection(APP_BUTTONS_DIO_MASK, 0);
/* Turn on pull-ups for DIO lines with buttons connected */
vAHI_DioSetPullup(APP_BUTTONS_DIO_MASK, 0);
/* Set the edge detection for falling edges */
vAHI_DioInterruptEdge(0, APP_BUTTONS_DIO_MASK);
/* Enable interrupts to occur on selected edge */
vAHI_DioInterruptEnable(APP_BUTTONS_DIO_MASK, 0);
uint32 u32Buttons = u32AHI_DioReadInput() & APP_BUTTONS_DIO_MASK;
/* If we came out of deep sleep; perform an appropriate action as well based
on button press.*/
APP_cbTimerButtonScan(NULL);
if (u32Buttons != APP_BUTTONS_DIO_MASK)
{
return TRUE;
}
return FALSE;
}
Hope it helps,
Mario
Hi,
OK,
Let me a look at that document.
I try to test it.
Thank for you !
BR
Arvin.Sun