Skip to content

Commit

Permalink
Upconvert several targets' form factors to ARDUINO_UNO (#359)
Browse files Browse the repository at this point in the history
* Upconvert several targets' form factors to arduino uno

* Oops fix some unintentional changes

* Add MCU description, fix pin validation errors
  • Loading branch information
multiplemonomials authored Sep 25, 2024
1 parent 626d795 commit 44ce176
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 327 deletions.
36 changes: 18 additions & 18 deletions drivers/usb/include/usb/internal/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace events {
*/


template<typename F, typename A1 = void, typename A2 = void, typename A3 = void, typename A4 = void, typename A5 = void>
template<typename F, typename ARG1 = void, typename ARG2 = void, typename ARG3 = void, typename ARG4 = void, typename ARG5 = void>
struct AllArgs;

template<typename B0>
Expand Down Expand Up @@ -543,24 +543,24 @@ class Task<R()>: public TaskBase {
All _args;
};

template <typename R, typename A0>
class Task<R(A0)>: public TaskBase {
template <typename R, typename ARG0>
class Task<R(ARG0)>: public TaskBase {
public:

Task(TaskQueue *q = NULL, mbed::Callback<R(A0)> cb = mbed::Callback<R(A0)>())
Task(TaskQueue *q = NULL, mbed::Callback<R(ARG0)> cb = mbed::Callback<R(ARG0)>())
: TaskBase(q), _args(cb)
{
}

Task &operator=(mbed::Callback<R(A0)> cb)
Task &operator=(mbed::Callback<R(ARG0)> cb)
{
_args.b0 = cb;
return *this;
}

void call(A0 a0)
void call(ARG0 arg0)
{
_args.b1 = a0;
_args.b1 = arg0;
post();
}

Expand All @@ -578,16 +578,16 @@ class Task<R(A0)>: public TaskBase {
}

private:
typedef AllArgs<mbed::Callback<R(A0)>, A0> All;
typedef AllArgs<mbed::Callback<R(ARG0)>, ARG0> All;
All _args;
};

/** Task
*
* Representation of a postable task
*/
template <typename R, typename A0, typename A1>
class Task<R(A0, A1)>: public TaskBase {
template <typename R, typename ARG0, typename ARG1>
class Task<R(ARG0, ARG1)>: public TaskBase {
public:

/**
Expand All @@ -596,7 +596,7 @@ class Task<R(A0, A1)>: public TaskBase {
* @param q TaskQueue to post to
* @param cb Callback to run
*/
Task(TaskQueue *q = NULL, mbed::Callback<R(A0, A1)> cb = mbed::Callback<R(A0, A1)>())
Task(TaskQueue *q = NULL, mbed::Callback<R(ARG0, ARG1)> cb = mbed::Callback<R(ARG0, ARG1)>())
: TaskBase(q), _args(cb)
{
}
Expand All @@ -606,7 +606,7 @@ class Task<R(A0, A1)>: public TaskBase {
*
* @param cb Callback to run
*/
Task &operator=(mbed::Callback<R(A0, A1)> cb)
Task &operator=(mbed::Callback<R(ARG0, ARG1)> cb)
{
_args.b0 = cb;
return *this;
Expand All @@ -620,13 +620,13 @@ class Task<R(A0, A1)>: public TaskBase {
* expects two integers as arguments to call, while Task<void()>
* expects no arguments.
*
* @param a0 First callback parameter
* @param a1 Second callback parameter
* @param arg0 First callback parameter
* @param arg1 Second callback parameter
*/
void call(A0 a0, A1 a1)
void call(ARG0 arg0, ARG1 arg1)
{
_args.b1 = a0;
_args.b2 = a1;
_args.b1 = arg0;
_args.b2 = arg1;
post();
}

Expand All @@ -644,7 +644,7 @@ class Task<R(A0, A1)>: public TaskBase {
}

private:
typedef AllArgs<mbed::Callback<R(A0, A1)>, A0, A1> All;
typedef AllArgs<mbed::Callback<R(ARG0, ARG1)>, ARG0, ARG1> All;
All _args;
};

Expand Down
98 changes: 23 additions & 75 deletions targets/TARGET_Cypress/TARGET_PSOC6/PinNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,18 @@
// LEDs
#ifdef CYBSP_USER_LED1
#define LED1 CYBSP_USER_LED1
#else
#define LED1 NC
#endif
#ifdef CYBSP_USER_LED2
#define LED2 CYBSP_USER_LED2
#else
#define LED2 NC
#endif
#ifdef CYBSP_USER_LED3
#define LED3 CYBSP_USER_LED3
#else
#define LED3 NC
#endif
#ifdef CYBSP_USER_LED4
#define LED4 CYBSP_USER_LED4
#else
#define LED4 NC
#endif
#ifdef CYBSP_USER_LED5
#define LED5 CYBSP_USER_LED5
#else
#define LED5 NC
#endif

#ifdef CYBSP_LED_RGB_RED
Expand Down Expand Up @@ -152,71 +142,29 @@
#endif

// Arduino Header
#ifdef CYBSP_A0
#define A0 CYBSP_A0
#endif
#ifdef CYBSP_A1
#define A1 CYBSP_A1
#endif
#ifdef CYBSP_A2
#define A2 CYBSP_A2
#endif
#ifdef CYBSP_A3
#define A3 CYBSP_A3
#endif
#ifdef CYBSP_A4
#define A4 CYBSP_A4
#endif
#ifdef CYBSP_A5
#define A5 CYBSP_A5
#endif
#ifdef CYBSP_D0
#define D0 CYBSP_D0
#endif
#ifdef CYBSP_D1
#define D1 CYBSP_D1
#endif
#ifdef CYBSP_D2
#define D2 CYBSP_D2
#endif
#ifdef CYBSP_D3
#define D3 CYBSP_D3
#endif
#ifdef CYBSP_D4
#define D4 CYBSP_D4
#endif
#ifdef CYBSP_D5
#define D5 CYBSP_D5
#endif
#ifdef CYBSP_D6
#define D6 CYBSP_D6
#endif
#ifdef CYBSP_D7
#define D7 CYBSP_D7
#endif
#ifdef CYBSP_D8
#define D8 CYBSP_D8
#endif
#ifdef CYBSP_D9
#define D9 CYBSP_D9
#endif
#ifdef CYBSP_D10
#define D10 CYBSP_D10
#endif
#ifdef CYBSP_D11
#define D11 CYBSP_D11
#endif
#ifdef CYBSP_D12
#define D12 CYBSP_D12
#endif
#ifdef CYBSP_D13
#define D13 CYBSP_D13
#endif
#ifdef CYBSP_D14
#define D14 CYBSP_D14
#endif
#ifdef CYBSP_D15
#define D15 CYBSP_D15
#ifdef TARGET_FF_ARDUINO_UNO
#define ARDUINO_UNO_A0 CYBSP_A0
#define ARDUINO_UNO_A1 CYBSP_A1
#define ARDUINO_UNO_A2 CYBSP_A2
#define ARDUINO_UNO_A3 CYBSP_A3
#define ARDUINO_UNO_A4 CYBSP_A4
#define ARDUINO_UNO_A5 CYBSP_A5
#define ARDUINO_UNO_D0 CYBSP_D0
#define ARDUINO_UNO_D1 CYBSP_D1
#define ARDUINO_UNO_D2 CYBSP_D2
#define ARDUINO_UNO_D3 CYBSP_D3
#define ARDUINO_UNO_D4 CYBSP_D4
#define ARDUINO_UNO_D5 CYBSP_D5
#define ARDUINO_UNO_D6 CYBSP_D6
#define ARDUINO_UNO_D7 CYBSP_D7
#define ARDUINO_UNO_D8 CYBSP_D8
#define ARDUINO_UNO_D9 CYBSP_D9
#define ARDUINO_UNO_D10 CYBSP_D10
#define ARDUINO_UNO_D11 CYBSP_D11
#define ARDUINO_UNO_D12 CYBSP_D12
#define ARDUINO_UNO_D13 CYBSP_D13
#define ARDUINO_UNO_D14 CYBSP_D14
#define ARDUINO_UNO_D15 CYBSP_D15
#endif

#endif // MBED_PINNAMES_H
68 changes: 0 additions & 68 deletions targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,74 +28,6 @@
#define PullDown CYHAL_GPIO_DRIVE_PULLDOWN
#define PullUp CYHAL_GPIO_DRIVE_PULLUP

// Arduino Headers
#ifdef CYBSP_A0
#define A0 CYBSP_A0
#endif
#ifdef CYBSP_A1
#define A1 CYBSP_A1
#endif
#ifdef CYBSP_A2
#define A2 CYBSP_A2
#endif
#ifdef CYBSP_A3
#define A3 CYBSP_A3
#endif
#ifdef CYBSP_A4
#define A4 CYBSP_A4
#endif
#ifdef CYBSP_A5
#define A5 CYBSP_A5
#endif
#ifdef CYBSP_D0
#define D0 CYBSP_D0
#endif
#ifdef CYBSP_D1
#define D1 CYBSP_D1
#endif
#ifdef CYBSP_D2
#define D2 CYBSP_D2
#endif
#ifdef CYBSP_D3
#define D3 CYBSP_D3
#endif
#ifdef CYBSP_D4
#define D4 CYBSP_D4
#endif
#ifdef CYBSP_D5
#define D5 CYBSP_D5
#endif
#ifdef CYBSP_D6
#define D6 CYBSP_D6
#endif
#ifdef CYBSP_D7
#define D7 CYBSP_D7
#endif
#ifdef CYBSP_D8
#define D8 CYBSP_D8
#endif
#ifdef CYBSP_D9
#define D9 CYBSP_D9
#endif
#ifdef CYBSP_D10
#define D10 CYBSP_D10
#endif
#ifdef CYBSP_D11
#define D11 CYBSP_D11
#endif
#ifdef CYBSP_D12
#define D12 CYBSP_D12
#endif
#ifdef CYBSP_D13
#define D13 CYBSP_D13
#endif
#ifdef CYBSP_D14
#define D14 CYBSP_D14
#endif
#ifdef CYBSP_D15
#define D15 CYBSP_D15
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,55 +64,49 @@ typedef enum {
LED_GREEN = PTA19,
LED_BLUE = PTA18,

// mbed original LED naming
LED1 = LED_RED,
LED2 = LED_GREEN,
LED3 = LED_BLUE,
LED4 = LED_RED,

//Push buttons
SW3 = PTC4,
SW4 = PTC5,
// Standardized button names
BUTTON1 = SW3,
BUTTON2 = SW4,
// LEDs and buttons
#define LED1 PTC1
#define LED2 PTA19
#define LED3 PTA18

#define BUTTON1 PTC4
#define BUTTON2 PTC5

// USB Pins
CONSOLE_TX = PTC7,
CONSOLE_RX = PTC6,

// Not connected
NC = (int)0xFFFFFFFF,

#ifdef TARGET_FF_ARDUINO_UNO
// Arduino Headers
D0 = PTC6,
D1 = PTC7,
D2 = PTC19,
D3 = PTC16,
D4 = PTC4,
D5 = PTC17,
D6 = PTC18,
D7 = PTA1,
D8 = PTA0,
D9 = PTC1,
D10 = PTA19,
D11 = PTA16,
D12 = PTA17,
D13 = PTA18,
D14 = PTC3,
D15 = PTC2,

I2C_SCL = D15,
I2C_SDA = D14,

DAC0_OUT = PTB18,

A0 = (int)0xFFFFFFFF,
A1 = DAC0_OUT,
A2 = PTB2,
A3 = PTB3,
A4 = PTB1,
A5 = PTB0,
ARDUINO_UNO_D0 = PTC6,
ARDUINO_UNO_D1 = PTC7,
ARDUINO_UNO_D2 = PTC19,
ARDUINO_UNO_D3 = PTC16,
ARDUINO_UNO_D4 = PTC4,
ARDUINO_UNO_D5 = PTC17,
ARDUINO_UNO_D6 = PTC18,
ARDUINO_UNO_D7 = PTA1,
ARDUINO_UNO_D8 = PTA0,
ARDUINO_UNO_D9 = PTC1,
ARDUINO_UNO_D10 = PTA19,
ARDUINO_UNO_D11 = PTA16,
ARDUINO_UNO_D12 = PTA17,
ARDUINO_UNO_D13 = PTA18,
ARDUINO_UNO_D14 = PTC3,
ARDUINO_UNO_D15 = PTC2,

ARDUINO_UNO_A0 = NC,
ARDUINO_UNO_A1 = PTB18,
ARDUINO_UNO_A2 = PTB2,
ARDUINO_UNO_A3 = PTB3,
ARDUINO_UNO_A4 = PTB1,
ARDUINO_UNO_A5 = PTB0,
#endif

// Not connected
NC = (int)0xFFFFFFFF
DAC0_OUT = PTB18
} PinName;


Expand Down
Loading

0 comments on commit 44ce176

Please sign in to comment.