README
1.96 KB
Function for a motor test
---Explanation of the function---
There are three kinds of motor functions as described below. Please use by linking libmotor.a and by including motor.h.
s32 osMotorInit(OSMesgQueue *siMessegeQ, OSPfs*pfs, int channel);
This is the function to initialize the motor. SI message queue, OSPfs structure, and the number of the controller channel shall be a factor. Please make sure to refer to this at first.
As an error code in return, we have PFS_ERR_NOPACK, PFS_ERR_CONTRFAIL, PFS_ERR_DEVICE. The first three are the same error code as the controller pack. In this case, PFS_ERR_DEVICE means that a certain device, not the motor, is put in the controller.
s32 osMotorStart(OSPfs *pfs);
This is the function to operate the motor and OSPfs structure shall be a factor. By calling this function, the motor starts to work. Internally, data is written with high-speeded function by eliminating any wasteful process from the written function for the controller pack _osContRamWrite0. Accordingly, the motor does not start to work until we call MotorInit0 again if the controller is pulled and put. Naturally, SI access is adopted and the inside waits for the instruction of SI. You need to call by considering the fact.
As to the error code, if PFS_ERR_CONTRFAIL is received, there is an error in communication, which means that there is a failure in operating the motor. 0 is received if successfully done. Programming should be done by considering the possible error in the communication.
s32 osMotorStop(OSPfs *pfs);
This is the function to operate the motor and OSPfs will be a factor. By calling the function, the motor is stopped. This function internally adopts the same process as osMotorStart().
---Explanation of the test program---
The brief explanation for the operation of the test program is that A button is for motor start, B button is for motor stop, and you can change the vibrating speed by JOY with Z button.