mbed robotracer for education.
Robotracer (line follower robot ) using stepper motor.
/media/uploads/hayama/mbedrobotracer-manual-english.pdf
/media/uploads/hayama/mbedrobotracer-manual-japanese.pdf
/media/uploads/hayama/eagle-design-robotracer.zip
movie -> https://www.youtube.com/watch?v=INwun8gSds4
(for competition->) https://www.youtube.com/watch?v=l_gP2pUt4w0
mbed/semihost_api.h@0:da22b0b4395a, 2013-06-19 (annotated)
- Committer:
- hayama
- Date:
- Wed Jun 19 10:00:41 2013 +0000
- Revision:
- 0:da22b0b4395a
mbed robotracer for education ver 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hayama | 0:da22b0b4395a | 1 | /* mbed Microcontroller Library |
hayama | 0:da22b0b4395a | 2 | * Copyright (c) 2006-2013 ARM Limited |
hayama | 0:da22b0b4395a | 3 | * |
hayama | 0:da22b0b4395a | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
hayama | 0:da22b0b4395a | 5 | * you may not use this file except in compliance with the License. |
hayama | 0:da22b0b4395a | 6 | * You may obtain a copy of the License at |
hayama | 0:da22b0b4395a | 7 | * |
hayama | 0:da22b0b4395a | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
hayama | 0:da22b0b4395a | 9 | * |
hayama | 0:da22b0b4395a | 10 | * Unless required by applicable law or agreed to in writing, software |
hayama | 0:da22b0b4395a | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
hayama | 0:da22b0b4395a | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
hayama | 0:da22b0b4395a | 13 | * See the License for the specific language governing permissions and |
hayama | 0:da22b0b4395a | 14 | * limitations under the License. |
hayama | 0:da22b0b4395a | 15 | */ |
hayama | 0:da22b0b4395a | 16 | #ifndef MBED_SEMIHOST_H |
hayama | 0:da22b0b4395a | 17 | #define MBED_SEMIHOST_H |
hayama | 0:da22b0b4395a | 18 | |
hayama | 0:da22b0b4395a | 19 | #include "device.h" |
hayama | 0:da22b0b4395a | 20 | #include "toolchain.h" |
hayama | 0:da22b0b4395a | 21 | |
hayama | 0:da22b0b4395a | 22 | #ifdef __cplusplus |
hayama | 0:da22b0b4395a | 23 | extern "C" { |
hayama | 0:da22b0b4395a | 24 | #endif |
hayama | 0:da22b0b4395a | 25 | |
hayama | 0:da22b0b4395a | 26 | #if DEVICE_SEMIHOST |
hayama | 0:da22b0b4395a | 27 | |
hayama | 0:da22b0b4395a | 28 | #ifndef __CC_ARM |
hayama | 0:da22b0b4395a | 29 | |
hayama | 0:da22b0b4395a | 30 | #if defined(__ICCARM__) |
hayama | 0:da22b0b4395a | 31 | inline int __semihost(int reason, const void *arg) { |
hayama | 0:da22b0b4395a | 32 | return __semihosting(reason, (void*)arg); |
hayama | 0:da22b0b4395a | 33 | } |
hayama | 0:da22b0b4395a | 34 | #else |
hayama | 0:da22b0b4395a | 35 | |
hayama | 0:da22b0b4395a | 36 | #ifdef __thumb__ |
hayama | 0:da22b0b4395a | 37 | # define AngelSWI 0xAB |
hayama | 0:da22b0b4395a | 38 | # define AngelSWIInsn "bkpt" |
hayama | 0:da22b0b4395a | 39 | # define AngelSWIAsm bkpt |
hayama | 0:da22b0b4395a | 40 | #else |
hayama | 0:da22b0b4395a | 41 | # define AngelSWI 0x123456 |
hayama | 0:da22b0b4395a | 42 | # define AngelSWIInsn "swi" |
hayama | 0:da22b0b4395a | 43 | # define AngelSWIAsm swi |
hayama | 0:da22b0b4395a | 44 | #endif |
hayama | 0:da22b0b4395a | 45 | |
hayama | 0:da22b0b4395a | 46 | static inline int __semihost(int reason, const void *arg) { |
hayama | 0:da22b0b4395a | 47 | int value; |
hayama | 0:da22b0b4395a | 48 | |
hayama | 0:da22b0b4395a | 49 | asm volatile ( |
hayama | 0:da22b0b4395a | 50 | "mov r0, %1" "\n\t" |
hayama | 0:da22b0b4395a | 51 | "mov r1, %2" "\n\t" |
hayama | 0:da22b0b4395a | 52 | AngelSWIInsn " %a3" "\n\t" |
hayama | 0:da22b0b4395a | 53 | "mov %0, r0" |
hayama | 0:da22b0b4395a | 54 | : "=r" (value) /* output operands */ |
hayama | 0:da22b0b4395a | 55 | : "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */ |
hayama | 0:da22b0b4395a | 56 | : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */ |
hayama | 0:da22b0b4395a | 57 | ); |
hayama | 0:da22b0b4395a | 58 | |
hayama | 0:da22b0b4395a | 59 | return value; |
hayama | 0:da22b0b4395a | 60 | } |
hayama | 0:da22b0b4395a | 61 | #endif |
hayama | 0:da22b0b4395a | 62 | #endif |
hayama | 0:da22b0b4395a | 63 | |
hayama | 0:da22b0b4395a | 64 | #if DEVICE_LOCALFILESYSTEM |
hayama | 0:da22b0b4395a | 65 | FILEHANDLE semihost_open(const char* name, int openmode); |
hayama | 0:da22b0b4395a | 66 | int semihost_close (FILEHANDLE fh); |
hayama | 0:da22b0b4395a | 67 | int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode); |
hayama | 0:da22b0b4395a | 68 | int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode); |
hayama | 0:da22b0b4395a | 69 | int semihost_ensure(FILEHANDLE fh); |
hayama | 0:da22b0b4395a | 70 | long semihost_flen (FILEHANDLE fh); |
hayama | 0:da22b0b4395a | 71 | int semihost_seek (FILEHANDLE fh, long position); |
hayama | 0:da22b0b4395a | 72 | int semihost_istty (FILEHANDLE fh); |
hayama | 0:da22b0b4395a | 73 | |
hayama | 0:da22b0b4395a | 74 | int semihost_remove(const char *name); |
hayama | 0:da22b0b4395a | 75 | int semihost_rename(const char *old_name, const char *new_name); |
hayama | 0:da22b0b4395a | 76 | #endif |
hayama | 0:da22b0b4395a | 77 | |
hayama | 0:da22b0b4395a | 78 | int semihost_uid(char *uid); |
hayama | 0:da22b0b4395a | 79 | int semihost_reset(void); |
hayama | 0:da22b0b4395a | 80 | int semihost_vbus(void); |
hayama | 0:da22b0b4395a | 81 | int semihost_powerdown(void); |
hayama | 0:da22b0b4395a | 82 | int semihost_exit(void); |
hayama | 0:da22b0b4395a | 83 | |
hayama | 0:da22b0b4395a | 84 | int semihost_connected(void); |
hayama | 0:da22b0b4395a | 85 | int semihost_disabledebug(void); |
hayama | 0:da22b0b4395a | 86 | |
hayama | 0:da22b0b4395a | 87 | #endif |
hayama | 0:da22b0b4395a | 88 | |
hayama | 0:da22b0b4395a | 89 | #ifdef __cplusplus |
hayama | 0:da22b0b4395a | 90 | } |
hayama | 0:da22b0b4395a | 91 | #endif |
hayama | 0:da22b0b4395a | 92 | |
hayama | 0:da22b0b4395a | 93 | #endif |