Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@
"_CONFIG_DFLT_IO_TYPE_TRS_3_RING=IO_TYPE_NONE",
"_CONFIG_DFLT_IO_POLARITY_TRS_3_RING=IO_POLARITY_ACTIVE_LOW",
"_CONFIG_DFLT_KEYER_PADDLE_MODE=KEYER_PADDLE_MODE_IAMBIC",
"_CONFIG_DFLT_KEYER_PADDLE_INVERT=false"
"_CONFIG_DFLT_KEYER_PADDLE_INVERT=false",
"_PIN_LED_STATUS=GPIO_PIN_D7",
"_PIN_LED_KEY=GPIO_PIN_D6",
"_PIN_IO_PIN_TRS_0_TIP=GPIO_PIN_A0",
"_PIN_IO_PIN_TRS_0_RING=GPIO_PIN_A1",
"_PIN_IO_PIN_TRS_1_TIP=GPIO_PIN_A2",
"_PIN_IO_PIN_TRS_1_RING=GPIO_PIN_A3",
"_PIN_IO_PIN_TRS_2_TIP=GPIO_PIN_A4",
"_PIN_IO_PIN_TRS_2_RING=GPIO_PIN_A5",
"_PIN_IO_PIN_TRS_3_TIP=GPIO_PIN_A6",
"_PIN_IO_PIN_TRS_3_RING=GPIO_PIN_A7"
],
"compilerPath": "/usr/bin/avr-gcc",
"compilerArgs": [
Expand Down
38 changes: 38 additions & 0 deletions configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,41 @@ add_compile_definitions(
_CONFIG_DFLT_KEYER_PADDLE_INVERT=${CONFIG_DFLT_KEYER_PADDLE_INVERT}
_CONFIG_DFLT_KEYER_OUTPUT_ACTIVE_LOW=${CONFIG_DFLT_KEYER_OUTPUT_ACTIVE_LOW}
)

# -- Pin Configuration --

# Define values
set(PIN_IO_PIN_TRS_0_TIP GPIO_PIN_A0
CACHE STRING "GPIO pin for the tip connector of TRS 0. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_0_RING GPIO_PIN_A1
CACHE STRING "GPIO pin for the ring connector of TRS 0. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_1_TIP GPIO_PIN_A2
CACHE STRING "GPIO pin for the tip connector of TRS 1. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_1_RING GPIO_PIN_A3
CACHE STRING "GPIO pin for the ring connector of TRS 1. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_2_TIP GPIO_PIN_A4
CACHE STRING "GPIO pin for the tip connector of TRS 2. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_2_RING GPIO_PIN_A5
CACHE STRING "GPIO pin for the ring connector of TRS 2. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_3_TIP GPIO_PIN_A6
CACHE STRING "GPIO pin for the tip connector of TRS 3. (gpio_pin_t)")
set(PIN_IO_PIN_TRS_3_RING GPIO_PIN_A7
CACHE STRING "GPIO pin for the ring connector of TRS 3. (gpio_pin_t)")
set(PIN_LED_STATUS GPIO_PIN_D7
CACHE STRING "GPIO pin for the status LED. (gpio_pin_t)")
set(PIN_LED_KEY GPIO_PIN_D6
CACHE STRING "GPIO pin for the key LED. (gpio_pin_t)")

# Set compile definitions
add_compile_definitions(
_PIN_IO_PIN_TRS_0_TIP=${PIN_IO_PIN_TRS_0_TIP}
_PIN_IO_PIN_TRS_0_RING=${PIN_IO_PIN_TRS_0_RING}
_PIN_IO_PIN_TRS_1_TIP=${PIN_IO_PIN_TRS_1_TIP}
_PIN_IO_PIN_TRS_1_RING=${PIN_IO_PIN_TRS_1_RING}
_PIN_IO_PIN_TRS_2_TIP=${PIN_IO_PIN_TRS_2_TIP}
_PIN_IO_PIN_TRS_2_RING=${PIN_IO_PIN_TRS_2_RING}
_PIN_IO_PIN_TRS_3_TIP=${PIN_IO_PIN_TRS_3_TIP}
_PIN_IO_PIN_TRS_3_RING=${PIN_IO_PIN_TRS_3_RING}
_PIN_LED_STATUS=${PIN_LED_STATUS}
_PIN_LED_KEY=${PIN_LED_KEY}
)
1 change: 1 addition & 0 deletions src/main/application/buzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/**
* @def OCRA_GPIO_PIN
* @brief The GPIO pin associated with the OCRA pin connected to the buzzer.
* @note This is hard-coded (not configurable), since the timer output is locked to a specific pin.
*/
#define OCRA_GPIO_PIN GPIO_PIN_D5

Expand Down
16 changes: 8 additions & 8 deletions src/main/application/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

static gpio_pin_t const s_pin_tbl[] =
{
GPIO_PIN_A0, /* IO_PIN_TRS_0_TIP */
GPIO_PIN_A1, /* IO_PIN_TRS_0_RING */
GPIO_PIN_A2, /* IO_PIN_TRS_1_TIP */
GPIO_PIN_A3, /* IO_PIN_TRS_1_RING */
GPIO_PIN_A4, /* IO_PIN_TRS_2_TIP */
GPIO_PIN_A5, /* IO_PIN_TRS_2_RING */
GPIO_PIN_A6, /* IO_PIN_TRS_3_TIP */
GPIO_PIN_A7, /* IO_PIN_TRS_3_RING */
_PIN_IO_PIN_TRS_0_TIP,
_PIN_IO_PIN_TRS_0_RING,
_PIN_IO_PIN_TRS_1_TIP,
_PIN_IO_PIN_TRS_1_RING,
_PIN_IO_PIN_TRS_2_TIP,
_PIN_IO_PIN_TRS_2_RING,
_PIN_IO_PIN_TRS_3_TIP,
_PIN_IO_PIN_TRS_3_RING,
};
_Static_assert( array_count( s_pin_tbl ) == IO_PIN_COUNT, "Invalid pin table!" );

Expand Down
5 changes: 2 additions & 3 deletions src/main/application/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@

static gpio_pin_t const s_gpio_tbl[] =
{
// Must be in same order as led_t enum
GPIO_PIN_C0, /* LED_STATUS */
GPIO_PIN_D6, /* LED_KEY */
_PIN_LED_STATUS,
_PIN_LED_KEY,
};
_Static_assert( array_count( s_gpio_tbl ) == LED_COUNT, "Invalid GPIO table!" );

Expand Down
4 changes: 4 additions & 0 deletions src/main/drivers/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ enum
/**
* @typedef gpio_pin_t
* @brief Enumeration of the supported GPIO pins.
* @note Note that the availability of a pin in this enumeration does not necessarily mean that it may be used for
* I/O. Many of the I/O pins are being used for their alternative functions, and attempting to use them as GPIO
* pins will result in undefined behavior. Refer to doc/hardware-guide.md for more details on the usage of each
* pin.
*/
typedef uint8_t gpio_pin_t;
enum
Expand Down