Hi Ti:
How can the initialization register be configured so that all 16 ports are configured in gpio out mode and the output is high
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
There are not 16 but 18 pins.
Configure the pins as GPIO by clearing their bits in the KP_GPIOx registers (this is the default), set them as outputs in the GPIO_DIRx registers, and make the output high with the GPIO_DAT_OUTx registers. (To prevent a low pulse, set GPIO_DAT_OUTx before GPIO_DIRx.)
Read the gpio status REG_GPIO_DAT_STAT1 REG_GPIO_DAT_STAT2 REG_GPIO_DAT_STAT3 code how to convert to status value 0 or 1
static int tca8418_gpio_get(struct gpio_chip *gpiochip, unsigned int offset)
{
struct tca8418_keypad *keypad_data
= container_of(gpiochip, struct tca8418_keypad, gc);
int byte_offset = offset/8;
u8 value = 0;
tca8418_read_byte(keypad_data,
REG_GPIO_DAT_STAT1+byte_offset,
&value);
return (int)value<<(byte_offset*8);
}
We're currently using this one, but it's not getting the right state。