@@ -42,16 +42,39 @@ class Adafruit_USBD_MSC : Adafruit_USBD_Interface
4242 void setMaxLun (uint8_t maxlun);
4343 uint8_t getMaxLun (void );
4444
45+ // ------------- Multiple LUN API -------------//
4546 void setID (uint8_t lun, const char * vendor_id, const char * product_id, const char * product_rev);
46-
4747 void setCapacity (uint8_t lun, uint32_t block_count, uint16_t block_size);
48- void getCapacity (uint8_t lun, uint32_t * block_count, uint16_t * block_size);
49-
5048 void setUnitReady (uint8_t lun, bool ready);
51-
5249 void setReadWriteCallback (uint8_t lun, read_callback_t rd_cb, write_callback_t wr_cb, flush_callback_t fl_cb);
5350 void setReadyCallback (uint8_t lun, ready_callback_t cb);
5451
52+ // ------------- Single LUN API -------------//
53+ void setID (const char * vendor_id, const char * product_id, const char * product_rev)
54+ {
55+ setID (0 , vendor_id, product_rev, product_rev);
56+ }
57+
58+ void setCapacity (uint32_t block_count, uint16_t block_size)
59+ {
60+ setCapacity (0 , block_count, block_size);
61+ }
62+
63+ void setUnitReady (bool ready)
64+ {
65+ setUnitReady (0 , ready);
66+ }
67+
68+ void setReadWriteCallback (read_callback_t rd_cb, write_callback_t wr_cb, flush_callback_t fl_cb)
69+ {
70+ setReadWriteCallback (0 , rd_cb, wr_cb, fl_cb);
71+ }
72+
73+ void setReadyCallback (ready_callback_t cb)
74+ {
75+ setReadyCallback (0 , cb);
76+ }
77+
5578 // from Adafruit_USBD_Interface
5679 virtual uint16_t getDescriptor (uint8_t * buf, uint16_t bufsize);
5780
@@ -76,11 +99,12 @@ class Adafruit_USBD_MSC : Adafruit_USBD_Interface
7699 uint8_t _maxlun;
77100
78101 // Make all tinyusb callback friend to access private data
102+ friend void tud_msc_inquiry_cb (uint8_t lun, uint8_t vendor_id[8 ], uint8_t product_id[16 ], uint8_t product_rev[4 ]);
103+ friend bool tud_msc_test_unit_ready_cb (uint8_t lun);
104+ friend void tud_msc_capacity_cb (uint8_t lun, uint32_t * block_count, uint16_t * block_size);
79105 friend int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void * buffer, uint32_t bufsize);
80106 friend int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, uint8_t * buffer, uint32_t bufsize);
81107 friend void tud_msc_write10_complete_cb (uint8_t lun);
82- friend void tud_msc_inquiry_cb (uint8_t lun, uint8_t vendor_id[8 ], uint8_t product_id[16 ], uint8_t product_rev[4 ]);
83- friend bool tud_msc_test_unit_ready_cb (uint8_t lun);
84108};
85109
86110#endif /* ADAFRUIT_USBD_MSC_H_ */
0 commit comments