some formatting

pull/154/head
Gerad Munsch 3 years ago
parent 5ce9e11a08
commit 38ea910e0c

@ -88,16 +88,18 @@ SYS_DIR_F7=$(F7_LIB_PATH)/Device
STARTUP_DIR_F7=$(F7_LIB_PATH)/Device/startup STARTUP_DIR_F7=$(F7_LIB_PATH)/Device/startup
# GNU ARM Embedded Toolchain # GNU ARM Embedded Toolchain
CC=arm-none-eabi-gcc CROSS := arm-none-eabi-
CXX=arm-none-eabi-g++
LD=arm-none-eabi-ld CC := $(CROSS)gcc
AR=arm-none-eabi-ar CXX := $(CROSS)g++
AS=arm-none-eabi-as LD := arm-none-eabi-ld
CP=arm-none-eabi-objcopy AR := arm-none-eabi-ar
OD=arm-none-eabi-objdump AS := arm-none-eabi-as
NM=arm-none-eabi-nm CP := arm-none-eabi-objcopy
SIZE=arm-none-eabi-size OD := arm-none-eabi-objdump
A2L=arm-none-eabi-addr2line NM := arm-none-eabi-nm
SIZE := arm-none-eabi-size
A2L := arm-none-eabi-addr2line
# Configure vars depending on OS # Configure vars depending on OS
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)

@ -17,11 +17,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#if !defined(POCSAGDEFINES_H) #if !defined(POCSAGDEFINES_H_)
#define POCSAGDEFINES_H #define POCSAGDEFINES_H_
const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 18U * sizeof(uint32_t); const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 18U * sizeof(uint32_t);
const uint16_t POCSAG_FRAME_LENGTH_BYTES = 17U * sizeof(uint32_t); const uint16_t POCSAG_FRAME_LENGTH_BYTES = 17U * sizeof(uint32_t);
const uint8_t POCSAG_SYNC = 0xAAU; const uint8_t POCSAG_SYNC = 0xAAU;
#endif
#endif /* !POCSAGDEFINES_H_ */

@ -23,19 +23,18 @@
#include "POCSAGTX.h" #include "POCSAGTX.h"
#include "POCSAGDefines.h" #include "POCSAGDefines.h"
CPOCSAGTX::CPOCSAGTX() :
m_buffer(1000U),
CPOCSAGTX::CPOCSAGTX(): m_buffer(1000U),
m_poBuffer(), m_poBuffer(),
m_poLen(0U), m_poLen(0U),
m_poPtr(0U), m_poPtr(0U),
m_txDelay(POCSAG_PREAMBLE_LENGTH_BYTES), m_txDelay(POCSAG_PREAMBLE_LENGTH_BYTES),
m_delay(false), m_delay(false),
m_cal(false) m_cal(false) {
{
} }
void CPOCSAGTX::process() void CPOCSAGTX::process() {
{
if (m_cal) { if (m_cal) {
m_delay = false; m_delay = false;
createCal(); createCal();
@ -47,8 +46,9 @@ void CPOCSAGTX::process()
m_poLen = m_txDelay; m_poLen = m_txDelay;
} else { } else {
m_delay = false; m_delay = false;
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
m_poBuffer[i] = m_buffer.get(); m_poBuffer[i] = m_buffer.get();
}
m_poLen = POCSAG_FRAME_LENGTH_BYTES; m_poLen = POCSAG_FRAME_LENGTH_BYTES;
} }
@ -62,8 +62,9 @@ void CPOCSAGTX::process()
if (m_delay) { if (m_delay) {
m_poPtr++; m_poPtr++;
writeByte(POCSAG_SYNC); writeByte(POCSAG_SYNC);
} else } else {
writeByte(m_poBuffer[m_poPtr++]); writeByte(m_poBuffer[m_poPtr++]);
}
space -= 8U; space -= 8U;
@ -77,16 +78,15 @@ void CPOCSAGTX::process()
} }
} }
bool CPOCSAGTX::busy() bool CPOCSAGTX::busy() {
{ if (m_poLen > 0U || m_buffer.getData() > 0U) {
if (m_poLen > 0U || m_buffer.getData() > 0U)
return true; return true;
else } else {
return false; return false;
} }
}
uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) {
{
if (length != POCSAG_FRAME_LENGTH_BYTES) if (length != POCSAG_FRAME_LENGTH_BYTES)
return 4U; return 4U;
@ -100,36 +100,34 @@ uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length)
return 0U; return 0U;
} }
void CPOCSAGTX::writeByte(uint8_t c) void CPOCSAGTX::writeByte(uint8_t c) {
{
uint8_t bit; uint8_t bit;
uint8_t mask = 0x80U; uint8_t mask = 0x80U;
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) { for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
if ((c & mask) == mask) if ((c & mask) == mask) {
bit = 1U; bit = 1U;
else } else {
bit = 0U; bit = 0U;
}
io.write(&bit, 1); io.write(&bit, 1);
} }
} }
void CPOCSAGTX::setTXDelay(uint8_t delay) void CPOCSAGTX::setTXDelay(uint8_t delay) {
{
m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + (delay * 3U) / 2U; m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + (delay * 3U) / 2U;
if (m_txDelay > 150U) if (m_txDelay > 150U) {
m_txDelay = 150U; m_txDelay = 150U;
} }
}
uint8_t CPOCSAGTX::getSpace() const uint8_t CPOCSAGTX::getSpace() const {
{
return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES; return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES;
} }
uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length) uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length) {
{
if (length != 1U) if (length != 1U)
return 4U; return 4U;
@ -141,8 +139,7 @@ uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length)
return 0U; return 0U;
} }
void CPOCSAGTX::createCal() void CPOCSAGTX::createCal() {
{
// 600 Hz square wave generation // 600 Hz square wave generation
for (unsigned int i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) { for (unsigned int i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
m_poBuffer[i] = 0xAAU; m_poBuffer[i] = 0xAAU;

@ -18,8 +18,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#if !defined(POCSAGTX_H) #if !defined(POCSAGTX_H_)
#define POCSAGTX_H #define POCSAGTX_H_
class CPOCSAGTX { class CPOCSAGTX {
public: public:
@ -49,6 +50,7 @@ private:
bool m_cal; bool m_cal;
void writeByte(uint8_t c); void writeByte(uint8_t c);
}; };
#endif #endif /* !POCSAGTX_H_ */

@ -17,8 +17,7 @@
*/ */
/* Memory areas */ /* Memory areas */
MEMORY MEMORY {
{
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* FLASH */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* FLASH */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
} }

@ -26,10 +26,9 @@ ENTRY(Reset_Handler)
/* Stack start address (end of 20K RAM) */ /* Stack start address (end of 20K RAM) */
_estack = ORIGIN(RAM) + LENGTH(RAM); _estack = ORIGIN(RAM) + LENGTH(RAM);
SECTIONS
{ SECTIONS {
.text : .text : {
{
/* The interrupt vector table */ /* The interrupt vector table */
. = ALIGN(4); . = ALIGN(4);
KEEP(*(.isr_vector .isr_vector.*)) KEEP(*(.isr_vector .isr_vector.*))
@ -65,7 +64,6 @@ SECTIONS
KEEP (*(.fini_array)) KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*))) KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .; __fini_array_end = .;
} > ROM } > ROM
/* ARM sections containing exception unwinding information */ /* ARM sections containing exception unwinding information */
@ -86,8 +84,7 @@ SECTIONS
_sidata = .; _sidata = .;
/* The .data section (initialized data) */ /* The .data section (initialized data) */
.data : AT ( _sidata ) .data : AT(_sidata) {
{
. = ALIGN(4); . = ALIGN(4);
_sdata = .; /* Start address for the .data section */ _sdata = .; /* Start address for the .data section */
*(.data .data*) *(.data .data*)
@ -97,8 +94,7 @@ SECTIONS
} > RAM } > RAM
/* The .bss section (uninitialized data) */ /* The .bss section (uninitialized data) */
.bss : .bss : {
{
. = ALIGN(4); . = ALIGN(4);
_sbss = .; /* Start address for the .bss section */ _sbss = .; /* Start address for the .bss section */
__bss_start__ = _sbss; __bss_start__ = _sbss;
@ -112,8 +108,7 @@ SECTIONS
} > RAM } > RAM
/* Space for heap and stack */ /* Space for heap and stack */
.heap_stack : .heap_stack : {
{
end = .; /* 'end' symbol defines heap location */ end = .; /* 'end' symbol defines heap location */
_end = end; _end = end;
. = . + _min_heap_size; /* Additional space for heap and stack */ . = . + _min_heap_size; /* Additional space for heap and stack */
@ -121,8 +116,7 @@ SECTIONS
} > RAM } > RAM
/* Remove information from the standard libraries */ /* Remove information from the standard libraries */
/DISCARD/ : /DISCARD/ : {
{
libc.a(*) libc.a(*)
libm.a(*) libm.a(*)
libgcc.a(*) libgcc.a(*)

Loading…
Cancel
Save

Powered by TurnKey Linux.