Skip to content

Commit bb5e6a0

Browse files
committed
Merge Catena 4550 BSP. Remove not use variants and drivers.
1 parent c392140 commit bb5e6a0

File tree

1,861 files changed

+3987
-3121133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,861 files changed

+3987
-3121133
lines changed

.gitignore

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
1-
*.orig
2-
*.swp
3-
.DS_Store
4-
boards.local.txt
5-
platform.local.txt
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Compiled Dynamic libraries
12+
*.so
13+
*.dylib
14+
*.dll
15+
16+
# Fortran module files
17+
*.mod
18+
*.smod
19+
20+
# Compiled Static libraries
21+
*.lai
22+
*.la
23+
*.a
24+
*.lib
25+
26+
# Executables
27+
*.exe
28+
*.out
29+
*.app
30+
31+
# Backup files
32+
*.BAK
33+
*.CKP
34+
*~
35+
36+
# Visual Studio things (for the Visual Micro stuff)
37+
.vs
38+
Debug
39+
Release
40+
__vm
41+
*.vcxproj
42+
*.vcxproj.filters
43+
*.vcxproj.user
44+
*.sln
45+
46+
# VS Code things
47+
.vscode

boards.txt

Lines changed: 73 additions & 530 deletions
Large diffs are not rendered by default.

cores/arduino/HardwareSerial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ class HardwareSerial : public Stream
120120
using Print::write; // pull in write(str) and write(buf, size) from Print
121121
operator bool() { return true; }
122122

123+
bool dtr(void) { return true; }
124+
123125
void setRx(uint32_t _rx);
124126
void setTx(uint32_t _tx);
125127
void setRx(PinName _rx);

cores/arduino/stm32/usb_serial.cpp

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2010 Perry Hung.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @brief USB virtual serial terminal
29+
*/
30+
31+
/*
32+
* Arduino srl - www.arduino.org
33+
* 2016 Jun 9: Edited Francesco Alessi (alfran) - francesco@arduino.org
34+
*/
35+
36+
#ifdef USBCON
37+
38+
#include <string.h>
39+
40+
#include "wiring.h"
41+
#include "usb_serial.h"
42+
#include "usbd_core.h"
43+
#include "usbd_desc.h"
44+
#include "usbd_cdc.h"
45+
#include "usbd_cdc_desc.h"
46+
#include "usbd_cdc_if.h"
47+
48+
/* USB Device Core handle declaration */
49+
USBD_HandleTypeDef hUSBD_Device_CDC;
50+
51+
USBSerial SerialUSB;
52+
53+
54+
USBSerial::USBSerial(void)
55+
{
56+
if (USBD_Init(&hUSBD_Device_CDC, &CDC_Desc, DEVICE_FS) == USBD_OK)
57+
{
58+
59+
/* Add Supported Class */
60+
if (USBD_RegisterClass(&hUSBD_Device_CDC, USBD_CDC_CLASS) == USBD_OK)
61+
{
62+
63+
/* Add CDC Interface Class */
64+
if (USBD_CDC_RegisterInterface(&hUSBD_Device_CDC, &USBD_Interface_fops_FS) == USBD_OK)
65+
{
66+
67+
/* Start Device Process */
68+
USBD_Start(&hUSBD_Device_CDC);
69+
}
70+
}
71+
}
72+
}
73+
74+
/* USBSerial is always available and instantiated in main.cpp */
75+
void USBSerial::begin(void)
76+
{
77+
}
78+
79+
void USBSerial::end(void)
80+
{
81+
}
82+
83+
int USBSerial::availableForWrite(void)
84+
{
85+
return CDC_AvailableForWrite();
86+
}
87+
88+
size_t USBSerial::write(uint8_t ch)
89+
{
90+
return CDC_Write(&ch, 1);
91+
}
92+
93+
size_t USBSerial::write(const uint8_t *buffer, size_t size)
94+
{
95+
return CDC_Write(buffer, size);
96+
}
97+
98+
int USBSerial::available(void)
99+
{
100+
return CDC_AvailableForRead();
101+
}
102+
103+
int USBSerial::read(void)
104+
{
105+
return CDC_Read();
106+
}
107+
108+
int USBSerial::peek(void)
109+
{
110+
return CDC_Peek();
111+
}
112+
113+
void USBSerial::flush(void)
114+
{
115+
CDC_Flush();
116+
}
117+
118+
bool USBSerial::dtr(void)
119+
{
120+
uint32_t LineState = CDC_LineState();
121+
return LineState & 1;
122+
}
123+
124+
bool USBSerial::rts(void)
125+
{
126+
uint32_t LineState = CDC_LineState();
127+
return (LineState & 2) >> 1;
128+
}
129+
130+
bool USBSerial::isConnected(void)
131+
{
132+
return USBD_LL_ConnectionState();
133+
}
134+
135+
USBSerial::operator bool()
136+
{
137+
bool result = false;
138+
uint32_t LineState = CDC_LineState();
139+
140+
if (LineState & 1)
141+
result = true;
142+
delay(10);
143+
return result;
144+
}
145+
146+
#endif /* USBCON */

cores/arduino/stm32/usb_serial.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2010 Perry Hung.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @brief Wirish virtual serial port
29+
*/
30+
31+
/*
32+
* Arduino srl - www.arduino.org
33+
* 2016 Jun 9: Edited Francesco Alessi (alfran) - francesco@arduino.org
34+
*/
35+
36+
#ifndef _USB_SERIAL_H_
37+
#define _USB_SERIAL_H_
38+
39+
#ifdef USBCON
40+
41+
#include "Stream.h"
42+
43+
/**
44+
* @brief Virtual serial terminal.
45+
*/
46+
class USBSerial : public Stream {
47+
public:
48+
USBSerial(void);
49+
50+
void begin(void);
51+
void begin(unsigned long baud) { begin(); }
52+
void end(void);
53+
54+
virtual int available(void);
55+
virtual int peek(void);
56+
virtual void flush(void);
57+
virtual int read(void);
58+
59+
int availableForWrite(void);
60+
virtual size_t write(uint8_t);
61+
virtual size_t write(const uint8_t *buffer, size_t size);
62+
inline size_t write(unsigned long n) { return write((uint8_t)n); }
63+
inline size_t write(long n) { return write((uint8_t)n); }
64+
inline size_t write(unsigned int n) { return write((uint8_t)n); }
65+
inline size_t write(int n) { return write((uint8_t)n); }
66+
using Print::write;
67+
68+
bool dtr(void);
69+
bool rts(void);
70+
bool isConnected();
71+
72+
virtual operator bool(void);
73+
};
74+
75+
extern USBSerial SerialUSB;
76+
77+
#ifdef NO_HWSERIAL
78+
# define Serial SerialUSB
79+
#endif
80+
81+
#endif /* USBCON */
82+
83+
#endif /* _USB_SERIAL_H_ */

cores/arduino/wiring.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "WCharacter.h"
4747
#include "WMath.h"
4848
#include "WString.h"
49+
#include "usb_serial.h"
4950
#endif // __cplusplus
5051

5152
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )

cores/arduino/wiring_time.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ extern void delay( uint32_t dwMs ) ;
6060
* \param dwUs the number of microseconds to pause (uint32_t)
6161
*/
6262
static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused));
63-
static inline void delayMicroseconds(uint32_t usec){
64-
uint32_t start = GetCurrentMicro();
63+
static inline void delayMicroseconds(uint32_t usec)
64+
{
65+
uint32_t end;
6566

66-
while((start+usec) > GetCurrentMicro());
67+
if (usec == 0)
68+
return;
69+
70+
end = GetCurrentMicro() + usec;
71+
if (end < usec)
72+
while (end < GetCurrentMicro());
73+
while (end > GetCurrentMicro());
6774
}
6875

6976
#ifdef __cplusplus

0 commit comments

Comments
 (0)