18 #include "Si446x_config.h" 24 #define SI446X_ENABLE_ADDRMATCHING 0 27 #define SI446X_MAX_PACKET_LEN 128 29 #define SI446X_MAX_TX_POWER 127 31 #define SI446X_WUT_RUN 1 32 #define SI446X_WUT_BATT 2 33 #define SI446X_WUT_RX 4 35 #define SI446X_GPIO_PULL_EN 0x40 36 #define SI446X_GPIO_PULL_DIS 0x00 37 #define SI446X_NIRQ_PULL_EN 0x40 38 #define SI446X_NIRQ_PULL_DIS 0x00 39 #define SI446X_SDO_PULL_EN 0x40 40 #define SI446X_SDO_PULL_DIS 0x00 41 #define SI446X_PIN_PULL_EN 0x40 42 #define SI446X_PIN_PULL_DIS 0x00 44 #define SI446X_GPIO_DRV_HIGH 0x00 45 #define SI446X_GPIO_DRV_MED_HIGH 0x20 46 #define SI446X_GPIO_DRV_MED_LOW 0x40 47 #define SI446X_GPIO_DRV_LOW 0x60 49 #define SI446X_PROP_GROUP_GLOBAL 0x00 50 #define SI446X_PROP_GROUP_INT 0x01 51 #define SI446X_PROP_GROUP_FRR 0x02 52 #define SI446X_PROP_GROUP_PREAMBLE 0x10 53 #define SI446X_PROP_GROUP_SYNC 0x11 54 #define SI446X_PROP_GROUP_PKT 0x12 55 #define SI446X_PROP_GROUP_MODEM 0x20 56 #define SI446X_PROP_GROUP_MODEM_CHFLT 0x21 57 #define SI446X_PROP_GROUP_PA 0x22 58 #define SI446X_PROP_GROUP_SYNTH 0x23 59 #define SI446X_PROP_GROUP_MATCH 0x30 60 #define SI446X_PROP_GROUP_FREQ_CONTROL 0x40 61 #define SI446X_PROP_GROUP_RX_HOP 0x50 62 #define SI446X_PROP_GROUP_PTI 0xF0 252 #if SI446X_ENABLE_ADDRMATCHING 258 SI446X_ADDRMODE_DISABLE,
259 SI446X_ADDRMODE_ADDR,
260 SI446X_ADDRMODE_ADDRBROADCAST
263 #define SI446X_CBS_ADDRMATCH _BV(7+8) 264 #define SI446X_CBS_ADDRMISS _BV(6+8) 267 #define SI446X_CBS_SENT _BV(5+8) 268 //#define SI446X_CBS_RXCOMPLETE _BV(4+8) 270 #define SI446X_CBS_RXBEGIN _BV(0) 271 //#define SI446X_CBS_INVALIDSYNC _BV(5) 273 #if defined(__cplusplus) 392 void Si446x_setupWUT(uint8_t r, uint16_t m, uint8_t ldc, uint8_t config);
475 #if DOXYGEN || defined(ARDUINO) || SI446X_INTERRUPTS == 0 478 #define Si446x_SERVICE() ((void)(0)) 481 #if SI446X_ENABLE_ADDRMATCHING 554 #if DOXYGEN || SI446X_INTERRUPTS != 0 556 #if !defined(DOXYGEN) 557 static inline void _Si446x_iRestore(
const uint8_t *__s)
560 __asm__
volatile (
"" :::
"memory");
578 #define SI446X_NO_INTERRUPT() \ 579 for(uint8_t si446x_irq __attribute__((__cleanup__(_Si446x_iRestore))) = Si446x_irq_off(), \ 580 si446x_tmp = 1; si446x_tmp ; si446x_tmp = 0) 583 #define SI446X_NO_INTERRUPT() ((void)(0)); 586 #if defined(__cplusplus)
uint16_t patch
Patch.
Definition: Si446x.h:219
NIRQ.
Definition: Si446x.h:232
uint8_t revInternal
Revision internal.
Definition: Si446x.h:218
void Si446x_irq_on(uint8_t origVal)
When using interrupts use this to re-enable them for the Si446x.
void Si446x_setTxPower(uint8_t pwr)
Set the transmit power. The output power does not follow the pwr value, see the Si446x datasheet for ...
uint8_t chipRev
Chip revision.
Definition: Si446x.h:209
GPIO 3.
Definition: Si446x.h:230
void Si446x_setupCallback(uint16_t callbacks, uint8_t state)
Enable or disable callbacks. This is mainly to configure what events should wake the microcontroller ...
This will never be returned since SPI activity will wake the radio into SI446X_STATE_SPI_ACTIVE.
Definition: Si446x.h:242
void Si446x_writeGPIO(si446x_gpio_t pin, uint8_t value)
Configure GPIO/NIRQ/SDO pin.
uint16_t part
Part ID.
Definition: Si446x.h:210
uint8_t Si446x_dump(void *buff, uint8_t group)
Get all values of a property group.
si446x_nirq_mode_t
NIRQ pin modes (see the Si446x API docs for what they all mean)
Definition: Si446x.h:114
si446x_sdo_mode_t
SDO pin modes (see the Si446x API docs for what they all mean)
Definition: Si446x.h:161
uint16_t Si446x_adc_gpio(uint8_t pin)
Read pin ADC value.
uint16_t Si446x_adc_battery(void)
Read supply voltage.
Data structure for storing chip info from Si446x_getInfo()
Definition: Si446x.h:208
void Si446x_read(void *buff, uint8_t len)
Read received data from FIFO.
uint8_t customer
Customer.
Definition: Si446x.h:213
uint8_t partBuild
Part build.
Definition: Si446x.h:211
si446x_gpio_mode_t
GPIO pin modes (see the Si446x API docs for what they all mean)
Definition: Si446x.h:67
Will return as SI446X_STATE_TX.
Definition: Si446x.h:246
si446x_state_t Si446x_getState(void)
Get the radio status.
si446x_state_t
Radio states, returned from Si446x_getState()
Definition: Si446x.h:239
void Si446x_RX(uint8_t channel)
Enter receive mode.
GPIO 1.
Definition: Si446x.h:228
uint8_t func
Function.
Definition: Si446x.h:220
uint8_t Si446x_sleep(void)
Enter sleep mode.
int16_t Si446x_getRSSI(void)
Get the current RSSI, the chip needs to be in receive mode for this to work.
void Si446x_init(void)
Initialise, must be called before anything else!
uint8_t Si446x_irq_off(void)
When using interrupts use this to disable them for the Si446x.
GPIO 2.
Definition: Si446x.h:229
uint8_t revBranch
Revision branch.
Definition: Si446x.h:217
void Si446x_disableWUT(void)
Disable the wake up timer.
si446x_gpio_t
GPIOs for passing to Si446x_writeGPIO(), or for masking when reading from Si446x_readGPIO() ...
Definition: Si446x.h:226
SDO.
Definition: Si446x.h:233
void Si446x_setLowBatt(uint16_t voltage)
Set the low battery voltage alarm.
void Si446x_getInfo(si446x_info_t *info)
Get chip info, see si446x_info_t.
Will return as SI446X_STATE_READY.
Definition: Si446x.h:245
void Si446x_SERVICE(void)
If interrupts are disabled (::SI446X_INTERRUPTS in Si446x_config.h) then this function should be call...
uint8_t revExternal
Revision external.
Definition: Si446x.h:216
GPIO 4.
Definition: Si446x.h:231
void Si446x_setupWUT(uint8_t r, uint16_t m, uint8_t ldc, uint8_t config)
Configure the wake up timer.
uint8_t Si446x_TX(void *packet, uint8_t len, uint8_t channel, si446x_state_t onTxFinish)
Transmit a packet.
uint8_t romId
ROM ID (3 = revB1B, 6 = revC2A)
Definition: Si446x.h:214
Will return as SI446X_STATE_RX.
Definition: Si446x.h:247
uint8_t Si446x_readGPIO(void)
Read GPIO pin states.
uint16_t id
ID.
Definition: Si446x.h:212
float Si446x_adc_temperature(void)
Read temperature.