uTrack
Loading...
Searching...
No Matches
Macros | Functions | Variables
utUSB.c File Reference

Support for treating the Yachbot as a USB device of some kind, currently only mass storage (MSC). More...

#include "uTrack.h"
#include "utHAL.h"
#include "utUSB.h"
#include "File_Config.h"
#include "LPC23xx.h"
#include <rl_usb.h>
#include "usb_lib.c"

Macros

#define TIME_BETWEEN_PRINTS   2000
 

Functions

bool utUSB_Notify (UT_DeviceMessage state)
 
void utUSB_Setup (void)
 
void utUSB_Connect (void)
 
void utUSB_Disconnect (void)
 
void utUSB_RequestMountNextConnection (bool request)
 
bool utUSB_IsPluggedIn (void)
 
void utUSB_UserEjected (void)
 
bool utUSB_StackShouldBeUp (void)
 

Variables

FAT_VI * mc0
 
Media_INFO info
 

Detailed Description

Support for treating the Yachbot as a USB device of some kind, currently only mass storage (MSC).

This software module can be configured to mount the SD card over USB provided the file system has been unmounted or disabled, and can also control charge via USB (specifically the current drawn by the charge chip).

Todo:

Device classes other than MSC

Non-specialised runtime support.

Author
Oscar Key
Date
16/05/2013

Macro Definition Documentation

◆ TIME_BETWEEN_PRINTS

#define TIME_BETWEEN_PRINTS   2000

Checks to see if the USB module expects the stack to be up.

Returns
True if the USB stack should be up according to module info.

Function Documentation

◆ utUSB_Connect()

void utUSB_Connect ( void  )

Attempt to launch the USB stack in MSC mode. Setting up the memory card can fail. If configured to do so, the USB will also request more current from the charge chip so that the unit charges properly.

◆ utUSB_Disconnect()

void utUSB_Disconnect ( void  )

Disconnect the USB stack.

◆ utUSB_IsPluggedIn()

bool utUSB_IsPluggedIn ( void  )

Check whether the USB is plugged in, using the VBUS line, which should be high iff there is a powered entity on the other end.

Returns
True if the unit is plugged into to something via USB.

◆ utUSB_Notify()

bool utUSB_Notify ( UT_DeviceMessage  state)

The Notify function passes a message to the software module, informing it of expected module state. It returns a value that is considered a response to a query about the specified state.

Parameters
stateA state message.
Returns
Whether or not this software module is in the desired state.

◆ utUSB_RequestMountNextConnection()

void utUSB_RequestMountNextConnection ( bool  request)

Request that the USB stack attempt to mount the file system the next time it is plugged in within this power cycle.

Parameters
requestWhether to mount or not.

◆ utUSB_Setup()

void utUSB_Setup ( void  )

Do the necessary configuration required before running the USB stack.

◆ utUSB_UserEjected()

void utUSB_UserEjected ( void  )

Tells the USB module that the user wants to remove the device. This sets a timer to forcibly drop the USB connection if the correct command sequence for doing so has not been processed (or has failed).