nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Go to the documentation of this file. 8 #ifndef NRFCXX_MISC_SX1509B_HPP 9 #define NRFCXX_MISC_SX1509B_HPP 68 uint16_t input_disable = 0U;
69 uint16_t long_slew = 0U;
70 uint16_t low_drive = 0U;
71 uint16_t pull_up = 0U;
72 uint16_t pull_down = 0U;
73 uint16_t open_drain = 0U;
74 uint16_t polarity = 0U;
90 return led_driver_cache_;
127 unsigned int configuration (
unsigned int psel) const noexcept;
156 unsigned int pin_cnf,
157 int initial = -1) noexcept;
187 uint16_t pull_up = 0) noexcept;
217 static constexpr
auto RegClock_FREQ_Pos = 5U;
218 static constexpr uint16_t RegClock_FREQ_Msk = 0x03 << RegClock_FREQ_Pos;
219 static constexpr uint16_t RegClock_FREQ_Off = 0;
220 static constexpr uint16_t RegClock_FREQ_External = 1;
221 static constexpr uint16_t RegClock_FREQ_2MHz = 2;
223 static constexpr
auto RegClock_OSCIO_Pos = 4U;
224 static constexpr uint16_t RegClock_OSCIO_Msk = 0x01 << RegClock_OSCIO_Pos;
225 static constexpr uint16_t RegClock_OSCIO_Input = 0;
226 static constexpr uint16_t RegClock_OSCIO_Output = 1;
228 static constexpr
auto RegClock_OUTFREQ_Pos = 0U;
229 static constexpr uint16_t RegClock_OUTFREQ_Msk = 0x0F << RegClock_OUTFREQ_Pos;
230 static constexpr uint16_t RegClock_OUTFREQ_Low = 0;
231 static constexpr uint16_t RegClock_OUTFREQ_High = 0x0F;
233 static constexpr
auto RegMisc_LEDB_Pos = 7U;
234 static constexpr uint16_t RegMisc_LEDB_Msk = 1U << RegMisc_LEDB_Pos;
235 static constexpr uint16_t RegMisc_LEDB_Linear = 0;
236 static constexpr uint16_t RegMisc_LEDB_Logarithmic = 1;
238 static constexpr
auto RegMisc_LEDFREQ_Pos = 4U;
239 static constexpr uint16_t RegMisc_LEDFREQ_Msk = 0x07U << RegMisc_LEDFREQ_Pos;
240 static constexpr uint16_t RegMisc_LEDFREQ_Off = 0;
242 static constexpr
auto RegMisc_LEDA_Pos = 3U;
243 static constexpr uint16_t RegMisc_LEDA_Msk = 1U << RegMisc_LEDA_Pos;
244 static constexpr uint16_t RegMisc_LEDA_Linear = 0;
245 static constexpr uint16_t RegMisc_LEDA_Logarithmic = 1;
247 static constexpr
auto RegMisc_NRESET_Pos = 2U;
248 static constexpr uint16_t RegMisc_NRESET_Msk = 1U << RegMisc_NRESET_Pos;
249 static constexpr uint16_t RegMisc_NRESET_POR = 0;
250 static constexpr uint16_t RegMisc_NRESET_ResetCounters = 1;
252 static constexpr
auto RegMisc_AUTOINC_Pos = 1U;
253 static constexpr uint16_t RegMisc_AUTOINC_Msk = 1U << RegMisc_AUTOINC_Pos;
254 static constexpr uint16_t RegMisc_AUTOINC_On = 0;
255 static constexpr uint16_t RegMisc_AUTOINC_Off = 1;
257 static constexpr
auto RegMisc_AUTOCLR_Pos = 0U;
258 static constexpr uint16_t RegMisc_AUTOCLR_Msk = 1U << RegMisc_AUTOCLR_Pos;
259 static constexpr uint16_t RegMisc_AUTOCLR_On = 0;
260 static constexpr uint16_t RegMisc_AUTOCLR_Off = 1;
262 static constexpr
auto RegTOnX_TOn_Pos = 0U;
263 static constexpr uint16_t RegTOnX_TOn_Msk = 0x1F << RegTOnX_TOn_Pos;
264 static constexpr
auto RegOffX_TOff_Pos = 3U;
265 static constexpr uint16_t RegOffX_TOff_Msk = 0x1F << RegOffX_TOff_Pos;
266 static constexpr
auto RegOffX_IOff_Pos = 0U;
267 static constexpr uint16_t RegOffX_IOff_Msk = 0x07 << RegOffX_IOff_Pos;
277 unsigned int addr = 0) noexcept;
298 int clock () const noexcept;
304 int clock (uint8_t value) noexcept;
310 int misc () const noexcept;
316 int misc (uint8_t value) noexcept;
329 bool source_current = false) noexcept;
369 const
led_type& cfg) const noexcept;
398 uint16_t clear) noexcept;
401 void reset_cache_ () noexcept;
404 gpio::pin_reference resetn_;
406 uint16_t led_driver_cache_ = 0;
407 uint8_t clock_cache_ = 0;
408 uint8_t misc_cache_ = 0;
Abstraction around the Semtex SX1509B Level-Shifting GPIO Extender.
Definition: sx1509b.hpp:25
Basic structure for LED configuration.
Definition: sx1509b.hpp:190
Extended configuration for fade-capable pins.
Definition: sx1509b.hpp:208
uint8_t misc_cache() const
Access the internal cache of Misc.
Definition: sx1509b.hpp:100
uint8_t address
The I2C address used to communicate with the device.
Definition: sx1509b.hpp:42
Structure for SX1509 registers that are controlled.
Definition: sx1509b.hpp:66
int hw_reset() noexcept
Reset the device to its power-on state via RESETn.
The pieces you need to talk to the device.
Definition: sx1509b.hpp:29
int configure_as_leds(uint16_t leds, bool source_current=false) noexcept
Configure a set of pins for LED operations.
int8_t resetn_psel
GPIO pin selector used for RESETn signal.
Definition: sx1509b.hpp:35
periph::TWI & twi
Reference to TWI device used to communicate with sensor.
Definition: sx1509b.hpp:32
int configure(unsigned int psel, unsigned int pin_cnf, int initial=-1) noexcept
Change the GPIO pin configuration for the given IOX pin.
int led_configuration(unsigned int psel, led_type &cfg) const noexcept
Read the LED configuration for the given pin.
Wrapper around the nRF51 TWI peripheral.
Definition: periph.hpp:1528
uint8_t trise
Fade in register.
Definition: sx1509b.hpp:211
int clock() const noexcept
Read the Clock register from the SX1509B.
const gpio_regs_type & gpio_cache() const noexcept
Access the internal cache of GPIO registers.
Definition: sx1509b.hpp:82
uint8_t tfall
Fade out register.
Definition: sx1509b.hpp:214
int multiconfigure(uint16_t out_set, uint16_t out_clear, uint16_t pull_down, uint16_t pull_up=0) noexcept
Configure multiple pins at once.
int output_sct(uint16_t set, uint16_t clear) noexcept
Multi-signal set, clear, and toggle API.
const iface_config_type & iface_config() const
Access the interface configuration for the device.
Definition: sx1509b.hpp:53
uint16_t led_driver_cache() const
Access the internal cache of LEDDriverEnable.
Definition: sx1509b.hpp:88
int led_configure(unsigned int psel, const led_type &cfg) const noexcept
Set the LED configuration for the given pin.
uint8_t clock_cache() const
Access the internal cache of Clock.
Definition: sx1509b.hpp:94
int reload_cache() noexcept
Read all locally cached registers from the device.
unsigned int configuration(unsigned int psel) const noexcept
Return the GPIO pin configuration for the given IOX pin.
int misc() const noexcept
Read the Misc register from the SX1509B.
Abstraction of Nordic device peripherals.
Primary namespace for nrfcxx functionality.
Definition: clock.hpp:17
sx1509b(iface_config_type &ifc, unsigned int addr=0) noexcept
Instantiate the device.
int sw_reset() noexcept
Reset the device to its power-on state via software command.