48#define TX_DATA_SIZE 64
50#define RX_DATA_SIZE 64
55void*
operator new(
size_t size);
57void*
operator new[](
size_t size);
59void operator delete(
void* ptr);
61void operator delete[](
void* ptr);
64__extension__
typedef int __guard __attribute__((mode(__DI__)));
94 uint16_t product_id = 0x2012,
95 uint16_t product_release = 0x0001)
96 : USBCDC(vendor_id, product_id, product_release),
117 os_sem_post_from_isr(&
rxSem, &woken);
133#elif defined(TARGET_LPC2368)
138#error define how to yield on your CPU.
157 taskENTER_CRITICAL();
189 memcpy(&
txData[count], data, max_count);
221 portENTER_CRITICAL();
229 for (uint32_t i = 0; i <
rxSize; i++)
258void*
operator new(
size_t size)
263void*
operator new [](
size_t size)
264{
return malloc(size); }
void
265operator delete(
void* ptr)
noexcept(
true)
270void operator delete [](
void* ptr)
noexcept(
true)
void diewith(uint32_t pattern)
Sets a blinking pattern and never returns.
void signal_condition()
Signal the wakeup condition.
size_t consume(size_t items)
Remove a number of items from the buffer by advancing the readIndex.
void signal_condition_from_isr()
Signal the wakeup condition from an ISR context.
size_t data_read_pointer(T **buf)
Get a reference to the current location in the buffer for read.
const char * name
device name
This class is an empty wrapper around MBed's USB CDC class.
static const unsigned MAX_TX_PACKET_LENGTH
What's the maximum packet length for transmit.
MbedRawUSBSerial(const char *name, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001)
Constructor.
uint8_t rxData[MAX_RX_PACKET_LENGTH]
packet assembly buffer from host
uint32_t rxSize
number of valid characters in rxData
bool EP2_IN_callback() override
Callback when EP2_IN is active.
void enable() override
function to enable device
void tx_char() override
function to try and transmit a character
void disable() override
function to disable device
bool TxHelper()
Transmits count bytes from the txData buffer.
uint8_t txData[MAX_TX_PACKET_LENGTH]
packet assemby buffer to host
static void * _RxThread(void *arg)
Entry point to receiving thread.
bool txPending
transmission currently pending
os_sem_t rxSem
Semaphore to wake up receiving thread.
bool EP2_OUT_callback() override
Callback when EP2_OUT is active.
static const unsigned MAX_RX_PACKET_LENGTH
What's the maximum packet length for receive.
Private data for a serial device.
DeviceBuffer< uint8_t > * txBuf
transmit buffer
unsigned int overrunCount
overrun count
int __cxa_guard_acquire(__guard *)
C++ operator (not sure why this is needed).
void __cxa_guard_abort(__guard *)
C++ operator (not sure why this is needed).
void __cxa_pure_virtual(void)
C++ operator (not sure why this is needed).
void __cxa_guard_release(__guard *)
C++ operator (not sure why this is needed).
__extension__ typedef int __guard
not sure why this is needed.
MbedRawUSBSerial g_mbed_usb_serial("/dev/serUSB0")
Global object for the mbed usb serial.
int os_thread_create(os_thread_t *thread, const char *name, int priority, size_t stack_size, void *(*start_routine)(void *), void *arg)
Create a thread.
OS_INLINE int os_sem_init(os_sem_t *sem, unsigned int value)
Initialize a semaphore.
OS_INLINE int os_sem_wait(os_sem_t *sem)
Wait on a semaphore.
OS_INLINE int os_sem_destroy(os_sem_t *sem)
Destroy a semaphore.