Skip to content

Commit

Permalink
Implemented regular CB support + the "robust approach" recommended by TF
Browse files Browse the repository at this point in the history
  • Loading branch information
feritarou committed Feb 24, 2020
1 parent e9866f8 commit 7892aa9
Show file tree
Hide file tree
Showing 20 changed files with 733 additions and 552 deletions.
10 changes: 7 additions & 3 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: tinkerforge
description: |
Crystal bindings and easy-to-use wrapper classes for TinkerForge components.
version: 0.1.0
version: 0.2.0
authors:
- mathalaxy <[email protected]>
crystal: 0.29.0
license: MIT

development_dependencies:
crsfml-gui:
path: /home/felix/Programme/mathalaxy/crsfml-gui

repository: https://github.com/mathalaxy/tinkerforge
documentation: https://mathalaxy.github.io/tinkerforge/

# scripts:
# postinstall: mkdir -p dl/source obj && cd dl && curl -o tf.zip "https://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_2_1_27.zip" && unzip -uq tf.zip source/* && cd source && make && cd ../.. && cp dl/source/*.o obj
scripts:
postinstall: mkdir -p dl/source obj && cd dl && curl -o tf.zip "https://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_2_1_27.zip" && unzip -uq tf.zip source/* && cd source && make && cd ../.. && cp dl/source/*.o obj
92 changes: 0 additions & 92 deletions spec/rotary_poti_spec.cr

This file was deleted.

77 changes: 0 additions & 77 deletions spec/silent_stepper_spec.cr

This file was deleted.

2 changes: 0 additions & 2 deletions spec/spec_helper.cr

This file was deleted.

72 changes: 0 additions & 72 deletions spec/staple_spec.cr

This file was deleted.

6 changes: 0 additions & 6 deletions spec/tinkerforge_spec.cr

This file was deleted.

17 changes: 17 additions & 0 deletions src/bindings/bricklets/rotary_poti.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,21 @@ lib LibTF
rotary_poti : RotaryPoti*,
ret_position : Int16*
) : LibC::Int

fun rotary_poti_set_position_callback_period(
rotary_poti : RotaryPoti*,
period : UInt32
) : LibC::Int

fun rotary_poti_register_callback(
rotary_poti : RotaryPoti*,
callback_id : Int16,
function : Void*,
user_data : Void*
) : Void

ROTARY_POTI_CALLBACK_POSITION = 13
ROTARY_POTI_CALLBACK_ANALOG_VALUE = 14
ROTARY_POTI_CALLBACK_POSITION_REACHED = 15
ROTARY_POTI_CALLBACK_ANALOG_VALUE_REACHED = 16
end
6 changes: 6 additions & 0 deletions src/bindings/bricks/silent_stepper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ lib LibTF
interpolation : LibC::Int
) : LibC::Int

fun silent_stepper_get_step_configuration(
silent_stepper : SilentStepper*,
ret_step_resolution : UInt8*,
ret_interpolation : LibC::Int*
) : LibC::Int

fun silent_stepper_set_speed_ramping(
silent_stepper : SilentStepper*,
acceleration : UInt16,
Expand Down
21 changes: 21 additions & 0 deletions src/bindings/ip_connection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,25 @@ lib LibTF
IPCON_CALLBACK_CONNECTED = 0
IPCON_CALLBACK_DISCONNECTED = 1
IPCON_CALLBACK_ENUMERATE = 253

IPCON_ENUMERATION_TYPE_AVAILABLE = 0
IPCON_ENUMERATION_TYPE_CONNECTED = 1
IPCON_ENUMERATION_TYPE_DISCONNECTED = 2

E_OK = 0
E_TIMEOUT = -1
E_NO_STREAM_SOCKET = -2
E_HOSTNAME_INVALID = -3
E_NO_CONNECT = -4
E_NO_THREAD = -5
E_NOT_ADDED = -6 # not used anymore
E_ALREADY_CONNECTED = -7
E_NOT_CONNECTED = -8
E_INVALID_PARAMETER = -9
E_NOT_SUPPORTED = -10
E_UNKNOWN_ERROR_CODE = -11
E_STREAM_OUT_OF_SYNC = -12
E_INVALID_UID = -13
E_NON_ASCII_CHAR_IN_SECRET = -14
E_WRONG_DEVICE_TYPE = -15
end
Loading

0 comments on commit 7892aa9

Please sign in to comment.