Skip to content

Commit 018e85f

Browse files
committed
Bugfix 01.02.01
1 parent 218f126 commit 018e85f

File tree

17 files changed

+73
-43
lines changed

17 files changed

+73
-43
lines changed

Doc/Doc.zip

4.82 MB
Binary file not shown.

Doc/EmbSysLib-Manual.pdf

-2.49 KB
Binary file not shown.

Example/Project/Virtual/CodeBlocks/Virtual.cbp

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<Add library="${EMBSYSLIB}/Src/Hardware/MCU/Virtual/Sys/libusb-1.0.a" />
6262
</Linker>
6363
<Unit filename="../../../Src/Board/Virtual/ReportHandler.h" />
64+
<Unit filename="../../../Src/Board/Virtual/board_pinout.txt" />
6465
<Unit filename="../../../Src/lib.cpp" />
6566
<Unit filename="../../../Src/main.cpp" />
6667
<Extensions>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
start "%EMBSYSLIB%\Tools\VirtualDeviceServer.exe" -d 320x240 -p 1000 -c "VirtualDeviceServer.config.txt"
1+
start "" "%EMBSYSLIB%\Tools\VirtualDeviceServer.exe" -d 320x240 -p 1000 -c "VirtualDeviceServer.config.txt"

Example/Src/Main/Device/DevDigital.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Usage: Connect board with a terminal.
2424
#include "config.h"
2525

2626
//*******************************************************************
27-
int main(void)
27+
int main( void )
2828
{
2929
terminal.printf( "\r\n\nDevDigital," __DATE__ "," __TIME__ "\r\n\n" );
3030

Example/Src/Main/Hardware/HwUSBhost.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ Code: Select control or interrupt transfer with
1818
*/
1919

2020
//*******************************************************************
21-
#define CTRL 1
22-
#define INTER 2
21+
#define USB_CTRL 1
22+
#define USB_INTER 2
23+
24+
#define USB_DEVICE_ENABLE
25+
2326

2427
///------------------------------------------------------------------
2528
/// Select an USB transfer type (CTRL|INTER):
26-
#define TRANSFER_TYPE INTER
29+
#define TRANSFER_TYPE USB_INTER
2730

2831
//*******************************************************************
2932
#include <stdio.h>
@@ -49,7 +52,7 @@ int main(int argc, char** argv)
4952
{
5053
bool err = true;
5154

52-
#if TRANSFER_TYPE == INTER
55+
#if TRANSFER_TYPE == USB_INTER
5356
//------------------------
5457
if( usb.writeInterrupt( writeBuffer ) )
5558
{
@@ -61,7 +64,7 @@ int main(int argc, char** argv)
6164
}
6265
}
6366

64-
#elif TRANSFER_TYPE == CTRL
67+
#elif TRANSFER_TYPE == USB_CTRL
6568
//------------------------
6669
if( usb.writeCtrl( writeBuffer ) )
6770
{

Src/Control/DigitalEncoder.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The FIFO can be read out asynchronously.
3333
3434
\example CtrlDigitalEncoder.cpp
3535
*/
36-
class DigitalEncoder : public TaskManager::Task
36+
class DigitalEncoder : protected TaskManager::Task
3737
{
3838
public:
3939
//---------------------------------------------------------------
@@ -80,15 +80,15 @@ class DigitalEncoder : public TaskManager::Task
8080
//
8181
//---------------------------------------------------------------
8282
// Checks Ctrl-Button.
83-
// The default implementation returns the event CTRL_DWN or
84-
// CTRL_UP if the button was pressed/released, otherwise NONE.
83+
// The default implementation returns the event CTRL_DWN or
84+
// CTRL_UP if the button was pressed/released, otherwise NONE.
8585
// The method can be overridden.
8686
//
8787
virtual Event getCtrl( void );
8888

8989
//---------------------------------------------------------------
9090
// Checks Increment (Right/Left).
91-
// Returns LEFT, RIGHT, NONE depending on the event.
91+
// Returns LEFT, RIGHT, NONE depending on the event.
9292
// Abstract method that must be implemented by derived class.
9393
virtual Event getIncrement( void ) = 0;
9494

Src/Control/DigitalIndicator.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ void DigitalIndicator::blink( WORD time, WORD duty )
8888
repeat = true;
8989
maximum = ((DWORD)time*1000)/cycleTime;
9090
limit = ((DWORD)MIN(duty,(WORD)100))*maximum/100;
91-
t = 0;
9291
runUpdate = true;
9392
}
9493

Src/Device/Digital/Digital.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Dev {
2222
/*!
2323
\class Digital
2424
25-
\brief Access to a digital GPIO port pin
25+
\brief Access to a digital port pin
2626
2727
This class is an interface to digital I/O devices.
2828

Src/Hardware/Common/Display/DisplayGraphic.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ DisplayGraphic::DisplayGraphic( WORD moduleId,
3434
, report( moduleId )
3535
{
3636
Hsize = width;
37-
Vsize = height;
37+
Vsize = height;
3838

39-
BackColor = RGB2color( 0, 0,255); // Blue
39+
BackColor = RGB2color( 0, 0, 0); // Black
4040
PaintColor = RGB2color(128,128,128); // Gray
4141
TextColor = RGB2color(255,255,255); // White
4242

Src/Hardware/MCU/STM32L1xx/Src/USBdevice_Mcu.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ typedef struct
4242
{
4343
struct
4444
{
45-
WORD addr;
46-
WORD reserved2;
47-
WORD count;
48-
WORD reserved1;
45+
volatile WORD addr;
46+
volatile WORD reserved2;
47+
volatile WORD count;
48+
volatile WORD reserved1;
4949
} bufDesc[16];
5050

5151
} USB_BufferDescriptionTable;
@@ -66,7 +66,7 @@ typedef struct
6666
//*******************************************************************
6767
//-------------------------------------------------------------------
6868
USBdevice_Mcu *USBdevice_Mcu::usbPtr = 0;
69-
WORD USBdevice_Mcu::EPconfig::offset = sizeof(USB_BufferDescriptionTable);
69+
volatile WORD USBdevice_Mcu::EPconfig::offset = sizeof(USB_BufferDescriptionTable);
7070

7171
//-------------------------------------------------------------------
7272
USBdevice_Mcu::USBdevice_Mcu( USBdeviceDescriptor &desc )
@@ -79,7 +79,7 @@ USBdevice_Mcu::USBdevice_Mcu( USBdeviceDescriptor &desc )
7979
//-------------------------------------------------------------------
8080
inline void USBdevice_Mcu::isr(void)
8181
{
82-
DWORD istr = USB->ISTR;
82+
volatile DWORD istr = USB->ISTR;
8383

8484
if( istr & USB_ISTR_RESET )
8585
{
@@ -257,7 +257,7 @@ WORD USBdevice_Mcu::readEP( BYTE epAddr,
257257
WORD len )
258258
{
259259
BYTE num = epAddr & 0x07;
260-
WORD *ptr = EP[num].rxPtr;
260+
volatile WORD *ptr = EP[num].rxPtr;
261261

262262
if( !(epAddr & 0x80) && ptr )
263263
{
@@ -284,7 +284,7 @@ WORD USBdevice_Mcu::writeEP( BYTE epAddr,
284284
WORD cnt )
285285
{
286286
BYTE num = epAddr & 0x07;
287-
WORD *ptr = EP[num].txPtr;
287+
volatile WORD *ptr = EP[num].txPtr;
288288

289289
if( (epAddr & 0x80) && ptr)
290290
{

Src/Hardware/MCU/STM32L1xx/Src/USBdevice_Mcu.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ class USBdevice_Mcu : public USBdevice
8787
void setSTAT_TX(DWORD stat );
8888

8989
//-----------------------------------------------------------
90-
DWORD config;
91-
DWORD *regPtr;
92-
DWORD addr;
93-
WORD rxSize;
94-
WORD txSize;
95-
WORD *txPtr;
96-
WORD *rxPtr;
90+
volatile DWORD config;
91+
volatile DWORD *regPtr;
92+
volatile DWORD addr;
93+
volatile WORD rxSize;
94+
volatile WORD txSize;
95+
volatile WORD *txPtr;
96+
volatile WORD *rxPtr;
9797

9898
//------------------------------------------------------------
99-
static WORD offset;
99+
volatile static WORD offset;
100100

101101
}; //class EPconfig
102102
//***************************************************************

Src/Hardware/MCU/STM32L1xx/System.cpp

+23-6
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ void SystemInit( void )
180180

181181
// Power Control Register
182182
PWR->CR = PWR_CR_VOS_0; // Voltage scaling range selection: range 1 (1.8 V)
183-
while( PWR->CSR & PWR_CSR_VOSF ); // Wait until voltage regulator is ready
183+
while( PWR->CSR & PWR_CSR_VOSF ) // Wait until voltage regulator is ready
184+
{
185+
asm volatile("nop");
186+
}
184187

185188
// Clock Configuration Register
186189
RCC->CFGR |= RCC_CFGR_HPRE_DIV1; // AHB prescaler: HCLK = SYSCLK
@@ -256,14 +259,21 @@ void SystemInit( void )
256259
RCC->CR |= (RCC_CR_HSEON | RCC_CR_HSEBYP);
257260
#endif
258261
const DWORD pll_Src = RCC_CFGR_PLLSRC_HSE;
259-
while( !(RCC->CR & RCC_CR_HSERDY) ); // wait for HSE ready
260-
262+
while( !(RCC->CR & RCC_CR_HSERDY) ) // wait for HSE ready
263+
{
264+
asm volatile("nop");
265+
}
266+
261267
//--- HSI --------------------------------------------------------
262268
#elif OSCSRC == HSI
263269

264270
RCC->CR |= RCC_CR_HSION;
265271
const DWORD pll_Src = RCC_CFGR_PLLSRC_HSI;
266-
while( !(RCC->CR & RCC_CR_HSIRDY) ); // wait for HSI ready
272+
while( !(RCC->CR & RCC_CR_HSIRDY) ) // wait for HSI ready
273+
{
274+
asm volatile("nop");
275+
}
276+
267277
#undef OSCFREQ
268278
#define OSCFREQ 16000
269279

@@ -304,13 +314,20 @@ void SystemInit( void )
304314

305315
// Clock control register
306316
RCC->CR |= RCC_CR_PLLON; // PLL enable: ON
307-
while( !(RCC->CR & RCC_CR_PLLRDY) );// Wait until PLL is ready
317+
while( !(RCC->CR & RCC_CR_PLLRDY) )// Wait until PLL is ready
318+
{
319+
asm volatile("nop");
320+
}
308321

309322
// Clock Configuration Register
310323
RCC->CFGR |= RCC_CFGR_SW_PLL; // System clock switch: PLL used as system clock
311324

312325
// Wait for system clock switch is ready
313-
while( (RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL );
326+
while( (RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL )
327+
{
328+
asm volatile("nop");
329+
}
330+
314331

315332
//<<< Enable HSE or clock, set PLL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
316333

Src/Module/USB/USB_Uart.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ License: See file "LICENSE"
88
*/
99

1010
//*******************************************************************
11-
#ifndef _HW_USB_Uart_H
12-
#define _HW_USB_Uart_H
11+
#ifndef _MOD_USB_Uart_H
12+
#define _MOD_USB_Uart_H
1313

1414
//*******************************************************************
1515
#include "Mcu_Types.h"

Src/Module/USB/USBdeviceSimpleIO.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ License: See file "LICENSE"
88
*/
99

1010
//*******************************************************************
11-
#ifndef _HW_USB_DEVICE_SIMPLE_IO_H
12-
#define _HW_USB_DEVICE_SIMPLE_IO_H
11+
#ifndef _MOD_USB_DEVICE_SIMPLE_IO_H
12+
#define _MOD_USB_DEVICE_SIMPLE_IO_H
1313

1414
//*******************************************************************
1515
namespace EmbSysLib {

Src/Module/USB/USBinterfClassHID.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ License: See file "LICENSE"
88
*/
99

1010
//*******************************************************************
11-
#ifndef _HW_USB_INTERF_CLASS_HID_H
12-
#define _HW_USB_INTERF_CLASS_HID_H
11+
#ifndef _MOD_USB_INTERF_CLASS_HID_H
12+
#define _MOD_USB_INTERF_CLASS_HID_H
1313

1414
//*******************************************************************
1515
namespace EmbSysLib {

Version.txt

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
ver-01.02.01
2+
============
3+
* Bug fix:
4+
- Additional "" in batch files starting an app
5+
- typo corrected
6+
- #defines corrected (name missmatch)
7+
- DisplayGraphic default black background
8+
- STM32L1xx: asm("NOP") and "volatile" added to avoid compiler optimization
9+
- Missing ATmega Documentation
10+
111
ver-01.02.00
212
============
313
* Bug fix:

0 commit comments

Comments
 (0)