Commit 197923e2d539f1add587793d0d4510ab1d4fb15f

Authored by Antonio Carlos Domínguez Brito
2 parents adacb329 c8110bcc
Exists in master

v1.1 - added overrun and stopped behavior, added example pwm_capture_test.ino (1)

README.md
... ... @@ -2,7 +2,7 @@
2 2  
3 3 This is tc_lib library for the Arduino DUE electronic prototyping platform.
4 4  
5   -Copyright (C) 2015 Antonio C. Domínguez Brito (<adominguez@iusiani.ulpgc.es>). División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>) and Departamento de Informática y Sistemas (<http://www.dis.ulpgc.es>). Universidad de Las Palmas de Gran Canaria (ULPGC) (<http://www.ulpgc.es>).
  5 +Copyright (C) 2015,2016 Antonio C. Domínguez Brito (<adominguez@iusiani.ulpgc.es>). División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>) and Departamento de Informática y Sistemas (<http://www.dis.ulpgc.es>). Universidad de Las Palmas de Gran Canaria (ULPGC) (<http://www.ulpgc.es>).
6 6  
7 7 ### 0. License
8 8  
... ... @@ -16,9 +16,9 @@ In tc_lib current version you can use two kind of objects, capture and action ob
16 16  
17 17 ### 2. Capture objects
18 18  
19   -Capture objects allow to measures period and pulses (the duty) of digital signals, like PWM signals. This is carried out in parallel using the resources on TC's channels.
  19 +Capture objects allow measuring period and pulses (the duty) of digital signals, like PWM signals. This is carried out in parallel using the resources on TC's channels.
20 20  
21   -Concretely, it is possible to use up to nine capture objects each one corresponding to the nine channels available, namely, TC0, TC1, TC2 (on TC module 0), TC3, TC4, TC5 (on TC module 1), and TC6, TC7 and TC8 (on TC module 2). For using any of them you have to previously declare them in advance using a specific declaration syntax provided by the libraryusing macros *capture_tc0_declaration*, *capture_tc1_declaration*, etc. A snippet of code extracted from the example *capture_test.ino* declaring a capture object corresponding to TC0 is shown next:
  21 +Concretely, it is possible to use up to nine capture objects each one corresponding to the nine channels available, namely, TC0, TC1, TC2 (on TC module 0), TC3, TC4, TC5 (on TC module 1), and TC6, TC7 and TC8 (on TC module 2). For using any of them you have to previously declare them in advance using a specific declaration syntax provided by the library through macros *capture_tc0_declaration*, *capture_tc1_declaration*, etc. A snippet of code extracted from the example *capture_test.ino* declaring a capture object corresponding to TC0 is shown next:
22 22  
23 23 ```
24 24 // capture_tc0 declaration
... ... @@ -26,7 +26,7 @@ Concretely, it is possible to use up to nine capture objects each one correspond
26 26 // PB25, which is pin 2 for Arduino DUE, so the capture pin in this example
27 27 // is pin 2. For the correspondence between all TIOA inputs for the different
28 28 // TC modules, you should consult uC Atmel ATSAM3X8E datasheet in section "36.
29   -// Timer Counter (TC)"), and the Arduino pin mapping for the DUE.
  29 +// Timer Counter (TC)", and the Arduino pin mapping for the DUE.
30 30  
31 31 capture_tc0_declaration();
32 32 ```
... ... @@ -139,7 +139,7 @@ For compiling on command line using CMake, just proceed in the following manner:
139 139  
140 140 ### 8. Library users
141 141  
142   -In this section we would like to enumerate users using the library in their own projects and developments. So please, if your are using the library, drop us an email indicating in what project or development you are using it.
  142 +In this section we would like to enumerate users using the library in their own projects and developments. So please, if you are using the library, drop us an email indicating in what project or development you are using it.
143 143  
144 144 The list of users/projects goes now:
145 145  
... ...
arduino_due_toolchain.cmake
... ... @@ -1,81 +0,0 @@
1   -# arduino_due_toolchain.cmake: toolchain file for arduino due
2   -
3   -include (CMakeForceCompiler)
4   -
5   -set(CMAKE_SYSTEM_NAME Generic)
6   -set(CMAKE_SYSTEM_PROCESSOR arm)
7   -
8   -# checking environment variable ARDUINO_DUE_SOURCE_PATH
9   -if(
10   - NOT (DEFINED ENV{ARDUINO_DUE_ROOT_PATH})
11   - OR
12   - ($ENV{ARDUINO_DUE_ROOT_PATH} EQUAL "")
13   -)
14   -
15   - message(FATAL_ERROR "[ERROR] Environment variable ARDUINO_DUE_ROOT_PATH not set!")
16   -
17   -else()
18   -
19   - message(STATUS "Environment variable ARDUINO_DUE_ROOT_PATH: $ENV{ARDUINO_DUE_ROOT_PATH}")
20   -
21   -endif()
22   -
23   -function(find_due_program DUE_PROGRAM_PATH DUE_PROGRAM WHERE)
24   -
25   - find_program(
26   - ${DUE_PROGRAM_PATH}
27   - ${DUE_PROGRAM}
28   - PATH ${WHERE}
29   - NO_SYSTEM_ENVIRONMENT_PATH
30   - )
31   - if(NOT ${DUE_PROGRAM_PATH})
32   - message(FATAL_ERROR "[ERROR] \"${DUE_PROGRAM}\" not found!")
33   - else()
34   - message(STATUS "\"${DUE_PROGRAM}\" found: ${${DUE_PROGRAM_PATH}}")
35   - endif()
36   -
37   -endfunction(find_due_program)
38   -
39   -find_due_program(
40   - DUE_CC
41   - arm-none-eabi-gcc
42   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin
43   -)
44   -find_due_program(
45   - DUE_CXX
46   - arm-none-eabi-g++
47   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin
48   -)
49   -find_due_program(
50   - DUE_OBJCOPY
51   - arm-none-eabi-objcopy
52   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin
53   -)
54   -find_due_program(
55   - DUE_SIZE_TOOL
56   - arm-none-eabi-size
57   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin
58   -)
59   -find_due_program(
60   - DUE_OBJDUMP
61   - arm-none-eabi-objdump
62   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin
63   -)
64   -find_due_program(
65   - DUE_BOSSAC
66   - bossac
67   - $ENV{ARDUINO_DUE_ROOT_PATH}/tools/bossac/1.6.1-arduino
68   -)
69   -
70   -CMAKE_FORCE_C_COMPILER(${DUE_CC} arduino_due_arm)
71   -CMAKE_FORCE_CXX_COMPILER(${DUE_CXX} arduino_due_arm)
72   -
73   -include_directories(
74   - $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/system/libsam
75   - $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/system/CMSIS/CMSIS/Include
76   - $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/system/CMSIS/Device/ATMEL $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/cores/arduino
77   - $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/cores/arduino/USB
78   - $ENV{ARDUINO_DUE_ROOT_PATH}/hardware/sam/1.6.6/variants/arduino_due_x
79   -)
80   -
81   -
tc_lib.h
... ... @@ -127,7 +127,9 @@ namespace arduino_due
127 127 ~capture() {}
128 128  
129 129 capture(const capture&) = delete;
  130 + capture(capture&&) = delete;
130 131 capture& operator=(const capture&) = delete;
  132 + capture& operator=(capture&&) = delete;
131 133  
132 134 static void tc_interrupt(uint32_t the_status)
133 135 { _ctx_.tc_interrupt(the_status); }
... ... @@ -418,7 +420,9 @@ namespace arduino_due
418 420 ~action() {}
419 421  
420 422 action(const action&) = delete;
  423 + action(action&&) = delete;
421 424 action& operator=(const action&) = delete;
  425 + action& operator=(action&&) = delete;
422 426  
423 427 bool start(
424 428 uint32_t the_period,
... ...