-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: input: add driver for the nintendo nunchuk #82655
Conversation
uint8_t init_seq_1[2] = {0xf0, 0x55}; | ||
uint8_t init_seq_2[2] = {0xfb, 0x00}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to have a define for these 4 constants? normally I'd ask to use the datasheet name but in this case there's probably not much to go by...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't think there is any official datasheet... I'm not sure it would be cleaner with 4 defines, but if you think it's better I can do it.
drivers/input/input_nunchuk.c
Outdated
} | ||
|
||
k_msleep(10); | ||
ret = i2c_read_dt(&cfg->i2c_bus, buffer, 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret = i2c_read_dt(&cfg->i2c_bus, buffer, 6); | |
ret = i2c_read_dt(&cfg->i2c_bus, buffer, sizeof(buffer)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer is passed as an argument, so sizeof doesn't work here. I put a #define for it, I'm not totally sure about the name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, how about passing an extra argument to nunchuk_read_registers
with the buffer size? then you can do nunchuk_read_registers(dev, buffer, sizeof(buffer));
and just use it as is in the function. Doesn't make any difference just not thrilled with the function taking a pointer to a buffer and assuming its size.
e59eca1
to
0da2333
Compare
0da2333
to
f4579b8
Compare
Add a binding for the Nintendo Nunchuk joystick through the I2C bus. Signed-off-by: Miguel Gazquez <[email protected]>
Add a driver for the Nintendo Nunchuk, accessed through the I2C bus. This driver only supports the joystick and the buttons, not the accelerometer. Signed-off-by: Miguel Gazquez <[email protected]>
f4579b8
to
47bb98f
Compare
This patch adds a driver for the Nunchuk, a joystick from Nintendo.