@@ -99,7 +99,7 @@ func (d *Device) ReadRegister(addr uint16) (uint8, error) {
9999
100100func (d * Device ) WriteBuffer (offset uint8 , data []byte ) error {
101101 if len (data ) > 256 {
102- return ErrDataTooLong
102+ return errDataTooLong
103103 }
104104 err := d .WaitWhileBusy (time .Second )
105105 if err != nil {
@@ -138,7 +138,7 @@ func (d *Device) ReadBuffer(offset uint8, length uint8) ([]byte, error) {
138138// Set the device into sleep mode with the given configuration: 0 (no retention), 1 (ram retentation), 2 (buffer retention) or 3 (ram and buffer retention)
139139func (d * Device ) SetSleep (sleepConfig SleepConfig ) error {
140140 if sleepConfig > (SLEEP_DATA_BUFFER_RETAIN | SLEEP_DATA_RAM_RETAIN ) {
141- return ErrInvalidSleepConfig
141+ return errInvalidSleepConfig
142142 }
143143 err := d .WaitWhileBusy (time .Second )
144144 if err != nil {
@@ -155,7 +155,7 @@ func (d *Device) SetSleep(sleepConfig SleepConfig) error {
155155// Put device into standby mode, 0 (RC) or 1 (XOSC)
156156func (d * Device ) SetStandby (standbyConfig StandbyConfig ) error {
157157 if standbyConfig > STANDBY_XOSC { // XOSC is the highest standby config anything higher is invalid
158- return ErrInvalidStandbyConfig
158+ return errInvalidStandbyConfig
159159 }
160160 err := d .WaitWhileBusy (time .Second )
161161 if err != nil {
@@ -185,7 +185,7 @@ func (d *Device) SetFs() error {
185185
186186func checkPeriodBase (periodBase PeriodBase ) error {
187187 if periodBase > PERIOD_BASE_4_MS { // 4ms is the highest period base anything higher is invalid
188- return ErrInvalidPeriodBase
188+ return errInvalidPeriodBase
189189 }
190190 return nil
191191}
@@ -351,7 +351,7 @@ func (d *Device) SetAutoFs(enable bool) error {
351351// Choose between GFSK, LoRa, Ranging, FLRC or BLE packet types, this will affect the available configuration parameters and the structure of the packet
352352func (d * Device ) SetPacketType (packetType PacketType ) error {
353353 if packetType > PACKET_TYPE_BLE { // BLE is the highest packet type anything higher is invalid.
354- return ErrInvalidPacketType
354+ return errInvalidPacketType
355355 }
356356 err := d .WaitWhileBusy (time .Second )
357357 if err != nil {
@@ -386,10 +386,10 @@ func (d *Device) GetPacketType() (PacketType, error) {
386386// Set the RF frequency in Hz, must be between 2.4 GHz and 2.5 GHz
387387func (d * Device ) SetRfFrequency (frequencyHz uint32 ) error {
388388 if frequencyHz < 2400000000 {
389- return ErrFrequencyTooLow
389+ return errFrequencyTooLow
390390 }
391391 if frequencyHz > 2500000000 {
392- return ErrFrequencyTooHigh
392+ return errFrequencyTooHigh
393393 }
394394 err := d .WaitWhileBusy (time .Second )
395395 if err != nil {
@@ -407,10 +407,10 @@ func (d *Device) SetRfFrequency(frequencyHz uint32) error {
407407// Set the output power in dBm, must be between -18 and 13 dBm, and the ramp time
408408func (d * Device ) SetTxParams (powerdBm int8 , rampTime RadioRampTime ) error {
409409 if powerdBm < - 18 {
410- return ErrPowerTooLow
410+ return errPowerTooLow
411411 }
412412 if powerdBm > 13 {
413- return ErrPowerTooHigh
413+ return errPowerTooHigh
414414 }
415415
416416 err := d .WaitWhileBusy (time .Second )
@@ -522,10 +522,10 @@ func (d *Device) SetPacketParamsGFSK(preambleLength GFSKPreambleLength, syncWord
522522// - payloadLength: range of 6-127
523523func (d * Device ) SetPacketParamsFLRC (preambleLength FLRCPreambleLength , syncWordLength FLRCSyncWordLength , syncWordMatch FLRCSyncWordMatch , headerType FLRCHeaderType , payloadLength uint8 , crcLength FLRCCrcType ) error {
524524 if payloadLength < 6 {
525- return ErrPayloadLengthTooShort
525+ return errPayloadLengthTooShort
526526 }
527527 if payloadLength > 127 {
528- return ErrPayloadLengthTooLong
528+ return errPayloadLengthTooLong
529529 }
530530 return d .SetPacketParams (preambleLength , syncWordLength , syncWordMatch , headerType , payloadLength , crcLength , whiteningDisable )
531531}
@@ -545,7 +545,7 @@ func (d *Device) SetPacketParamsBLE(connectionState BLEConnectionState, crcLengt
545545// - payloadLength: range of 1-255
546546func (d * Device ) SetPacketParamsLoRa (preambleLength uint32 , headerType LoRaHeaderType , payloadLength uint8 , crcType LoRaCrcType , iqType LoRaIqType ) error {
547547 if payloadLength == 0 {
548- return ErrPayloadLengthTooShort
548+ return errPayloadLengthTooShort
549549 }
550550 exponent , mantissa := getExponentAndMantissa (preambleLength )
551551 return d .SetPacketParams (uint8 (exponent << 4 )| mantissa , headerType , payloadLength , crcType , iqType , 0 , 0 )
@@ -739,7 +739,7 @@ func (d *Device) ClearIrqStatus(irqMask IRQMask) error {
739739// Switch between the low-dropout regulator (LDO) and the DC-DC converter for internal power regulation.
740740func (d * Device ) SetRegulatorMode (mode RegulatorMode ) error {
741741 if mode > REGULATOR_DC_DC { // DC-DC is the highest regulator mode anything higher is invalid
742- return ErrInvalidRegulatorMode
742+ return errInvalidRegulatorMode
743743 }
744744 err := d .WaitWhileBusy (time .Second )
745745 if err != nil {
0 commit comments