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.
Dependencies: EthernetInterface mbed-rtos
PortBase.cpp@7:6c7af1d50fb3, 2013-08-29 (annotated)
- Committer:
- ysuga
- Date:
- Thu Aug 29 05:29:55 2013 +0000
- Revision:
- 7:6c7af1d50fb3
- Parent:
- 0:5f7bc45bc2e8
update v5
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ysuga | 0:5f7bc45bc2e8 | 1 | /******************************************* |
| ysuga | 0:5f7bc45bc2e8 | 2 | * PortBase.h |
| ysuga | 0:5f7bc45bc2e8 | 3 | * @author Yuki Suga |
| ysuga | 0:5f7bc45bc2e8 | 4 | * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010. |
| ysuga | 0:5f7bc45bc2e8 | 5 | * @license LGPLv3 |
| ysuga | 0:5f7bc45bc2e8 | 6 | *****************************************/ |
| ysuga | 0:5f7bc45bc2e8 | 7 | #define RTNO_SUBMODULE_DEFINE |
| ysuga | 0:5f7bc45bc2e8 | 8 | |
| ysuga | 0:5f7bc45bc2e8 | 9 | #include <stdlib.h> |
| ysuga | 0:5f7bc45bc2e8 | 10 | #include <string.h> |
| ysuga | 0:5f7bc45bc2e8 | 11 | #include "PortBase.h" |
| ysuga | 0:5f7bc45bc2e8 | 12 | #include "NullBuffer.h" |
| ysuga | 0:5f7bc45bc2e8 | 13 | |
| ysuga | 0:5f7bc45bc2e8 | 14 | PortBase* PortBase_create() { |
| ysuga | 0:5f7bc45bc2e8 | 15 | return (PortBase*)malloc(sizeof(PortBase)); |
| ysuga | 0:5f7bc45bc2e8 | 16 | } |
| ysuga | 0:5f7bc45bc2e8 | 17 | |
| ysuga | 0:5f7bc45bc2e8 | 18 | void PortBase_init(PortBase* portBase, const char* name, char typeCode, PortBuffer* dataBuffer) |
| ysuga | 0:5f7bc45bc2e8 | 19 | { |
| ysuga | 0:5f7bc45bc2e8 | 20 | portBase->pName = (char*)malloc(strlen(name)+1); |
| ysuga | 0:5f7bc45bc2e8 | 21 | strcpy(portBase->pName, name); |
| ysuga | 0:5f7bc45bc2e8 | 22 | portBase->typeCode = typeCode; |
| ysuga | 0:5f7bc45bc2e8 | 23 | portBase->pPortBuffer = dataBuffer; |
| ysuga | 0:5f7bc45bc2e8 | 24 | } |
| ysuga | 0:5f7bc45bc2e8 | 25 | |
| ysuga | 0:5f7bc45bc2e8 | 26 | void PortBase_destroy(PortBase* pPortBase) |
| ysuga | 0:5f7bc45bc2e8 | 27 | { |
| ysuga | 0:5f7bc45bc2e8 | 28 | free(pPortBase->pName); |
| ysuga | 0:5f7bc45bc2e8 | 29 | free(pPortBase); |
| ysuga | 0:5f7bc45bc2e8 | 30 | } |