anna_b112

package
v0.0.0-...-57044a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package anna_b112 supports serial communication and reprogramming for the u-blox ANNA-B112 Bluetooth (BLE) module.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Serial device path
	UARTPath = "/dev/ttymxc0"
	// Serial device speed
	UARTSpeed = 115200
)
View Source
var (
	// Directory to optionally save backed up and written firmware images.
	CachePath = ""

	// OpenOCD binary path, if the path contains a slash it is tried
	// directly, otherwise it is searched in the directories named by the
	// PATH environment variable.
	OpenOCDPath = "openocd"
)

Functions

func ATSetInternalRCLFCK

func ATSetInternalRCLFCK() (err error)

Set the low frequency clock source to the internal RC with default parameters recommended by Nordic SDK, using the AT+UPRODLFCLK command. (see nRF5_SDK_15.3.0_59ac345/components/softdevice/s132/headers/nrf_sdm.h).

func Backup

func Backup() (flashPath string, uicrPath string, err error)

Backup the nrf52.flash and nrf52.uicr regions.

func Disable

func Disable() (err error)

Toggle BLE visibility to non discoverable (AT+UBTDM=1), non pairable (AT+UBTPM=1), non connectable (AT+UBTCM=1) and disable any BLE role (AT+UBTLE=0), finally permanently store current configuration (AT&W, AT+CPWROFF).

func Enable

func Enable() (err error)

Toggle BLE visibility to always discoverable (AT+UBTDM=3), pairable (AT+UBTPM=2), connectable (AT+UBTCM=2) and set BLE role to peripheral (AT+UBTLE=2), finally permanently store current configuration (AT&W, AT+CPWROFF).

func EnterBootloaderMode

func EnterBootloaderMode() (err error)

Enter bootloader mode by driving low SWITCH_1 (GPIO 27) and SWITCH_2 (GPIO 26) during a module reset cycle.

func EnterNormalMode

func EnterNormalMode() (err error)

Enter normal mode by driving high SWITCH_1 (GPIO 27) and SWITCH_2 (GPIO 26) during a module reset cycle.

func Flash

func Flash(flashPath string, uicrPath string) (err error)

Write the nrf52.flash and nrf52.uicr regions. *IMPORTANT*: the `mass_erase` command is issued before starting the procedure, all data contained in the flash and uicr regions (including module MAC address and/or any other configuration) will be lost.

func FlashSetInternalRCLFCK

func FlashSetInternalRCLFCK() (err error)

Set the low frequency clock source to the internal RC with default parameters recommended by Nordic SDK, by modifying the relevant area in the module flash. (see nRF5_SDK_15.3.0_59ac345/components/softdevice/s132/headers/nrf_sdm.h).

func GetDeviceManufacturer

func GetDeviceManufacturer() (manufacturer string, err error)

Get device manufacturer (AT+CGMI).

func GetDeviceModel

func GetDeviceModel() (model string, err error)

Get device model (AT+CGMM).

func GetDeviceName

func GetDeviceName() (name string, err error)

Get device name (AT+UBTLN?).

func GetDeviceSerial

func GetDeviceSerial() (model string, err error)

Get product serial number (AT+CGSN).

func GetSoftwareVersion

func GetSoftwareVersion() (version string, err error)

Get software version (AT+CGMR).

func Info

func Info() (id string, err error)

Assemble the device identification string from device manufacturer, model, product serial, software version and Bluetooth device name.

func Reset

func Reset() (err error)

Reset the BLE module by toggling the RESET_N pin (GPIO 9).

func SetDeviceName

func SetDeviceName(name string) (err error)

Set Bluetooth device name (AT+UBTLN="device name") and parmanently store the current configuration (AT+&W, AT+CPWROFF).

func Update

func Update(updateFile string) (err error)

Update the ANNA-B112 firmware, a backup of the current flash and UICR region is created before overwriting them. The update also performs the operation described in FlashSetInternalRCLFCK.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL