nplc 2.1.0.0
|
API for configuring and manipulating N-PLC Click driver. More...
Topics | |
N-PLC Device Settings | |
Settings for registers of N-PLC Click driver. | |
N-PLC MikroBUS Map | |
MikroBUS pin mapping of N-PLC Click driver. | |
Functions | |
void | nplc_cfg_setup (nplc_cfg_t *cfg) |
N-PLC configuration object setup function. | |
err_t | nplc_init (nplc_t *ctx, nplc_cfg_t *cfg) |
N-PLC initialization function. | |
err_t | nplc_generic_write (nplc_t *ctx, char *data_in, uint16_t len) |
N-PLC data writing function. | |
err_t | nplc_generic_read (nplc_t *ctx, char *data_out, uint16_t len) |
N-PLC data reading function. | |
void | nplc_set_rst_pin (nplc_t *ctx, uint8_t state) |
N-PLC set rst pin function. | |
void | nplc_set_md1_pin (nplc_t *ctx, uint8_t state) |
N-PLC set md1 pin function. | |
void | nplc_set_cts_pin (nplc_t *ctx, uint8_t state) |
N-PLC set cts pin function. | |
uint8_t | nplc_get_rts_pin (nplc_t *ctx) |
N-PLC get rts pin function. | |
void | nplc_hw_reset (nplc_t *ctx) |
N-PLC hw reset function. | |
void | nplc_sw_reset (nplc_t *ctx) |
N-PLC sw reset function. | |
void | nplc_factory_reset (nplc_t *ctx) |
N-PLC factory reset function. | |
void | nplc_firmware_version (nplc_t *ctx) |
N-PLC firmware version function. | |
void | nplc_set_mode (nplc_t *ctx, uint8_t mode) |
N-PLC set mode function. | |
void | nplc_send_cmd (nplc_t *ctx, char *cmd) |
N-PLC send command function. | |
void | nplc_write_s_register (nplc_t *ctx, char *s_reg, char *param_buf) |
N-PLC write s register function. | |
void | nplc_read_s_register (nplc_t *ctx, char *s_reg) |
N-PLC read s register function. | |
API for configuring and manipulating N-PLC Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void nplc_cfg_setup | ( | nplc_cfg_t * | cfg | ) |
N-PLC configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See nplc_cfg_t object definition for detailed explanation. |
void nplc_factory_reset | ( | nplc_t * | ctx | ) |
N-PLC factory reset function.
This function factory resets the device.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
void nplc_firmware_version | ( | nplc_t * | ctx | ) |
N-PLC firmware version function.
This function sends the show firmware version command.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
err_t nplc_generic_read | ( | nplc_t * | ctx, |
char * | data_out, | ||
uint16_t | len ) |
N-PLC data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
>0
- Number of data bytes read, <=0
- Error/Empty Ring buffer. See #err_t definition for detailed explanation. err_t nplc_generic_write | ( | nplc_t * | ctx, |
char * | data_in, | ||
uint16_t | len ) |
N-PLC data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | data_in | : Data buffer for sending. |
[in] | len | : Number of bytes for sending. |
>=0
- Success, <0
- Error. See #err_t definition for detailed explanation. uint8_t nplc_get_rts_pin | ( | nplc_t * | ctx | ) |
N-PLC get rts pin function.
This function returns the handshake out (RTS) pin logic state.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
void nplc_hw_reset | ( | nplc_t * | ctx | ) |
N-PLC hw reset function.
This function resets the module by toggling the RST pin.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
err_t nplc_init | ( | nplc_t * | ctx, |
nplc_cfg_t * | cfg ) |
N-PLC initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See nplc_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void nplc_read_s_register | ( | nplc_t * | ctx, |
char * | s_reg ) |
N-PLC read s register function.
This function sends a desired read S register command with the question mark and CR/LF bytes appended to.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | s_reg | : S register command (without question mark and CR/LF). |
void nplc_send_cmd | ( | nplc_t * | ctx, |
char * | cmd ) |
N-PLC send command function.
This function sends a desired command with the CR/LF bytes appended to.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | cmd | : Command string. |
void nplc_set_cts_pin | ( | nplc_t * | ctx, |
uint8_t | state ) |
N-PLC set cts pin function.
This function sets the handshake in (CTS) pin to a desired state.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
void nplc_set_md1_pin | ( | nplc_t * | ctx, |
uint8_t | state ) |
N-PLC set md1 pin function.
This function sets the mode select 1 (MD1) pin to a desired state.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | state | : Mode select 1 pin (1-boot, 0-normal). |
void nplc_set_mode | ( | nplc_t * | ctx, |
uint8_t | mode ) |
N-PLC set mode function.
This function sets operation mode to command or data.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | mode | :
|
void nplc_set_rst_pin | ( | nplc_t * | ctx, |
uint8_t | state ) |
N-PLC set rst pin function.
This function sets the reset (RST) pin to a desired state.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | state | : Pin logic state (Active Low). |
void nplc_sw_reset | ( | nplc_t * | ctx | ) |
N-PLC sw reset function.
This function software resets the device.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
void nplc_write_s_register | ( | nplc_t * | ctx, |
char * | s_reg, | ||
char * | param_buf ) |
N-PLC write s register function.
This function sends a desired write S register command with the parameter buffer and CR/LF bytes appended to.
[in] | ctx | : Click context object. See nplc_t object definition for detailed explanation. |
[in] | s_reg | : S register command (without equal sign and CR/LF). |
[in] | param_buf | : Parameters string. |