GlobLib
HAL and API libraries for MCUs and hardware.
|
Header file for UCConfig module. More...
Files | |
file | ucconfig.h |
Header file for UCConfig module. | |
Macros | |
#define | UCCONFIG_KEY_LENGTH 4 |
The length of the key which the PC needs to send to enter Config mode. | |
#define | UCCONFIG_KEY_1 2 |
Key character 1. | |
#define | UCCONFIG_KEY_2 4 |
Key character 2. | |
#define | UCCONFIG_KEY_3 6 |
Key character 3. | |
#define | UCCONFIG_KEY_4 8 |
Key character 4. | |
#define | UCCONFIG_FIFO_SIZE 32 |
The size of the FIFO used by the module, don't change this. | |
#define | UCCONFIG_FRAME_END 22 |
The frame and character. | |
#define | UCCONFIG_SET_MEMORY_ADDRESS 12 |
Command used to initiate setting the memory address pointer. | |
#define | UCCONFIG_SET_WRITE_FRAME 13 |
Command used to initial writing data. | |
#define | UCCONFIG_READ_FRAME 14 |
Command used to initial reading data. | |
#define | UCCONFIG_TERMINATE 15 |
Command used to exit from commmand mode. | |
#define | UCCONFIG_AT_ADDRESS 16 |
Command used get the current memory addresss pointer. | |
#define | UCCONFIG_ACK 17 |
Command used to acknowledge a command. | |
#define | UCCONFIG_NACK 18 |
Command used to not acknowledge a command. | |
#define | UCCONFIG_NULL 19 |
ASCII character used for NULL. | |
#define | UCCONFIG_NOT_USED 20 |
ASCII character used for Not used. | |
#define | UCCONFIG_NEWLINE 10 |
ASCII character used for new line, UC needs to send this so python module can easly pick end of command. | |
#define | UCCONFIG_LENGTH_ZERO 21 |
ASCII character used for zero length data frames. | |
#define | UCCONFIG_TYPE_NONE 11 |
ASCII character used for none types. | |
#define | UCCONFIG_TYPE_UINT8_T 12 |
ASCII character used for uint8_t types. | |
#define | UCCONFIG_TYPE_INT8_T 13 |
ASCII character used for int8_t types. | |
#define | UCCONFIG_TYPE_UINT16_T 14 |
ASCII character used for uint16_t types. | |
#define | UCCONFIG_TYPE_INT16_T 15 |
ASCII character used for int16_t types. | |
#define | UCCONFIG_TYPE_UINT32_T 16 |
ASCII character used for uint32_t types. | |
#define | UCCONFIG_TYPE_INT32_T 17 |
ASCII character used for int32_t types. | |
#define | UCCONFIG_TYPE_FLOAT 18 |
ASCII character used for float types. | |
#define | UCCONFIG_TYPE_CHAR 19 |
ASCII character used for char types. | |
#define | UCCONFIG_ACTIVE_MODE_TIMEOUT 0xFFFF |
Number of loop iterratios before automattically exits from active mode. | |
#define | UCCONFIG_get(X, Y) |
UCCONFIG_GET() is the function macro used to get the value of any variable type in flash. More... | |
Functions | |
void | UCCONFIG_setup (uint8_t(*flash_read)(uint16_t address), void(*flash_write)(uint8_t byte, uint16_t adrress), void(*serial_write)(uint8_t byte)) |
Set up the module, this should be called before any other module function will work. More... | |
void | UCCONFIG_listen (uint8_t receivedByte) |
Listens to serial communication and sets module in config mode if correct key is sent. More... | |
void | UCCONFIG_loop (void) |
Runs config mode if the key has been received. More... | |
void | UCCONFIG_setAddressOffset (uint16_t address) |
Set the memory address offset of the flash memory pointer (optional) More... | |
void | UCCONFIG_setOnEnter (void(*on_enter)(void)) |
Sets the function which is called when config mode is entered (optional) More... | |
void | UCCONFIG_setOnExit (void(*on_exit)(void)) |
Sets the function which is called when config mode is exited (optional) More... | |
void | UCCONFIG_setOnFirstWrite (void(*on_first)(void)) |
Sets the function which is called when the first byte is written to the UC from PC. More... | |
void | ucconfig_get_c (char *data, uint16_t address) |
Get a character from the given memory address. More... | |
void | ucconfig_get_u8 (uint8_t *data, uint16_t address) |
Get a uint8 from the given memory address. More... | |
void | ucconfig_get_8 (int8_t *data, uint16_t address) |
Get a int8 from the given memory address. More... | |
void | ucconfig_get_u16 (uint16_t *data, uint16_t address) |
Get a uint16 from the given memory address. More... | |
void | ucconfig_get_16 (int16_t *data, uint16_t address) |
Get a int16 from the given memory address. More... | |
void | ucconfig_get_u32 (uint32_t *data, uint16_t address) |
Get a uint32 from the given memory address. More... | |
void | ucconfig_get_32 (int32_t *data, uint16_t address) |
Get a int32 from the given memory address. More... | |
void | ucconfig_get_float (float *data, uint16_t address) |
Get a float from the given memory address. More... | |
Header file for UCConfig module.
This module depends on three other common libraries for its usage:
This module is part of a larger project. Documentation is being developed.
The example variables are populated from the python modules variables.yml
The python module generates the header file which is included in the example program
#define UCCONFIG_get | ( | X, | |
Y | |||
) |
UCCONFIG_GET() is the function macro used to get the value of any variable type in flash.
This function works in conjuction with generated header file. See module example usage.
X | The pointer to the data containter for the variable, the value located in flash is stored in the containter. |
Y | The address the data is located at. |
Definition at line 183 of file ucconfig.h.
void ucconfig_get_16 | ( | int16_t * | data, |
uint16_t | address | ||
) |
Get a int16 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a int16 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 135 of file ucconfig.c.
void ucconfig_get_32 | ( | int32_t * | data, |
uint16_t | address | ||
) |
Get a int32 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a int32 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 147 of file ucconfig.c.
void ucconfig_get_8 | ( | int8_t * | data, |
uint16_t | address | ||
) |
Get a int8 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a int8 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 122 of file ucconfig.c.
void ucconfig_get_c | ( | char * | data, |
uint16_t | address | ||
) |
Get a character from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a character to store the data in. |
address | Address in flash to read the data from. |
Definition at line 110 of file ucconfig.c.
void ucconfig_get_float | ( | float * | data, |
uint16_t | address | ||
) |
Get a float from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a float to store the data in. |
address | Address in flash to read the data from. |
Definition at line 153 of file ucconfig.c.
void ucconfig_get_u16 | ( | uint16_t * | data, |
uint16_t | address | ||
) |
Get a uint16 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a uint16 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 128 of file ucconfig.c.
void ucconfig_get_u32 | ( | uint32_t * | data, |
uint16_t | address | ||
) |
Get a uint32 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a uint32 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 141 of file ucconfig.c.
void ucconfig_get_u8 | ( | uint8_t * | data, |
uint16_t | address | ||
) |
Get a uint8 from the given memory address.
This function is utilised in the marco expansion of UCCONFIG_get(). It should not be called manually
data | Pointer to a uint8 to store the data in. |
address | Address in flash to read the data from. |
Definition at line 116 of file ucconfig.c.
void UCCONFIG_listen | ( | uint8_t | receivedByte | ) |
Listens to serial communication and sets module in config mode if correct key is sent.
This function should be placed in the output stream of the serial communication. See module example
receivedByte | A single byte recieved through serial communication. |
Definition at line 1007 of file ucconfig.c.
void UCCONFIG_loop | ( | void | ) |
Runs config mode if the key has been received.
This function should be placed in the programs main loop or on a timer callback (see example)
Definition at line 84 of file ucconfig.c.
void UCCONFIG_setAddressOffset | ( | uint16_t | address | ) |
Set the memory address offset of the flash memory pointer (optional)
This module initialises with memory pointer based at position 0. A offset can be supplied to charge the inital position of config parameters in flash.
address | The offset to be used. |
Definition at line 159 of file ucconfig.c.
void UCCONFIG_setOnEnter | ( | void(*)(void) | on_enter | ) |
Sets the function which is called when config mode is entered (optional)
The function must be of type specified. Use a wrapper to call different function types (see example)
on_enter | The function to be called. |
Definition at line 97 of file ucconfig.c.
void UCCONFIG_setOnExit | ( | void(*)(void) | on_exit | ) |
Sets the function which is called when config mode is exited (optional)
The function must be of type specified. Use a wrapper to call different function types (see example)
on_exit | The function to be called. |
Definition at line 101 of file ucconfig.c.
void UCCONFIG_setOnFirstWrite | ( | void(*)(void) | on_first | ) |
Sets the function which is called when the first byte is written to the UC from PC.
The function must be of type specified. Use a wrapper to call different function types (see example)
on_first | The function to be called. |
Definition at line 105 of file ucconfig.c.
void UCCONFIG_setup | ( | uint8_t(*)(uint16_t address) | flash_read, |
void(*)(uint8_t byte, uint16_t adrress) | flash_write, | ||
void(*)(uint8_t byte) | serial_write | ||
) |
Set up the module, this should be called before any other module function will work.
See module example
flash_read | Function pointer to a function which reads one byte from a memory address. The address can be no longer than 16 bits wide |
flash_write | Function pointer to a function which writes one byte to the memory address specified |
serial_write | Funtions pointer to a function which writes one byte to a serial output stream such as USART or USB. This should be the same stream to which the PC uses to communicate with the UC |