Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Lpc17xx40xxUart.hxx
Go to the documentation of this file.
1
35#ifndef _FREERTOS_DRIVERS_NXP_LPC17XX40XXUART_HXX_
36#define _FREERTOS_DRIVERS_NXP_LPC17XX40XXUART_HXX_
37
38#include <cstdint>
39
40#include "Serial.hxx"
41
42#include "cmsis.h"
43#if defined (CHIP_LPC175X_6X)
44#include "cmsis_175x_6x.h"
45#elif defined (CHIP_LPC177X_9X)
46#include "cmsis_177x_8x.h"
47#elif defined (CHIP_LPC407X_8X)
48#include "cmsis_407x_8x.h"
49#else
50#error "LPC CHIP undefined"
51#endif
52#include "core_cm3.h"
53#include "uart_17xx_40xx.h"
54
57class LpcUart : public Serial
58{
59public:
65 LpcUart(const char *name, LPC_USART_T *base, IRQn_Type interrupt);
66
70 {
71 }
72
76 static void interrupt_handler(unsigned index)
77 {
79 }
80
81private:
82 void enable() override;
83 void disable() override;
87 void interrupt_handler();
88
91 void tx_char() override;
92
93 LPC_USART_T *base;
94 IRQn_Type interrupt;
96#if defined (CHIP_LPC177X_8X) || defined (CHIP_LPC407X_8X)
98 static LpcUart *instances[5];
99#else
101 static LpcUart *instances[4];
102#endif
103
107
109};
110
111
112#endif /* _FREERTOS_DRIVERS_NXP_LPC17XX40XXUART_HXX_ */
const char * name
device name
Definition Devtab.hxx:266
Specialization of Serial driver for LPC17xx and LPC40xx UART.
LpcUart()
Default constructor.
void disable() override
function to disable device
static LpcUart * instances[4]
Instance pointers help us get context from the interrupt handler(s)
LPC_USART_T * base
base address of this device
static void interrupt_handler(unsigned index)
Translate an interrupt handler into C++ object context.
IRQn_Type interrupt
interrupt of this device
~LpcUart()
Destructor.
void tx_char() override
Try and transmit a message.
void enable() override
function to enable device
void interrupt_handler()
handle an interrupt.
Private data for a serial device.
Definition Serial.hxx:46
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
Definition macros.h:171