Maty
Maty

Reputation: 95

Define with curly braces

I've been trying to look up information on this to no avail. Can someone explain what the curly braces do here? I'm trying to find or create the ISR function for the transmit/receive IRQ, however I am stuck here.

/** Interrupt vectors for the ENET peripheral type */
#define ENET_Transmit_IRQS                       { ENET_Transmit_IRQn }
#define ENET_Receive_IRQS                        { ENET_Receive_IRQn }

In this case ENET_Transmit_IRQn is the 83rd vector in the IRQ vector and the Rx is consecutively, 84th.

What are the curly braces for? My only logical argument is that these vectors are in a typedef enum IRQ (structure? It doesn't say struct though), and essentially it is the same as

#define ENET_Transmit_IRQS 83

P.S. This is for a Kinetis K66

EDIT: I just found 1 line where it is being used.

/*! @brief Pointers to enet transmit IRQ number for each instance. */
static const IRQn_Type s_enetTxIrqId[] = ENET_Transmit_IRQS;

Where IRQn_Type is

typedef enum IRQn {
...
  ENET_1588_Timer_IRQn         = 82,               /**< Ethernet MAC IEEE 1588 Timer Interrupt */
  ENET_Transmit_IRQn           = 83,               /**< Ethernet MAC Transmit Interrupt */
  ENET_Receive_IRQn            = 84,               /**< Ethernet MAC Receive Interrupt */
  ENET_Error_IRQn              = 85,               /**< Ethernet MAC Error and miscelaneous Interrupt */
...
} IRQn_Type;

Upvotes: 0

Views: 1398

Answers (1)

Maty
Maty

Reputation: 95

I think I understand this now with the help of Eugene (thanks!!). It has curly braces because it is being used as an initializer for an array.

Upvotes: 2

Related Questions