Skip to content

Commit

Permalink
Revisions for pico-sdk v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Memotech-Bill committed Aug 22, 2024
1 parent afeac64 commit 60dadda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
17 changes: 10 additions & 7 deletions src/memu/kbd_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

#include <pico.h>
#include <tusb.h>
#include <class/hid/hid.h>
// #include "types.h"
#include "win.h"
#include "diag.h"
// #include "vid.h"
// #include "mon.h"
// #include "memu.h"
#include "kbd.h"
#include "common.h"

Expand All @@ -27,13 +22,21 @@
#define KBD_VERSION 3
#elif (TUSB_VERSION_MINOR == 14) | (TUSB_VERSION_MINOR == 15)
#define KBD_VERSION 4
#elif (TUSB_VERSION_MINOR == 17)
#define KBD_VERSION 5
#endif // TUSB_VERSION_MINOR
#endif // TUSB_VERSION_MAJOR
#endif // KBD_VERSION
#ifndef KBD_VERSION
#error Unknown USB Version for keyboard
#endif // KBD_VERSION

#if KBD_VERSION == 5
#include "class/hid/hid_host.h"
#else
#include "class/hid/hid.h"
#endif

static const int usb_map[] =
{
'a', // 0x04 - Keyboard a and A
Expand Down Expand Up @@ -179,7 +182,7 @@ static void set_leds (uint8_t leds)
};
#if KBD_VERSION == 3
bool bRes = tuh_control_xfer (kbd_addr, &ledreq, &led_flags, NULL);
#elif KBD_VERSION == 4
#elif KBD_VERSION >= 4
tuh_xfer_t ledxfer = {
.daddr = kbd_addr,
.setup = &ledreq,
Expand Down Expand Up @@ -445,7 +448,7 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
}
}

#elif ( KBD_VERSION == 3 ) | ( KBD_VERSION == 4 )
#elif ( KBD_VERSION >= 3 )
void hid_task (void)
{
static int n = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/memu/sound.pio
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
;
.wrap_target
set x, 14 side 0x01 ; Loop 15 times (decrement is after test)
left:
sleft:
out pins, 1 side 0x00 ; Output left channel bits
jmp x--, left side 0x01 ; Loop
jmp x--, sleft side 0x01 ; Loop
out pins, 1 side 0x02 ; Final bit with LRCK high
;
set x, 14 side 0x03 ; Loop 15 times (decrement is after test)
right:
sright:
out pins, 1 side 0x02 ; Output right channel bits
jmp x--, right side 0x03 ; Loop
jmp x--, sright side 0x03 ; Loop
out pins, 1 side 0x00 ; Final bit with LRCK low
.wrap
;
Expand Down

0 comments on commit 60dadda

Please sign in to comment.