Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: FreeMASTER_HelloWorld FreeMASTER_HelloWorld2 FreeMASTER_HelloWorld3
Fork of freemaster_lib by
class/freemaster_class.cpp
- Committer:
- JardaPajskr
- Date:
- 2014-05-05
- Revision:
- 0:fb135bf60f82
- Child:
- 8:17470feaa6be
File content as of revision 0:fb135bf60f82:
#include "mbed.h"
#include "freemaster_class.h"
#if DEVICE_SERIAL
#define FMSTR_USE_TSA_DYNAMIC 1
#define FMSTR_REC_OWNBUFF 1
namespace mbed {
Freemaster::Freemaster(PinName tx, PinName rx, uint32_t tsaMembers, uint32_t recBufferSize, uint32_t flags) {
serial_init(&_serial, tx, rx);
_baud = 9600;
serial_irq_handler(&_serial, Freemaster::_irq_handler, (uint32_t)this);
FMSTR_InitSerialBase((FMSTR_BPTR)&_serial.uart->BDH);
FMSTR_Init();
#if !(FMSTR_POLL_DRIVEN)
serial_irq_set(&_serial, RxIrq, 1);
serial_irq_set(&_serial, TxIrq, 1);
#endif
#if (FMSTR_USE_TSA_DYNAMIC)
tsaTable=malloc(tsaMembers*sizeof(FMSTR_TSA_ENTRY));
FMSTR_SetUpTsaBuff((FMSTR_ADDR)tsaTable, (tsaMembers)*sizeof(FMSTR_TSA_ENTRY));
#endif
#if (FMSTR_REC_OWNBUFF)
recBuf=malloc(recBufferSize);
FMSTR_SetUpRecBuff((FMSTR_ADDR)recBuf, recBufferSize);
#endif
}
FMSTR_BOOL Freemaster::TsaAddVar(FMSTR_TSATBL_STRPTR name, FMSTR_TSATBL_STRPTR type, FMSTR_TSATBL_VOIDPTR addr, FMSTR_TSATBL_VOIDPTR info) {
#if FMSTR_USE_TSA_DYNAMIC
return FMSTR_TsaAddVar(name, type, addr, info);
#else
return FMSTR_FALSE;
#endif
}
void Freemaster::baud(int baudrate) {
serial_baud(&_serial, baudrate);
_baud = baudrate;
}
void Freemaster::Recorder() {
FMSTR_Recorder();
}
void Freemaster::Poll() {
FMSTR_Poll();
}
void Freemaster::_irq_handler(uint32_t id, SerialIrq irq_type) {
FMSTR_Isr();
}
} // namespace mbed
#endif
