BNO055 extension board example for SAME70.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
Function Prototype Declaration | |
static void | sensor_init (void) |
static void | sensors_data_print (void) |
Reads output data of the sensor and sends them data via USART. More... | |
static void | bno055_interrupt_handler_no_motion (void) |
No motion interrupt handler. More... | |
static void | bno055_interrupt_handler_any_motion (void) |
Any motion interrupt handler. More... | |
static void | bno055_interrupt_handler (void) |
Sensor general interrupt handler, calls specific handlers. More... | |
void | SysTick_Handler (void) |
Handler for System Tick interrupt. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
int | main (void) |
Initializes the whole system and runs the desired application. More... | |
Variables | |
bool | read_sensor_data = false |
bool | sensor_data_changed = false |
uint8_t | sleep_state |
uint32_t | systick_count = 0 |
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Sensor general interrupt handler, calls specific handlers.
This function is called when an external interrupt is triggered by the sensor, checks interrupt registers of BNO055 to determine the source and type of interrupt and calls the specific interrupt handler accordingly.
[in] | NULL | |
[out] | NULL |
References bno055_get_intr_stat_accel_any_motion(), bno055_get_intr_stat_accel_no_motion(), bno055_get_intr_stat_gyro_any_motion(), bno055_interrupt_handler_any_motion(), bno055_interrupt_handler_no_motion(), bno055_set_intr_rst(), ENABLED, SLEEP_STATE_AWAKE, and SLEEP_STATE_SLEEP.
Referenced by main().
|
static |
Any motion interrupt handler.
This function is called when an any-motion interrupt is triggered by the accelerometer or gyroscope in BNO055, turns off the green light, sends a message to the terminal window and starts data stream.
References ioport_set_pin_level(), RGB_LED_G, and RGB_LED_G_OFF.
Referenced by bno055_interrupt_handler().
|
static |
No motion interrupt handler.
This function is called when a no-motion interrupt is triggered by the accelerometer in BNO055, turns the LED color to green, stops data stream and sends a message to the terminal window.
References ioport_set_pin_level(), RGB_LED_G, and RGB_LED_G_ON.
Referenced by bno055_interrupt_handler().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Initializes the whole system and runs the desired application.
This is the main function of the project. It calls initialization functions of the main board and the sensor. It initializes the host microcontroller unit and all its required modules such as clock sources, I2C, TC, USART, PINMUX and interrupt controllers. It also initializes the global variables.
References bno055_gpio_config(), bno055_i2c_bus_init(), bno055_interrupt_handler(), board_init(), BUTTON_0_ACTIVE, BUTTON_0_PIN, configure_console(), extint_initialize(), ioport_get_pin_level(), ioport_set_pin_level(), LED_0_ACTIVE, LED_0_PIN, RGB_LED_G, RGB_LED_G_OFF, sensor_init(), sensors_data_print(), SLEEP_STATE_AWAKE, STRING_HEADER, sysclk_get_cpu_hz(), and sysclk_init().
|
static |
References bno055_initialize(), bno055_set_accel_any_motion_durn(), bno055_set_accel_any_motion_no_motion_axis_enable(), bno055_set_accel_any_motion_thres(), bno055_set_accel_slow_no_motion_durn(), bno055_set_accel_slow_no_motion_thres(), bno055_set_gyro_any_motion_axis_enable(), bno055_set_intr_accel_any_motion(), bno055_set_intr_accel_no_motion(), bno055_set_intr_gyro_any_motion(), bno055_set_intr_mask_accel_any_motion(), bno055_set_intr_mask_accel_no_motion(), bno055_set_intr_mask_gyro_any_motion(), bno055_set_intr_rst(), bno055_set_operation_mode(), bno055_set_power_mode(), ENABLED, OPERATION_MODE_NDOF, and POWER_MODE_LOWPOWER.
Referenced by main().
|
static |
Reads output data of the sensor and sends them data via USART.
This function reads output data of BNO055 (Three Euler angles) using sensor API functions and sends sensor data in ASCII Format via USART.
[in] | NULL | |
[out] | NULL |
References bno055_read_accel_xyz(), bno055_read_euler_hrp(), bno055_read_gravity_xyz(), bno055_read_gyro_xyz(), bno055_read_linear_accel_xyz(), bno055_read_mag_xyz(), bno055_euler_t::h, bno055_euler_t::p, bno055_euler_t::r, bno055_accel_t::x, bno055_mag_t::x, bno055_gyro_t::x, bno055_linear_accel_t::x, bno055_gravity_t::x, bno055_accel_t::y, bno055_mag_t::y, bno055_gyro_t::y, bno055_linear_accel_t::y, bno055_gravity_t::y, bno055_accel_t::z, bno055_mag_t::z, bno055_gyro_t::z, bno055_linear_accel_t::z, and bno055_gravity_t::z.
Referenced by main().
void SysTick_Handler | ( | void | ) |
Handler for System Tick interrupt.
uint8_t sleep_state |
Holds sleep state of the system
uint32_t systick_count = 0 |