Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
50b81fa5
Commit
50b81fa5
authored
Oct 03, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced usbdesc.c for usbdbg.c where USB debug was used
parent
fe8b73c7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
11 additions
and
313 deletions
+11
-313
gps.c
sw/common/drivers/gps.c
+0
-13
gps.h
sw/common/drivers/gps.h
+1
-1
usbdesc.c
sw/common/usb/usbdesc.c
+0
-84
usbdesc.h
sw/common/usb/usbdesc.h
+0
-207
Makefile
sw/freertos/Makefile
+0
-1
compass.c
sw/freertos/src/apps/compass.c
+2
-3
game.c
sw/freertos/src/apps/game.c
+1
-2
gpscoord.c
sw/freertos/src/apps/gpscoord.c
+2
-2
main.c
sw/freertos/src/main.c
+5
-0
No files found.
sw/common/drivers/gps.c
View file @
50b81fa5
...
...
@@ -46,7 +46,6 @@
#include <drivers/gps.h>
#include <nmea/nmea.h>
#include <usbconfig.h>
#include <usbdbg.h>
static
char
rxbuf
[
GPS_RXBUF_SIZE
];
...
...
@@ -74,10 +73,6 @@ void gps_init()
{
int
i
;
#if defined(GPS_DBG)
usbdbg_init
();
#endif
/* Init GPS control pins & delay before ON_OFF pulse */
USB
->
ROUTE
&=
~
(
USB_ROUTE_VBUSENPEN
);
GPIO_PinModeSet
(
gpioPortF
,
5
,
gpioModePushPull
,
1
);
...
...
@@ -151,14 +146,6 @@ void gps_set_framerdy(int param)
framerdy
=
param
;
}
static
void
dbg
()
{
int
i
;
GPIO_PinOutSet
(
gpioPortE
,
11
);
for
(
i
=
0
;
i
<
100000
;
i
++
)
;
GPIO_PinOutClear
(
gpioPortE
,
11
);
}
void
gps_parse_nmea
(
const
char
*
buf
)
{
// TODO: check return of nmea_parse
...
...
sw/common/drivers/gps.h
View file @
50b81fa5
...
...
@@ -43,7 +43,7 @@
/*=============*/
/* GPS defines */
/*=============*/
//
#define GPS_DBG 1
#define GPS_DBG 1
#define GPS_OK_TO_SEND "$PSRF150,1*3E\r\n"
...
...
sw/common/usb/usbdesc.c
deleted
100644 → 0
View file @
fe8b73c7
#include "usbdesc.h"
/* The serial port LINE CODING data structure, used to carry information */
/* about serial port baudrate, parity etc. between host and device. */
EFM32_PACK_START
(
1
)
struct
__attribute__
((
packed
))
cdc_line_coding
{
uint32_t
dwDTERate
;
/** Baudrate */
uint8_t
bCharFormat
;
/** Stop bits, 0=1 1=1.5 2=2 */
uint8_t
bParityType
;
/** 0=None 1=Odd 2=Even 3=Mark 4=Space */
uint8_t
bDataBits
;
/** 5, 6, 7, 8 or 16 */
uint8_t
dummy
;
/** To ensure size is a multiple of 4 bytes.*/
};
EFM32_PACK_END
()
/*** Variables ***/
/*
* The LineCoding variable must be 4-byte aligned as it is used as USB
* transmit and receive buffer
*/
EFM32_ALIGN
(
4
)
EFM32_PACK_START
(
1
)
static
struct
cdc_line_coding
__attribute__
((
aligned
(
4
)))
line_coding
=
{
4800
,
2
,
0
,
8
,
0
};
EFM32_PACK_END
()
/**************************************************************************//**
* @brief
* Handle USB setup commands. Implements CDC class specific commands.
*
* @param[in] setup Pointer to the setup packet received.
*
* @return USB_STATUS_OK if command accepted.
* USB_STATUS_REQ_UNHANDLED when command is unknown, the USB device
* stack will handle the request.
*****************************************************************************/
int
usbdesc_cb_setup
(
const
USB_Setup_TypeDef
*
setup
)
{
int
r
=
USB_STATUS_REQ_UNHANDLED
;
if
((
setup
->
Type
==
USB_SETUP_TYPE_CLASS
)
&&
(
setup
->
Recipient
==
USB_SETUP_RECIPIENT_INTERFACE
))
{
switch
(
setup
->
bRequest
)
{
case
USB_CDC_GETLINECODING
:
/********************/
if
((
setup
->
wValue
==
0
)
&&
(
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
7
)
&&
(
setup
->
Direction
==
USB_SETUP_DIR_IN
))
{
/* Send current settings to USB host. */
USBD_Write
(
0
,
(
void
*
)
&
line_coding
,
7
,
NULL
);
r
=
USB_STATUS_OK
;
}
break
;
case
USB_CDC_SETLINECODING
:
/********************/
if
((
setup
->
wValue
==
0
)
&&
(
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
7
)
&&
(
setup
->
Direction
!=
USB_SETUP_DIR_IN
))
{
/* Get new settings from USB host. */
USBD_Read
(
0
,
(
void
*
)
&
line_coding
,
7
,
NULL
);
r
=
USB_STATUS_OK
;
}
break
;
case
USB_CDC_SETCTRLLINESTATE
:
/********************/
if
((
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
0
))
{
/* Do nothing ( Non compliant behaviour !! ) */
r
=
USB_STATUS_OK
;
}
break
;
}
}
return
r
;
}
sw/common/usb/usbdesc.h
deleted
100644 → 0
View file @
fe8b73c7
/***************************************************************************//**
* @file descriptors.h
* @brief USB descriptors for CDC Serial Port adapter example project.
* @version 3.20.5
*******************************************************************************
* @section License
* <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
*******************************************************************************
*
* This file is licensensed under the Silabs License Agreement. See the file
* "Silabs_License_Agreement.txt" for details. Before using this software for
* any purpose, you must agree to the terms of that agreement.
*
******************************************************************************/
#ifdef __cplusplus
extern
"C"
{
#endif
#include "em_usb.h"
/*=====================*/
/* Function prototypes */
/*=====================*/
int
usbdesc_cb_setup
(
const
USB_Setup_TypeDef
*
setup
);
/*===============================*/
/* Define USB endpoint addresses */
/*===============================*/
#define USBDESC_EP_DATA_IN 0x01
/* Endpoint for USB data reception. */
#define USBDESC_EP_DATA_OUT 0x81
/* Endpoint for USB data transmission. */
#define USBDESC_EP_NOTIFY 0x82
/* The notification endpoint (not used). */
#define USBDESC_BULK_EP_SIZE USB_MAX_EP_SIZE
/* This is the max. ep size. */
EFM32_ALIGN
(
4
)
static
const
USB_DeviceDescriptor_TypeDef
deviceDesc
__attribute__
((
aligned
(
4
)))
=
{
.
bLength
=
USB_DEVICE_DESCSIZE
,
.
bDescriptorType
=
USB_DEVICE_DESCRIPTOR
,
.
bcdUSB
=
0x0200
,
.
bDeviceClass
=
USB_CLASS_CDC
,
.
bDeviceSubClass
=
0
,
.
bDeviceProtocol
=
0
,
.
bMaxPacketSize0
=
USB_EP0_SIZE
,
.
idVendor
=
0x10c4
,
.
idProduct
=
0x00ff
,
.
bcdDevice
=
0x0000
,
.
iManufacturer
=
1
,
.
iProduct
=
2
,
.
iSerialNumber
=
0
,
.
bNumConfigurations
=
1
};
#define CONFIG_DESCSIZE ( USB_CONFIG_DESCSIZE + \
(
USB_INTERFACE_DESCSIZE
*
2
)
+
\
(
USB_ENDPOINT_DESCSIZE
*
NUM_EP_USED
)
+
\
USB_CDC_HEADER_FND_DESCSIZE
+
\
USB_CDC_CALLMNG_FND_DESCSIZE
+
\
USB_CDC_ACM_FND_DESCSIZE
+
\
5
)
EFM32_ALIGN
(
4
)
static
const
uint8_t
configDesc
[]
__attribute__
((
aligned
(
4
)))
=
{
/*** Configuration descriptor ***/
USB_CONFIG_DESCSIZE
,
/* bLength */
USB_CONFIG_DESCRIPTOR
,
/* bDescriptorType */
CONFIG_DESCSIZE
,
/* wTotalLength (LSB) */
USB_CONFIG_DESCSIZE
>>
8
,
/* wTotalLength (MSB) */
2
,
/* bNumInterfaces */
1
,
/* bConfigurationValue */
0
,
/* iConfiguration */
CONFIG_DESC_BM_RESERVED_D7
|
/* bmAttrib: Self powered */
CONFIG_DESC_BM_SELFPOWERED
,
CONFIG_DESC_MAXPOWER_mA
(
100
),
/* bMaxPower: 100 mA */
/*** Communication Class Interface descriptor (interface no. 0) ***/
USB_INTERFACE_DESCSIZE
,
/* bLength */
USB_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
0
,
/* bInterfaceNumber */
0
,
/* bAlternateSetting */
1
,
/* bNumEndpoints */
USB_CLASS_CDC
,
/* bInterfaceClass */
USB_CLASS_CDC_ACM
,
/* bInterfaceSubClass */
0
,
/* bInterfaceProtocol */
0
,
/* iInterface */
/*** CDC Header Functional descriptor ***/
USB_CDC_HEADER_FND_DESCSIZE
,
/* bFunctionLength */
USB_CS_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
USB_CLASS_CDC_HFN
,
/* bDescriptorSubtype */
0x20
,
/* bcdCDC spec.no LSB */
0x01
,
/* bcdCDC spec.no MSB */
/*** CDC Call Management Functional descriptor ***/
USB_CDC_CALLMNG_FND_DESCSIZE
,
/* bFunctionLength */
USB_CS_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
USB_CLASS_CDC_CMNGFN
,
/* bDescriptorSubtype */
0
,
/* bmCapabilities */
1
,
/* bDataInterface */
/*** CDC Abstract Control Management Functional descriptor ***/
USB_CDC_ACM_FND_DESCSIZE
,
/* bFunctionLength */
USB_CS_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
USB_CLASS_CDC_ACMFN
,
/* bDescriptorSubtype */
0x02
,
/* bmCapabilities */
/* The capabilities that this configuration supports: */
/* D7..D4: RESERVED (Reset to zero) */
/* D3: 1 - Device supports the notification Network_Connection. */
/* D2: 1 - Device supports the request Send_Break */
/* D1: 1 - Device supports the request combination of Set_Line_Coding, */
/* Set_Control_Line_State, Get_Line_Coding, and the */
/* notification Serial_State. */
/* D0: 1 - Device supports the request combination of Set_Comm_Feature, */
/* Clear_Comm_Feature, and Get_Comm_Feature. */
/*** CDC Union Functional descriptor ***/
5
,
/* bFunctionLength */
USB_CS_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
USB_CLASS_CDC_UNIONFN
,
/* bDescriptorSubtype */
0
,
/* bControlInterface, itf. no. 0 */
1
,
/* bSubordinateInterface0, itf. no. 1 */
/*** CDC Notification endpoint descriptor ***/
USB_ENDPOINT_DESCSIZE
,
/* bLength */
USB_ENDPOINT_DESCRIPTOR
,
/* bDescriptorType */
USBDESC_EP_NOTIFY
,
/* bEndpointAddress (IN) */
USB_EPTYPE_INTR
,
/* bmAttributes */
USBDESC_BULK_EP_SIZE
,
/* wMaxPacketSize (LSB) */
0
,
/* wMaxPacketSize (MSB) */
0xFF
,
/* bInterval */
/*** Data Class Interface descriptor (interface no. 1) ***/
USB_INTERFACE_DESCSIZE
,
/* bLength */
USB_INTERFACE_DESCRIPTOR
,
/* bDescriptorType */
1
,
/* bInterfaceNumber */
0
,
/* bAlternateSetting */
2
,
/* bNumEndpoints */
USB_CLASS_CDC_DATA
,
/* bInterfaceClass */
0
,
/* bInterfaceSubClass */
0
,
/* bInterfaceProtocol */
0
,
/* iInterface */
/*** CDC Data interface endpoint descriptors ***/
USB_ENDPOINT_DESCSIZE
,
/* bLength */
USB_ENDPOINT_DESCRIPTOR
,
/* bDescriptorType */
USBDESC_EP_DATA_IN
,
/* bEndpointAddress (IN) */
USB_EPTYPE_BULK
,
/* bmAttributes */
USBDESC_BULK_EP_SIZE
,
/* wMaxPacketSize (LSB) */
0
,
/* wMaxPacketSize (MSB) */
0
,
/* bInterval */
USB_ENDPOINT_DESCSIZE
,
/* bLength */
USB_ENDPOINT_DESCRIPTOR
,
/* bDescriptorType */
USBDESC_EP_DATA_OUT
,
/* bEndpointAddress (OUT)*/
USB_EPTYPE_BULK
,
/* bmAttributes */
USBDESC_BULK_EP_SIZE
,
/* wMaxPacketSize (LSB) */
0
,
/* wMaxPacketSize (MSB) */
0
/* bInterval */
};
STATIC_CONST_STRING_DESC_LANGID
(
langID
,
0x04
,
0x09
);
STATIC_CONST_STRING_DESC
(
iManufacturer
,
'S'
,
'i'
,
'l'
,
'i'
,
'c'
,
'o'
,
'n'
,
' '
,
'L'
,
\
'a'
,
'b'
,
'o'
,
'r'
,
'a'
,
't'
,
'o'
,
'r'
,
'i'
,
\
'e'
,
's'
,
' '
,
'I'
,
'n'
,
'c'
,
'.'
);
STATIC_CONST_STRING_DESC
(
iProduct
,
'E'
,
'F'
,
'M'
,
'3'
,
'2'
,
' '
,
'U'
,
'S'
,
'B'
,
\
' '
,
'C'
,
'D'
,
'C'
,
' '
,
's'
,
'e'
,
'r'
,
'i'
,
\
'a'
,
'l'
,
' '
,
'p'
,
'o'
,
'r'
,
't'
,
' '
,
'd'
,
\
'e'
,
'v'
,
'i'
,
'c'
,
'e'
);
static
const
void
*
const
strings
[]
=
{
&
langID
,
&
iManufacturer
,
&
iProduct
,
};
/* Endpoint buffer sizes */
/* 1 = single buffer, 2 = double buffering, 3 = triple buffering ... */
/* Use double buffering on the BULK endpoints. */
static
const
uint8_t
bufferingMultiplier
[
NUM_EP_USED
+
1
]
=
{
1
,
1
,
2
,
2
};
static
const
USBD_Callbacks_TypeDef
callbacks
=
{
.
usbReset
=
NULL
,
.
usbStateChange
=
NULL
,
.
setupCmd
=
usbdesc_cb_setup
,
.
isSelfPowered
=
NULL
,
.
sofInt
=
NULL
};
static
const
USBD_Init_TypeDef
initstruct
=
{
.
deviceDescriptor
=
&
deviceDesc
,
.
configDescriptor
=
configDesc
,
.
stringDescriptors
=
strings
,
.
numberOfStrings
=
sizeof
(
strings
)
/
sizeof
(
void
*
),
.
callbacks
=
&
callbacks
,
.
bufferingMultiplier
=
bufferingMultiplier
,
.
reserved
=
0
};
#ifdef __cplusplus
}
#endif
sw/freertos/Makefile
View file @
50b81fa5
...
...
@@ -178,7 +178,6 @@ C_SRC += \
../common/usb/src/em_usbdep.c
\
../common/usb/src/em_usbdint.c
\
../common/usb/src/em_usbtimer.c
\
../common/usb/usbdesc.c
\
../common/usb/usbdbg.c
\
../common/nmealib/src/context.c
\
../common/nmealib/src/generate.c
\
...
...
sw/freertos/src/apps/compass.c
View file @
50b81fa5
...
...
@@ -29,7 +29,7 @@
#include <drivers/lsm303c.h>
#include <bitmaps.h>
#include <sincos.h>
#include <usbd
esc
.h>
#include <usbd
bg
.h>
#define COMP_R 50.0
#define COMP_X0 64
...
...
@@ -114,7 +114,6 @@ void compass_main(void *params)
/*lsm303 init, we need both ACC & MAG for tilt/roll compensation*/
lsm303_init
();
USBD_Init
(
&
initstruct
);
ui_clear
();
ui_init_widget
(
&
compass_screen
);
...
...
@@ -175,7 +174,7 @@ void compass_main(void *params)
pitch
=
-
small_atan
(
acc
.
x
,
small_sqrt
(
acc
.
y
*
acc
.
y
+
acc
.
z
*
acc
.
z
));
roll
=
small_atan
(
acc
.
y
,
small_sqrt
(
acc
.
x
*
acc
.
x
+
acc
.
z
*
acc
.
z
));
sprintf
(
buf
,
"p: %d, r: %d
\n\r
"
,
pitch
,
roll
);
USBD_Write
(
USBDESC_EP_DATA_OUT
,
(
void
*
)
buf
,
strlen
(
buf
),
NULL
);
usbdbg_puts
(
buf
);
/* work with compass readout, first revert it because magnetic south is north */
mag
.
x
*=
-
1
;
mag
.
y
*=
-
1
;
...
...
sw/freertos/src/apps/game.c
View file @
50b81fa5
...
...
@@ -28,7 +28,7 @@
#include "widgets/status_bar.h"
#include <drivers/lsm303c.h>
#include <sincos.h>
#include <usbd
esc
.h>
#include <usbd
bg
.h>
#define S_WIN_X0 5
#define S_WIN_Y0 25
...
...
@@ -100,7 +100,6 @@ void game_main(void *params)
int
dir
=
0
,
fact
;
lsm303_init
();
USBD_Init
(
&
initstruct
);
buzzer_set_freq
(
4000
);
ball_x
=
64
;
ball_y
=
64
;
...
...
sw/freertos/src/apps/gpscoord.c
View file @
50b81fa5
...
...
@@ -165,9 +165,9 @@ void gpscoord_main(void *params)
}
break
;
case
RTC_TICK
:
ui_update
(
&
evt
);
ui_update
(
&
evt
);
default:
break
;
break
;
}
}
}
...
...
sw/freertos/src/main.c
View file @
50b81fa5
...
...
@@ -36,6 +36,9 @@
#include <drivers/lcd.h>
#include <drivers/rtc.h>
#include <drivers/vibra.h>
#include <drivers/gps.h>
#include <usbdbg.h>
#include <gfx/ui.h>
#include <apps/app_list.h>
...
...
@@ -63,6 +66,8 @@ int main(void)
lcd_init
();
gps_init
();
usbdbg_init
();
ui_init
();
auto_backlight_init
();
battery_monitor_init
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment