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
# GNU ARM Embedded Toolchain
CC=arm-none-eabi-gcc
CXX=arm-none-eabi-g++
LD=arm-none-eabi-ld
AR=arm-none-eabi-ar
AS=arm-none-eabi-as
CP=arm-none-eabi-objcopy
OD=arm-none-eabi-objdump
NM=arm-none-eabi-nm
SIZE=arm-none-eabi-size
A2L=arm-none-eabi-addr2line
CROSS := arm-none-eabi-
CC := $(CROSS)gcc
CXX := $(CROSS)g++
LD := arm-none-eabi-ld
AR := arm-none-eabi-ar
AS := arm-none-eabi-as
CP := arm-none-eabi-objcopy
OD := arm-none-eabi-objdump
NM := arm-none-eabi-nm
SIZE := arm-none-eabi-size
A2L := arm-none-eabi-addr2line
# Configure vars depending on OS
ifeq ($(OS),Windows_NT)

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

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

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

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.