rocketlib function reference
-
struct pwm_pin_config_t
- file common.h
Defines
-
ROCKETLIB_VERSION_MAJOR
Rocketlib major release number, shall be design cycle year.
-
ROCKETLIB_VERSION_MINOR
Rocketlib minor release number, shall be the Nth release of the design cycle.
-
w_assert(statement)
Assertion.
Works just like standard C assertion, except use can define custom assertion failure handler(see
w_assert_fail
), only active whenW_DEBUG
is defined
Enums
-
enum w_status_t
Standard error code.
Values:
-
enumerator W_SUCCESS
Success.
-
enumerator W_FAILURE
Failure, if not one of the more specific case below.
-
enumerator W_INVALID_PARAM
Illegal function call arguments/parameters.
-
enumerator W_IO_ERROR
IO error, for example no SD card was plugged in.
-
enumerator W_IO_TIMEOUT
IO timeout, for example SD card takes too long to respond.
-
enumerator W_MATH_ERROR
Math error, for example divide by zero.
-
enumerator W_OVERFLOW
Buffer overflow, for example trying to write to a full FIFO.
-
enumerator W_SUCCESS
Functions
-
void w_assert_fail(const char *file, int line, const char *statement)
Assertion fail handler.
Assertion fail handler, shall be implemented in the firmware, only used if
W_DEBUG
is defined- Parameters:
file – Path to C source file contains assertion failure
line – C source line number of assertion failure
statement – Statement caused assertion failure
-
ROCKETLIB_VERSION_MAJOR
- file crc8.h
Functions
-
uint8_t crc8_checksum(const uint8_t *pdata, size_t nbytes, uint8_t crc)
Compute CRC8.
Computes the CRC8 checksum of input data
- Parameters:
pdata – Input data buffer
nbytes – Buffer size in bytes
crc – CRC8 checksum of previous CRC8 calculation if calculating checksum on multiple discontinuous buffers, otherwise 0
- Returns:
Computed CRC8 checksum
-
uint8_t crc8_checksum(const uint8_t *pdata, size_t nbytes, uint8_t crc)
- file electrical.h
- file i2c.h
Functions
-
void i2c_init(uint8_t clkdiv)
-
bool i2c_write_data(uint8_t address, const uint8_t *data, uint8_t len)
-
bool i2c_read_data(uint8_t address, uint8_t *data, uint8_t len)
-
bool i2c_write_reg8(uint8_t address, uint8_t reg, uint8_t val)
-
bool i2c_write_reg16(uint8_t address, uint8_t reg, uint16_t val)
-
bool i2c_read_reg8(uint8_t address, uint8_t reg, uint8_t *value)
-
bool i2c_read_reg16(uint8_t address, uint8_t reg, uint16_t *value)
-
void i2c_init(uint8_t clkdiv)
- file low_pass_filter.h
Functions
-
static inline double sample_freq(double time_diff_ms)
-
static inline double low_pass_alpha(double TR, double time_diff_ms)
-
w_status_t low_pass_filter_init(double *alpha, double response_time)
-
w_status_t update_low_pass(double alpha, uint16_t new_input_value, double *low_pass_value)
-
static inline double sample_freq(double time_diff_ms)
- file pwm.h
Defines
-
CONCAT(a, b, c)
-
CCPR_L(module)
-
CCPR_H(module)
-
CCP_CON(module)
-
GET_TRIS_REG(port)
-
GET_PPS_REG(port, pin)
-
SET_TRIS_OUTPUT(port, pin)
-
ASSIGN_PPS(port, pin, ccp_module)
Functions
-
w_status_t pwm_init(uint8_t ccp_module, pwm_pin_config_t pin_config, uint16_t pwm_period)
-
w_status_t pwm_update_duty_cycle(uint8_t ccp_module, uint16_t duty_cycle)
-
CONCAT(a, b, c)
- file timer.h
PIC18 Timer driver provides millis function.
This module provides basic timer functionalities, such as initializing Timer0, handling interrupts, and tracking milliseconds since the timer was started.
Functions
-
void timer0_init(void)
Initializes Timer0 for time tracking. This function must be called before using any other timer-related functionality.
Enables Timer0 interrupt.
Sets the timer to 8-bit mode.
Driven by a 500 kHz clock.
Ensures the timer is synchronized to the system clock.
-
void timer0_handle_interrupt(void)
Function should be called from main ISR when Timer0 interrupt is triggered.
This function should be called from the main Interrupt Service Routine (ISR) whenever the Timer0 interrupt is triggered. It updates the internal time counter.
Warning
This function does not clear the interrupt flag (
PIR3bits.TMR0IF
), This is the responsibility of the top level ISR.
-
uint32_t millis(void)
Returns the number of milliseconds since
timer0_init()
was called.Returns the number of milliseconds since
timer0_init()
was called. This is a safe function that disables interrupts momentarily to return a consistent value.
-
void timer0_init(void)
- dir /home/runner/work/docs/docs/firmware-library
- dir /home/runner/work/docs/docs/firmware-library/rocketlib/rocketlib/include
- dir /home/runner/work/docs/docs/firmware-library/rocketlib
- dir /home/runner/work/docs/docs/firmware-library/rocketlib/rocketlib