chore: Apply code formatting on entire codebase for consistent style
This commit is contained in:
@@ -29,7 +29,6 @@ bool aciotest_bi2a_sdvx_handler_update(
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
pin.raw[0] = ac_io_u16(pin.raw[0]);
|
||||
pin.raw[1] = ac_io_u16(pin.raw[1]);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "aciodrv/icca.h"
|
||||
|
||||
|
||||
#define IDLE_RESPONSES_BETWEEN_FELICA_POLLS 5
|
||||
|
||||
struct icca_handler_ctx {
|
||||
@@ -19,7 +18,7 @@ bool aciotest_icca_handler_init(
|
||||
{
|
||||
*ctx = malloc(sizeof(struct icca_handler_ctx));
|
||||
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx*)*ctx;
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx *) *ctx;
|
||||
icca_ctx->init = false;
|
||||
|
||||
icca_ctx->slotted_reader = true;
|
||||
@@ -34,7 +33,7 @@ bool aciotest_icca_handler_init(
|
||||
bool aciotest_icca_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
{
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx*)ctx;
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx *) ctx;
|
||||
|
||||
if (icca_ctx->init == false) {
|
||||
icca_ctx->init = true;
|
||||
|
||||
@@ -85,8 +85,8 @@ int main(int argc, char **argv)
|
||||
|
||||
log_to_writer(log_writer_stdout, NULL);
|
||||
|
||||
|
||||
struct aciodrv_device_ctx *device = aciodrv_device_open_path(argv[1], atoi(argv[2]));
|
||||
struct aciodrv_device_ctx *device =
|
||||
aciodrv_device_open_path(argv[1], atoi(argv[2]));
|
||||
|
||||
if (!device) {
|
||||
printf("Opening acio device failed\n");
|
||||
|
||||
+15
-13
@@ -3,27 +3,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "aciodrv/panb.h"
|
||||
#include "aciodrv-proc/panb.h"
|
||||
#include "aciodrv/panb.h"
|
||||
|
||||
struct panb_handler_ctx {
|
||||
bool running;
|
||||
};
|
||||
|
||||
bool aciotest_panb_handler_init(struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx)
|
||||
bool aciotest_panb_handler_init(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx)
|
||||
{
|
||||
if (node_id != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
*ctx = malloc(sizeof(struct panb_handler_ctx));
|
||||
struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx*)*ctx;
|
||||
struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx *) *ctx;
|
||||
panb_ctx->running = true;
|
||||
|
||||
return aciodrv_proc_panb_init(device);
|
||||
}
|
||||
|
||||
bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
bool aciotest_panb_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
{
|
||||
uint8_t button[AC_IO_PANB_MAX_KEYS];
|
||||
struct ac_io_panb_poll_out state;
|
||||
@@ -32,19 +34,19 @@ bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t nod
|
||||
if (node_id != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!panb_ctx->running) {
|
||||
printf(">>> PANB:\nDevice has been closed. Press Ctrl+C to exit.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!aciodrv_proc_panb_get_state(button)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
printf(">>> PANB:\nPress first and last keys to close device\n");
|
||||
|
||||
for (int i=0; i<AC_IO_PANB_MAX_KEYS; i++) {
|
||||
for (int i = 0; i < AC_IO_PANB_MAX_KEYS; i++) {
|
||||
printf("%01X ", button[i]);
|
||||
}
|
||||
printf("\n");
|
||||
@@ -52,25 +54,25 @@ bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t nod
|
||||
/* I added a key combo to properly close the module.
|
||||
* Leaving the PANB device in autopolling state without ever
|
||||
* reading packets from the serial interface eventually
|
||||
* makes it fall into a state where it doesn't send anything anymore
|
||||
* makes it fall into a state where it doesn't send anything anymore
|
||||
* and won't even respond to a reset, thus requiring a power cycle.
|
||||
*/
|
||||
if (button[0] && button[AC_IO_PANB_MAX_KEYS-1]) {
|
||||
if (button[0] && button[AC_IO_PANB_MAX_KEYS - 1]) {
|
||||
aciodrv_proc_panb_fini(device);
|
||||
panb_ctx->running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* light the panel */
|
||||
for (int i=0; i<AC_IO_PANB_MAX_KEYS; i++) {
|
||||
state.key[i].green = (button[i])? 0x7F : 0;
|
||||
for (int i = 0; i < AC_IO_PANB_MAX_KEYS; i++) {
|
||||
state.key[i].green = (button[i]) ? 0x7F : 0;
|
||||
state.key[i].red = 0;
|
||||
state.key[i].blue = (button[i])? 0x23 : 0;
|
||||
state.key[i].blue = (button[i]) ? 0x23 : 0;
|
||||
}
|
||||
|
||||
if (!aciodrv_panb_send_lamp(device, node_id, &state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
#include "aciodrv/device.h"
|
||||
|
||||
bool aciotest_panb_handler_init(struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx);
|
||||
bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx);
|
||||
bool aciotest_panb_handler_init(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx);
|
||||
bool aciotest_panb_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx);
|
||||
|
||||
#endif
|
||||
@@ -54,8 +54,7 @@ bool aciotest_rvol_handler_update(
|
||||
selected_light,
|
||||
pin.spinners[2] / 2,
|
||||
pin.spinners[3] / 2,
|
||||
pin.spinners[4] / 2
|
||||
);
|
||||
pin.spinners[4] / 2);
|
||||
|
||||
memset(&pout, 0, sizeof(pout));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user