mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Files at this revision

API Documentation at this revision

Comitter:
pilotak
Date:
Sun Aug 06 16:01:26 2017 +0000
Parent:
8:4acb22344932
Commit message:
mBed OS5

Changed in this revision

utility/Enc28J60Network.cpp Show annotated file Show diff for this revision Revisions of this file
utility/Enc28J60Network.h Show annotated file Show diff for this revision Revisions of this file
utility/mempool.cpp Show annotated file Show diff for this revision Revisions of this file
utility/mempool.h Show annotated file Show diff for this revision Revisions of this file
utility/millis.cpp Show annotated file Show diff for this revision Revisions of this file
utility/millis.h Show annotated file Show diff for this revision Revisions of this file
diff -r 4acb22344932 -r e55652bed36c utility/Enc28J60Network.cpp
--- a/utility/Enc28J60Network.cpp	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/Enc28J60Network.cpp	Sun Aug 06 16:01:26 2017 +0000
@@ -43,7 +43,7 @@
  * @retval
  */
 Enc28J60Network::Enc28J60Network(PinName mosi, PinName miso, PinName sclk, PinName cs) :
-    MemoryPool(),
+    myMemoryPool(),
     _spi(mosi, miso, sclk),
     _cs(cs)
 { }
@@ -55,7 +55,7 @@
  * @retval
  */
 void Enc28J60Network::init(uint8_t* macaddr) {
-    MemoryPool::init();         // 1 byte in between RX_STOP_INIT and pool to allow prepending of controlbyte
+    myMemoryPool::init();         // 1 byte in between RX_STOP_INIT and pool to allow prepending of controlbyte
 
     // initialize SPI interface
     _spi.format(8, 0);          // 8bit, mode 0
diff -r 4acb22344932 -r e55652bed36c utility/Enc28J60Network.h
--- a/utility/Enc28J60Network.h	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/Enc28J60Network.h	Sun Aug 06 16:01:26 2017 +0000
@@ -38,7 +38,7 @@
  * wenn tcp/udp -> tcp/udp-callback -> assign new packet to connection
  */
 class Enc28J60Network :
-    public MemoryPool
+    public myMemoryPool
 {
 private:
     SPI                     _spi;
diff -r 4acb22344932 -r e55652bed36c utility/mempool.cpp
--- a/utility/mempool.cpp	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/mempool.cpp	Sun Aug 06 16:01:26 2017 +0000
@@ -21,7 +21,7 @@
 
 #define POOLOFFSET  1
 
-struct memblock MemoryPool::    blocks[MEMPOOL_NUM_MEMBLOCKS + 1];
+struct memblock myMemoryPool::    blocks[MEMPOOL_NUM_MEMBLOCKS + 1];
 
 /**
  * @brief
@@ -29,7 +29,7 @@
  * @param
  * @retval
  */
-void MemoryPool::init(void) {
+void myMemoryPool::init(void) {
     memset(&blocks[0], 0, sizeof(blocks));
     blocks[POOLSTART].begin = MEMPOOL_STARTADDRESS;
     blocks[POOLSTART].size = 0;
@@ -42,7 +42,7 @@
  * @param
  * @retval
  */
-memhandle MemoryPool::allocBlock(memaddress size) {
+memhandle myMemoryPool::allocBlock(memaddress size) {
     memblock*   best = NULL;
     memhandle   cur = POOLSTART;
     memblock*   block = &blocks[POOLSTART];
@@ -132,7 +132,7 @@
  * @param
  * @retval
  */
-void MemoryPool::freeBlock(memhandle handle) {
+void myMemoryPool::freeBlock(memhandle handle) {
     if (handle == NOBLOCK)
         return;
 
@@ -163,7 +163,7 @@
  * @param
  * @retval
  */
-void MemoryPool::resizeBlock(memhandle handle, memaddress position) {
+void myMemoryPool::resizeBlock(memhandle handle, memaddress position) {
     memblock*   block = &blocks[handle];
     block->begin += position;
     block->size -= position;
@@ -175,7 +175,7 @@
  * @param
  * @retval
  */
-void MemoryPool::resizeBlock(memhandle handle, memaddress position, memaddress size) {
+void myMemoryPool::resizeBlock(memhandle handle, memaddress position, memaddress size) {
     memblock*   block = &blocks[handle];
     block->begin += position;
     block->size = size;
@@ -187,6 +187,6 @@
  * @param
  * @retval
  */
-memaddress MemoryPool::blockSize(memhandle handle) {
+memaddress myMemoryPool::blockSize(memhandle handle) {
     return blocks[handle].size;
 }
diff -r 4acb22344932 -r e55652bed36c utility/mempool.h
--- a/utility/mempool.h	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/mempool.h	Sun Aug 06 16:01:26 2017 +0000
@@ -33,7 +33,7 @@
     memhandle   nextblock;
 };
 
-class   MemoryPool
+class   myMemoryPool
 {
 #ifdef MEMPOOLTEST_H
     friend class    MemoryPoolTest;
diff -r 4acb22344932 -r e55652bed36c utility/millis.cpp
--- a/utility/millis.cpp	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/millis.cpp	Sun Aug 06 16:01:26 2017 +0000
@@ -21,14 +21,17 @@
 
 volatile unsigned long  _millis;
 
+Ticker millisTicker;
+
+
 /**
  * @brief
  * @note
  * @param
  * @retval
  */
-void millis_start(void) {
-    SysTick_Config(SystemCoreClock / 1000);
+extern "C" void tick(void) {
+    _millis++;
 }
 
 /**
@@ -37,8 +40,9 @@
  * @param
  * @retval
  */
-extern "C" void SysTick_Handler(void) {
-    _millis++;
+extern "C" void millis_start(void) {
+    _millis = 0;
+    millisTicker.attach_us(&tick, 1000);
 }
 
 /**
diff -r 4acb22344932 -r e55652bed36c utility/millis.h
--- a/utility/millis.h	Fri Jun 30 19:51:28 2017 +0000
+++ b/utility/millis.h	Sun Aug 06 16:01:26 2017 +0000
@@ -21,5 +21,6 @@
 
 extern "C" void          millis_start(void);
 extern "C" unsigned long millis(void);
+extern "C" void tick(void);
 
 #endif