mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-21 04:48:42 +01:00
aciotest: Add KFCA test handler
This commit is contained in:
parent
2788b27a6f
commit
bda056f0e4
@ -6,4 +6,5 @@ libs_aciotest := \
|
||||
|
||||
src_aciotest := \
|
||||
icca.c \
|
||||
kfca.c \
|
||||
main.c \
|
||||
|
75
src/main/aciotest/kfca.c
Normal file
75
src/main/aciotest/kfca.c
Normal file
@ -0,0 +1,75 @@
|
||||
#include "aciotest/kfca.h"
|
||||
|
||||
#include "acio/acio.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "aciodrv/kfca.h"
|
||||
|
||||
bool aciotest_kfca_handler_init(uint8_t node_id, void** ctx)
|
||||
{
|
||||
*ctx = malloc(sizeof(uint32_t));
|
||||
*((uint32_t*) *ctx) = 0;
|
||||
|
||||
return aciodrv_kfca_init(node_id);
|
||||
}
|
||||
|
||||
bool aciotest_kfca_handler_update(uint8_t node_id, void* ctx)
|
||||
{
|
||||
struct ac_io_kfca_poll_in pin;
|
||||
struct ac_io_kfca_poll_out pout;
|
||||
|
||||
static int gpio_test_pin = 0;
|
||||
static int gpio_test_counter = 0;
|
||||
|
||||
memset(&pout, 0, sizeof(pout));
|
||||
pout.gpio |= 1 << gpio_test_pin;
|
||||
pout.gpio = ac_io_u32(pout.gpio);
|
||||
|
||||
if (!aciodrv_kfca_poll(node_id, &pout, &pin)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pin.adc[0] = ac_io_u16(pin.adc[0]);
|
||||
pin.adc[1] = ac_io_u16(pin.adc[1]);
|
||||
|
||||
pin.gpio[0] = ac_io_u16(pin.gpio[0]);
|
||||
pin.gpio[1] = ac_io_u16(pin.gpio[1]);
|
||||
|
||||
printf(">>> KFCA %d: GPIO ON %d\n"
|
||||
"BTN A B C D: %d %d %d %d\n"
|
||||
"FX-L R: %d %d\n"
|
||||
"VOL L: %d\n"
|
||||
"VOL R: %d\n"
|
||||
"START COIN TEST SERV REC HP: %d %d %d %d %d %d\n",
|
||||
node_id, gpio_test_pin,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_A,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_B,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_C,
|
||||
pin.gpio[1] & AC_IO_KFCA_IN_GPIO_1_D,
|
||||
pin.gpio[1] & AC_IO_KFCA_IN_GPIO_1_FX_L,
|
||||
pin.gpio[1] & AC_IO_KFCA_IN_GPIO_1_FX_R,
|
||||
(pin.adc[0] >> 6) & 0x3FF,
|
||||
(pin.adc[1] >> 6) & 0x3FF,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_START,
|
||||
(pin.gpio_sys) & AC_IO_KFCA_IN_GPIO_SYS_COIN,
|
||||
(pin.gpio_sys) & AC_IO_KFCA_IN_GPIO_SYS_TEST,
|
||||
(pin.gpio_sys) & AC_IO_KFCA_IN_GPIO_SYS_SERVICE,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_RECORDER,
|
||||
pin.gpio[0] & AC_IO_KFCA_IN_GPIO_0_HEADPHONE
|
||||
);
|
||||
|
||||
++gpio_test_counter;
|
||||
if (gpio_test_counter >= 4) {
|
||||
gpio_test_counter = 0;
|
||||
++gpio_test_pin;
|
||||
|
||||
if (gpio_test_pin >= 16) {
|
||||
gpio_test_pin = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
10
src/main/aciotest/kfca.h
Normal file
10
src/main/aciotest/kfca.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef ACIOTEST_KFCA_H
|
||||
#define ACIOTEST_KFCA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
bool aciotest_kfca_handler_init(uint8_t node_id, void** ctx);
|
||||
bool aciotest_kfca_handler_update(uint8_t node_id, void* ctx);
|
||||
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "aciotest/handler.h"
|
||||
#include "aciotest/icca.h"
|
||||
#include "aciotest/kfca.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
@ -29,6 +30,13 @@ static bool aciotest_assign_handler(char product[4],
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!memcmp(product, "KFCA", 4)){
|
||||
handler->init = aciotest_kfca_handler_init;
|
||||
handler->update = aciotest_kfca_handler_update;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user