Changeset 57

Show
Ignore:
Timestamp:
05/22/08 20:38:12 (5 years ago)
Author:
behrens
Message:

add function header and well formated comments

Location:
branches/workshop/IOModules
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • branches/workshop/IOModules/GetOutputModuleMap.m

    r56 r57  
    33 
    44% Syntax 
    5 %   map = GetOutputModuleMap(motor) 
     5%   |map = GetOutputModuleMap(motor)| 
    66% 
    77% Description 
     
    2020%                              since program start) 
    2121% 
    22 %     map.TachoLimit         % current set tacho/angle limit, 0 means none set 
     22%     map.TachoLimit         % tacho/angle limit, 0 means none set 
    2323% 
    2424%     map.MotorRPM           % current pulse width modulation ? 
     
    3030%     map.ModeName           % output mode name interpreted by output mode bitfield 
    3131% 
    32 %     map.Speed              % current motor power/speed 
     32%     map.Speed              % motor power/speed 
    3333% 
    3434%     map.ActualSpeed        % current actual percentage of full power (regulation mode) 
     
    5454% 
    5555% Examples 
    56 %   map = GetOutputModuleMap(MOTOR_A); 
     56%+   map = GetOutputModuleMap(MOTOR_A); 
    5757% 
    58 %   map = GetOutputModuleMap('all'); 
     58%+   map = GetOutputModuleMap('all'); 
    5959% 
    6060% See also: NXT_Read_IO_Map 
     
    7979% *  You should have received a copy of the GNU General Public License along with the           * 
    8080% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 * 
    81 % ********************************************************************************************* ** 
     81% *********************************************************************************************** 
    8282 
    8383% Information from 
  • branches/workshop/IOModules/NXT_PlaySoundFile.m

    r54 r57  
    33 
    44% Syntax 
    5 %   NXT_PlaySoundFile(filename, 1)  
     5%   |NXT_PlaySoundFile(filename, 1)| 
    66% 
    7 %   NXT_PlaySoundFile(filename, bt_handle) 
     7%   |NXT_PlaySoundFile(filename, bt_handle)| 
    88% 
    99% Description 
     
    2121% 
    2222% Examples 
    23 %   NXT_PlaySoundFile('Goodmorning', 0); 
     23%+   NXT_PlaySoundFile('Goodmorning', 0); 
    2424% 
    25 %   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
    26 %   NXT_StartProgram('Goodmorning.rso', 1, bt_handle); 
     25%+   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
     26%+   NXT_StartProgram('Goodmorning.rso', 1, bt_handle); 
    2727% 
    2828% See also: NXT_StopSoundPlayback 
  • branches/workshop/IOModules/NXT_Read_IO_Map.m

    r53 r57  
    33 
    44% Syntax 
    5 %   bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes) 
     5%   |bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes)| 
    66% 
    7 %   bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes, bt_handle) 
     7%   |bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes, bt_handle)| 
    88% 
    99% Description 
     
    2020% 
    2121% Examples 
    22 %   OutputModuleID = 131073 
    23 %   bytes = NXT_Read_IO_Map(OutputModuleID, 0, 29); 
     22%+   OutputModuleID = 131073 
     23%+   bytes = NXT_Read_IO_Map(OutputModuleID, 0, 29); 
    2424% 
    25 %   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
    26 %   OutputModuleID = 131073 
    27 %   SoundModuleID = 524289, 0, 30, bt_handle); 
     25%+   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
     26%+   OutputModuleID = 131073 
     27%+   SoundModuleID = 524289, 0, 30, bt_handle); 
    2828% 
    2929% See also: NXT_Write_IO_Map, BT_GetDefaultHandle 
  • branches/workshop/IOModules/NXT_StopSoundPlayback.m

    r54 r57  
    33 
    44% Syntax 
    5 %   NXT_StopSoundPlayback()  
     5%   |NXT_StopSoundPlayback()| 
    66% 
    7 %   NXT_StopSoundPlayback(bt_handle) 
     7%   |NXT_StopSoundPlayback(bt_handle)| 
    88% 
    99% Description 
     
    1818% 
    1919% Examples 
    20 %   NXT_StopSoundPlayback(); 
     20%+   NXT_StopSoundPlayback(); 
    2121% 
    22 %   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
    23 %   NXT_StopSoundPlayback(bt_handle); 
     22%+   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
     23%+   NXT_StopSoundPlayback(bt_handle); 
    2424% 
    2525% See also: NXT_PlaySoundFile, NXT_PlayTone, BT_GetDefaultHandle 
  • branches/workshop/IOModules/NXT_Write_IO_Map.m

    r53 r57  
    33 
    44% Syntax 
    5 %   NXT_Write_IO_Map(mod_id, offset, n_bytes, data) 
     5%   |NXT_Write_IO_Map(mod_id, offset, n_bytes, data)| 
    66% 
    7 %   NXT_Write_IO_Map(mod_id, offset, n_bytes, data, bt_handle) 
     7%   |NXT_Write_IO_Map(mod_id, offset, n_bytes, data, bt_handle)| 
    88% 
    99% Description 
     
    2020% 
    2121% Examples 
    22 %   OutputModuleID = 131073 
    23 %   NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes; 
     22%+   OutputModuleID = 131073 
     23%+   NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes; 
    2424% 
    25 %   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
    26 %   OutputModuleID = 131073 
    27 %   NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes, bt_handle); 
     25%+   bt_handle = BT_OpenHandle('bluetooth.ini','check'); 
     26%+   OutputModuleID = 131073 
     27%+   NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes, bt_handle); 
    2828% 
    2929% See also: NXT_Read_IO_Map, BT_GetDefaultHandle 
  • branches/workshop/IOModules/SetOutputModuleMap.m

    r52 r57  
    11function SetOutputModuleMap(motor, map, varargin) 
    2  
     2% Writes the IO map to the output module 
     3 
     4% Syntax 
     5%   |SetOutputModuleMap(motor, map)| 
     6% 
     7%   |SetOutputModuleMap(motor, map, varargin)| 
     8% 
     9% Description 
     10%   map = SetOutputModuleMap(motor, map) writes the IO map to the output module at the given motor 
     11%   port. The motor port can be addressed by MOTOR_A, MOTOR_B, MOTOR_C. The map structure has 
     12%   to provide all output module information, listed below.  
     13% 
     14% Input: 
     15%     map.TachoCount         % internal, non-resettable rotation-counter (in degrees) 
     16% 
     17%     map.BlockTachoCount    % block tacho counter, current motor position, resettable using, 
     18%                              ResetMotorAngle (NXT-G counter since block start) 
     19% 
     20%     map.RotationCount      % rotation tacho counter, current motor position (NXT-G counter 
     21%                              since program start) 
     22% 
     23%     map.TachoLimit         % current set tacho/angle limit, 0 means none set 
     24% 
     25%     map.MotorRPM           % current pulse width modulation ? 
     26% 
     27%     map.Flags              % update flag bitfield, commits any changing (see also varargin) 
     28% 
     29%     map.Mode               % output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED 
     30% 
     31%     map.Speed              % current motor power/speed 
     32% 
     33%     map.ActualSpeed        % current actual percentage of full power (regulation mode) 
     34% 
     35%     map.RegPParameter      % proportional term of the internal PID control algorithm 
     36% 
     37%     map.RegIParameter      % integral term of the internal PID control algorithm 
     38% 
     39%     map.RegDParameter      % derivate term of the internal PID control algorithm 
     40% 
     41%     map.RunStateByte       % run state byte 
     42% 
     43%     map.RegModeByte        % regulation mode byte 
     44% 
     45%     map.Overloaded         % overloaded flag (true: speed regulation is unable to onvercome 
     46%                              physical load on the motor) 
     47% 
     48%     map.SyncTurnParam      % current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume 
     49% 
     50%   map = SetOutputModuleMap(motor, map, varargin) sets the update flags explicit by the given 
     51%   arguments. 
     52%   'UpdateMode':           commits changes to the mode property 
     53%   'UpdateSpeed':          commits changes to the speed property 
     54%   'UpdateTachoLimit':     commits changes to the tacho limit property 
     55%   'ResetErrorCorrection': resets internal movement counters, cancels current goal, and resets 
     56%                           internal error-correction system 
     57%   'UpdatePID':            commits changes to PID regulation parameters 
     58%   'ResetBlockTachoCount': resets block tacho count (block-relative position counter (NXT-G)) 
     59%   'ResetRotationCount':   resets rotation count (program-relative position counter (NXT-G)) 
     60% 
     61% Examples 
     62%+  SetOutputModuleMap(MOTOR_A, map); 
     63% 
     64%+  SetOutputModuleMap(MOTOR_A, map, 'UpdateSpeed', 'UpdateTachoLimit', 'UpdatePID'); 
     65% 
     66% See also: GetOutputModuleMap, NXT_Write_IO_Map 
     67% 
     68% Signature 
     69%   Author: Alexander Behrens (see AUTHORS) 
     70%   Date: 2008/05/22 
     71%   Copyright: 2008, RWTH Aachen University 
     72% 
     73% 
     74% *********************************************************************************************** 
     75% *  This file is part of the RWTH - Mindstorms NXT Toolbox.                                    * 
     76% *                                                                                             * 
     77% *  The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify  * 
     78% *  it under the terms of the GNU General Public License as published by the Free Software     * 
     79% *  Foundation, either version 3 of the License, or (at your option) any later version.        * 
     80% *                                                                                             * 
     81% *  The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful,       * 
     82% *  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  * 
     83% *  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.             * 
     84% *                                                                                             * 
     85% *  You should have received a copy of the GNU General Public License along with the           * 
     86% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 * 
     87% *********************************************************************************************** 
     88% 
     89% 
    390% Information from 
    491% Not eXactly C (NXC) Programmer's Guide  
     
    26113% OutputOffsetPwnFreq              96            1 
    27114 
     115 
     116%% Parameter check 
     117% check if bluetooth handle is given; if not use default one 
     118if nargin < 3 
     119    warning('IO map changes have to be committed by the output module update flag!\n'... 
     120            'Update information is interpreted according the flag bitfield!\n'... 
     121            'Changes maybe will not be committed'); 
     122end 
     123     
    28124if nargin > 2 
    29125    bitfield = 0; 
     
    45141                bitfield = bitfield + 64; %#ok<NASGU> %hex2dec('40'); 
    46142            otherwise 
    47                 error('MATLAB:RWTHMindstormsNXT:lalalaa', 'unkown mode: %s', varargin{i}); 
     143                error('MATLAB:RWTHMindstormsNXT:unknown', 'unkown output module flag: %s', varargin{i}); 
    48144        end 
    49145    end 
     
    58154end 
    59155 
     156OutputModuleID = 131073; %#ok<NASGU> %hex2dec('00020001'); 
    60157 
    61158if ~strcmp(motor, 'all') 
     
    80177 
    81178    % return values of specified motor port 
    82     NXT_Write_IO_Map(131073, motor*32, size(bytes,2), bytes); 
     179    NXT_Write_IO_Map(OutputModuleID, motor*32, size(bytes,2), bytes); 
    83180     
    84181 
     
    111208 
    112209    % return values of specified motor port 
    113     NXT_Write_IO_Map(131073, 0, size(bytes,2), bytes);     
    114  
    115 end 
    116  
    117  
    118 end 
     210    NXT_Write_IO_Map(OutputModuleID, 0, size(bytes,2), bytes);     
     211 
     212end 
     213 
     214 
     215end