mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-11 20:03:33 +08:00
LPC11C24: C++11 in the demo app
This commit is contained in:
@@ -12,21 +12,21 @@
|
||||
#define PDRUNCFGUSEMASK 0x0000ED00
|
||||
#define PDRUNCFGMASKTMP 0x000000FF
|
||||
|
||||
const uint32_t OscRateIn = 12000000; ///< External crystal
|
||||
const uint32_t ExtRateIn = 0;
|
||||
const std::uint32_t OscRateIn = 12000000; ///< External crystal
|
||||
const std::uint32_t ExtRateIn = 0;
|
||||
|
||||
uint32_t SystemCoreClock = 12000000; ///< Initialized to default clock value, will be changed on init
|
||||
std::uint32_t SystemCoreClock = 12000000; ///< Initialized to default clock value, will be changed on init
|
||||
|
||||
namespace board
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
const unsigned ErrorLedPort = 1;
|
||||
const unsigned ErrorLedPin = 10;
|
||||
constexpr unsigned ErrorLedPort = 1;
|
||||
constexpr unsigned ErrorLedPin = 10;
|
||||
|
||||
const unsigned StatusLedPort = 1;
|
||||
const unsigned StatusLedPin = 11;
|
||||
constexpr unsigned StatusLedPort = 1;
|
||||
constexpr unsigned StatusLedPin = 11;
|
||||
|
||||
struct PinMuxGroup
|
||||
{
|
||||
@@ -34,7 +34,7 @@ struct PinMuxGroup
|
||||
unsigned modefunc : 24;
|
||||
};
|
||||
|
||||
const PinMuxGroup pinmux[] =
|
||||
constexpr PinMuxGroup pinmux[] =
|
||||
{
|
||||
{ IOCON_PIO1_10, IOCON_FUNC0 | IOCON_MODE_INACT }, // Error LED
|
||||
{ IOCON_PIO1_11, IOCON_FUNC0 | IOCON_MODE_INACT } // Status LED
|
||||
@@ -126,7 +126,7 @@ void init()
|
||||
#if __GNUC__
|
||||
__attribute__((optimize(0))) // Optimization must be disabled lest it hardfaults in the IAP call
|
||||
#endif
|
||||
void readUniqueID(uint8_t out_uid[UniqueIDSize])
|
||||
void readUniqueID(std::uint8_t out_uid[UniqueIDSize])
|
||||
{
|
||||
unsigned aligned_array[4] = {}; // out_uid may be unaligned, so we need to use temp array
|
||||
unsigned iap_command = 58;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
* Pavel Kirienko, 2014 <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace board
|
||||
{
|
||||
|
||||
static const unsigned UniqueIDSize = 16;
|
||||
static constexpr unsigned UniqueIDSize = 16;
|
||||
|
||||
void readUniqueID(uint8_t out_uid[UniqueIDSize]);
|
||||
void readUniqueID(std::uint8_t out_uid[UniqueIDSize]);
|
||||
|
||||
void setStatusLed(bool state);
|
||||
void setErrorLed(bool state);
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
|
||||
void* __dso_handle;
|
||||
|
||||
void* operator new(size_t)
|
||||
void* operator new(std::size_t)
|
||||
{
|
||||
std::abort();
|
||||
return reinterpret_cast<void*>(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void* operator new[](size_t)
|
||||
void* operator new[](std::size_t)
|
||||
{
|
||||
std::abort();
|
||||
return reinterpret_cast<void*>(0xFFFFFFFF);
|
||||
|
||||
Reference in New Issue
Block a user