update tinyusb, correct neopixel for usb enumeration
added binary for feather nrf52840
This commit is contained in:
parent
12d68f592c
commit
5e0195ddb4
1
Makefile
1
Makefile
@ -170,6 +170,7 @@ C_SOURCE_FILES += $(TUSB_PATH)/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/portable/nordic/nrf5x/hal_nrf5x.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/common/tusb_fifo.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/device/usbd.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/device/usbd_control.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/class/cdc/cdc_device.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/class/msc/msc_device.c
|
||||
C_SOURCE_FILES += $(TUSB_PATH)/class/custom/custom_device.c
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1 +1 @@
|
||||
Subproject commit 583326e535454f16b06ebdb9cc06869602a5564c
|
||||
Subproject commit a1c596490aa40863cd5f1e36a821157ffeab2af6
|
36
src/boards.c
36
src/boards.c
@ -87,7 +87,7 @@ void board_init(void)
|
||||
extern void neopixel_init(void);
|
||||
neopixel_init();
|
||||
|
||||
uint8_t grb[] = { 0, 255, 0 };
|
||||
uint8_t grb[3] = { 0, 255, 0 };
|
||||
neopixel_write(grb);
|
||||
#endif
|
||||
|
||||
@ -148,25 +148,28 @@ void pwm_teardown(NRF_PWM_Type* pwm )
|
||||
|
||||
void led_pwm_init(uint32_t led_pin)
|
||||
{
|
||||
pwm_teardown ((led_pin == LED_RED) ? NRF_PWM0 : NRF_PWM1);
|
||||
NRF_PWM_Type* pwm = (led_pin == LED_RED) ? NRF_PWM0 : NRF_PWM1;
|
||||
|
||||
pwm->MODE = PWM_MODE_UPDOWN_UpAndDown;
|
||||
pwm->COUNTERTOP = PWM_MAXCOUNT;
|
||||
pwm->PRESCALER = PWM_PRESCALER_PRESCALER_DIV_128;
|
||||
pwm->DECODER = PWM_DECODER_LOAD_Individual;
|
||||
pwm->LOOP = 0;
|
||||
|
||||
pwm->SEQ[0].PTR = (uint32_t) (led_pin == LED_RED ? _pwm_red_seq : _pwm_blue_seq);
|
||||
pwm->SEQ[0].CNT = PWM_CHANNEL_NUM; // default mode is Individual --> count must be 4
|
||||
pwm->SEQ[0].REFRESH = 0;
|
||||
pwm->SEQ[0].ENDDELAY = 0;
|
||||
|
||||
pwm->PSEL.OUT[0] = led_pin;
|
||||
|
||||
pwm->ENABLE = 1;
|
||||
pwm->TASKS_SEQSTART[0] = 1;
|
||||
}
|
||||
|
||||
void led_pwm_teardown(uint32_t led_pin)
|
||||
{
|
||||
NRF_PWM_Type* pwm = (led_pin == LED_RED) ? NRF_PWM0 : NRF_PWM1;
|
||||
|
||||
pwm->TASKS_SEQSTART[0] = 0;
|
||||
pwm->ENABLE = 0;
|
||||
|
||||
pwm->PSEL.OUT[0] = 0xFFFFFFFF;
|
||||
|
||||
pwm->MODE = 0;
|
||||
pwm->COUNTERTOP = 0x3FF;
|
||||
pwm->PRESCALER = 0;
|
||||
pwm->DECODER = 0;
|
||||
pwm->LOOP = 0;
|
||||
pwm->SEQ[0].PTR = 0;
|
||||
pwm->SEQ[0].CNT = 0;
|
||||
pwm_teardown ((led_pin == LED_RED) ? NRF_PWM0 : NRF_PWM1);
|
||||
}
|
||||
|
||||
void led_pwm_disable(uint32_t led_pin)
|
||||
@ -278,7 +281,6 @@ void neopixel_write (uint8_t *pixels)
|
||||
|
||||
NRF_PWM_Type* pwm = NRF_PWM2;
|
||||
|
||||
|
||||
nrf_pwm_seq_ptr_set(pwm, 0, pixels_pattern);
|
||||
nrf_pwm_seq_cnt_set(pwm, 0, sizeof(pixels_pattern)/2);
|
||||
nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
|
||||
|
@ -213,6 +213,7 @@
|
||||
<file file_name="../../lib/tinyusb/src/device/usbd.c" />
|
||||
<file file_name="../../lib/tinyusb/src/device/usbd.h" />
|
||||
<file file_name="../../lib/tinyusb/src/device/usbd_pvt.h" />
|
||||
<file file_name="../../lib/tinyusb/src/device/usbd_control.c" />
|
||||
</folder>
|
||||
<folder Name="osal">
|
||||
<file file_name="../../lib/tinyusb/src/osal/osal.c" />
|
||||
|
@ -130,7 +130,7 @@ int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buf
|
||||
|
||||
// Callback invoked when received WRITE10 command.
|
||||
// Process data in buffer to disk's storage and return number of written bytes
|
||||
int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)
|
||||
int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize)
|
||||
{
|
||||
(void) lun;
|
||||
|
||||
@ -148,4 +148,12 @@ int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* bu
|
||||
return (wr_ret < 0) ? bufsize : count;
|
||||
}
|
||||
|
||||
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size)
|
||||
{
|
||||
(void) lun;
|
||||
|
||||
*block_count = UF2_NUM_BLOCKS;
|
||||
*block_size = 512;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -43,8 +43,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "uf2/uf2cfg.h" // for block num
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
@ -98,12 +96,6 @@
|
||||
// Number of supported Logical Unit Number
|
||||
#define CFG_TUD_MSC_MAXLUN 1
|
||||
|
||||
// Number of Blocks
|
||||
#define CFG_TUD_MSC_BLOCK_NUM UF2_NUM_BLOCKS
|
||||
|
||||
// Block size
|
||||
#define CFG_TUD_MSC_BLOCK_SZ 512
|
||||
|
||||
// Buffer size for each read/write transfer, the more the better
|
||||
#define CFG_TUD_MSC_BUFSIZE (4*1024)
|
||||
|
||||
|
@ -158,7 +158,7 @@ void usb_teardown(void)
|
||||
void tud_mount_cb(void)
|
||||
{
|
||||
#ifdef LED_NEOPIXEL
|
||||
uint8_t grb[] = { 255, 0, 0 };
|
||||
uint8_t grb[3] = { 255, 0, 0 };
|
||||
neopixel_write(grb);
|
||||
#endif
|
||||
}
|
||||
@ -166,7 +166,7 @@ void tud_mount_cb(void)
|
||||
void tud_umount_cb(void)
|
||||
{
|
||||
#ifdef LED_NEOPIXEL
|
||||
uint8_t grb[] = { 0, 255, 0 };
|
||||
uint8_t grb[3] = { 0, 255, 0 };
|
||||
neopixel_write(grb);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user