@@ -23,8 +23,8 @@ SSD1309_Status_t selectDriver( void ); // Optional virtual
2323SSD1309_Status_t deselectDriver( void ); // Optional virtual
2424
2525*/
26- SSD1309_Status_t SSD1309::selectDriver ( void ){} // Default implementation is 'empty' (I mean inconsequential) so that the compiler may optimize it away
27- SSD1309_Status_t SSD1309::deselectDriver ( void ){} // Default implementation is 'empty' (I mean inconsequential) so that the compiler may optimize it away
26+ SSD1309_Status_t SSD1309::selectDriver ( void ){ return SSD1309_NotImplemented; } // Default implementation is 'empty' (rather ' inconsequential' ) so that the compiler may optimize it away
27+ SSD1309_Status_t SSD1309::deselectDriver ( void ){ return SSD1309_NotImplemented; } // Default implementation is 'empty' (rather ' inconsequential' ) so that the compiler may optimize it away
2828
2929
3030// //////////////////////////////////////////////////////////
@@ -407,9 +407,9 @@ SSD1309_Status_t SSD1309::contHScrollSetupRight(uint8_t PSA, uint8_t interval, u
407407 uint8_t buff[8 ] = {
408408 SSD1309_CMD_contHScrollSetupRight,
409409 0x00 ,
410- (PSA & 0x07 ),
411- (interval & 0x07 ),
412- (PEA & 0x07 ),
410+ (uint8_t )( PSA & 0x07 ),
411+ (uint8_t )( interval & 0x07 ),
412+ (uint8_t )( PEA & 0x07 ),
413413 0x00 ,
414414 CSA,
415415 CEA
@@ -425,9 +425,9 @@ SSD1309_Status_t SSD1309::contHScrollSetupLeft(uint8_t PSA, uint8_t interval, ui
425425 uint8_t buff[8 ] = {
426426 SSD1309_CMD_contHScrollSetupLeft,
427427 0x00 ,
428- (PSA & 0x07 ),
429- (interval & 0x07 ),
430- (PEA & 0x07 ),
428+ (uint8_t )( PSA & 0x07 ),
429+ (uint8_t )( interval & 0x07 ),
430+ (uint8_t )( PEA & 0x07 ),
431431 0x00 ,
432432 CSA,
433433 CEA
@@ -443,9 +443,9 @@ SSD1309_Status_t SSD1309::contVHScrollSetupRight(bool horiz, uint8_t PSA, uint8_
443443 uint8_t buff[8 ] = {
444444 SSD1309_CMD_contVHScrollSetupRight,
445445 0x00 ,
446- (PSA & 0x07 ),
447- (interval & 0x07 ),
448- (PEA & 0x07 ),
446+ (uint8_t )( PSA & 0x07 ),
447+ (uint8_t )( interval & 0x07 ),
448+ (uint8_t )( PEA & 0x07 ),
449449 0x00 ,
450450 CSA,
451451 CEA
@@ -461,9 +461,9 @@ SSD1309_Status_t SSD1309::contVHScrollSetupLeft(bool horiz, uint8_t PSA, uint8_t
461461 uint8_t buff[8 ] = {
462462 SSD1309_CMD_contVHScrollSetupLeft,
463463 0x00 ,
464- (PSA & 0x07 ),
465- (interval & 0x07 ),
466- (PEA & 0x07 ),
464+ (uint8_t )( PSA & 0x07 ),
465+ (uint8_t )( interval & 0x07 ),
466+ (uint8_t )( PEA & 0x07 ),
467467 0x00 ,
468468 CSA,
469469 CEA
@@ -490,8 +490,8 @@ SSD1309_Status_t SSD1309::setVScrollArea(uint8_t TFA, uint8_t SA)
490490{
491491 uint8_t buff[3 ] = {
492492 SSD1309_CMD_setVScrollArea,
493- (TFA & 0x3F ),
494- (SA & 0x7F )
493+ (uint8_t )( TFA & 0x3F ),
494+ (uint8_t )( SA & 0x7F )
495495 };
496496 selectDriver ();
497497 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -504,9 +504,9 @@ SSD1309_Status_t SSD1309::contentScrollSetupRight(uint8_t PSA, uint8_t PEA, uint
504504 uint8_t buff[8 ] = {
505505 SSD1309_CMD_contentScrollSetupRight,
506506 0x00 ,
507- (PSA & 0x07 ),
507+ (uint8_t )( PSA & 0x07 ),
508508 0x01 ,
509- (PEA & 0x07 ),
509+ (uint8_t )( PEA & 0x07 ),
510510 0x00 ,
511511 CSA,
512512 CEA
@@ -522,9 +522,9 @@ SSD1309_Status_t SSD1309::contentScrollSetupLeft(uint8_t PSA, uint8_t PEA, uint8
522522 uint8_t buff[8 ] = {
523523 SSD1309_CMD_contentScrollSetupLeft,
524524 0x00 ,
525- (PSA & 0x07 ),
525+ (uint8_t )( PSA & 0x07 ),
526526 0x01 ,
527- (PEA & 0x07 ),
527+ (uint8_t )( PEA & 0x07 ),
528528 0x00 ,
529529 CSA,
530530 CEA
@@ -540,7 +540,7 @@ SSD1309_Status_t SSD1309::contentScrollSetupLeft(uint8_t PSA, uint8_t PEA, uint8
540540SSD1309_Status_t SSD1309::setLowCSAinPAM ( uint8_t CSA )
541541{ // Note: this command should be OR'd with the desired Page Address Mode Lower Nibble of Column Start Address when it is sent
542542 uint8_t buff[1 ] = {
543- (SSD1309_CMD_setLowCSAinPAM | (CSA & 0x0F ))
543+ (uint8_t )( SSD1309_CMD_setLowCSAinPAM | (CSA & 0x0F ))
544544 };
545545 selectDriver ();
546546 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -551,7 +551,7 @@ SSD1309_Status_t SSD1309::setLowCSAinPAM( uint8_t CSA )
551551SSD1309_Status_t SSD1309::setHighCSAinPAM ( uint8_t CSA )
552552{ // This command also OR'd with the high nibble...
553553 uint8_t buff[1 ] = {
554- (SSD1309_CMD_setHighCSAinPAM | (CSA >> 4 ))
554+ (uint8_t )( SSD1309_CMD_setHighCSAinPAM | (CSA >> 4 ))
555555 };
556556 selectDriver ();
557557 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -563,7 +563,7 @@ SSD1309_Status_t SSD1309::setMemoryAddressingMode( uint8_t mode )
563563{
564564 uint8_t buff[2 ] = {
565565 SSD1309_CMD_setMemoryAddressingMode,
566- (mode & 0x03 )
566+ (uint8_t )( mode & 0x03 )
567567 };
568568 selectDriver ();
569569 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -588,8 +588,8 @@ SSD1309_Status_t SSD1309::setPageAddress(uint8_t PSA, uint8_t PEA)
588588{
589589 uint8_t buff[3 ] = {
590590 SSD1309_CMD_setPageAddress,
591- (PSA & 0x07 ),
592- (PEA & 0x07 )
591+ (uint8_t )( PSA & 0x07 ),
592+ (uint8_t )( PEA & 0x07 )
593593 };
594594 selectDriver ();
595595 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -600,7 +600,7 @@ SSD1309_Status_t SSD1309::setPageAddress(uint8_t PSA, uint8_t PEA)
600600SSD1309_Status_t SSD1309::setPSAinPAM ( uint8_t PSA )
601601{ // Note: OR this with 3 Least Significant bits that represent the page start address
602602 uint8_t buff[1 ] = {
603- (SSD1309_CMD_setPSAinPAM | (PSA & 0x07 ))
603+ (uint8_t )( SSD1309_CMD_setPSAinPAM | (PSA & 0x07 ))
604604 };
605605 selectDriver ();
606606 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -611,7 +611,7 @@ SSD1309_Status_t SSD1309::setPSAinPAM( uint8_t PSA )
611611SSD1309_Status_t SSD1309::setDisplayStartLine ( uint8_t DSL )
612612{ // Note: OR this with 6 Least Significant Bits that represent the display start line
613613 uint8_t buff[1 ] = {
614- (SSD1309_CMD_setDisplayStartLine | (DSL & 0x3F ))
614+ (uint8_t )( SSD1309_CMD_setDisplayStartLine | (DSL & 0x3F ))
615615 };
616616 selectDriver ();
617617 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -635,7 +635,7 @@ SSD1309_Status_t SSD1309::setMultiplexRatio( uint8_t MUXR)
635635{
636636 uint8_t buff[2 ] = {
637637 SSD1309_CMD_setMultiplexRatio,
638- (MUXR & 0x3F )
638+ (uint8_t )( MUXR & 0x3F )
639639 };
640640 selectDriver ();
641641 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -659,7 +659,7 @@ SSD1309_Status_t SSD1309::setDisplayOffset(uint8_t OFST)
659659{
660660 uint8_t buff[2 ] = {
661661 SSD1309_CMD_setDisplayOffset,
662- (OFST & 0x3F )
662+ (uint8_t )( OFST & 0x3F )
663663 };
664664 selectDriver ();
665665 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -671,7 +671,7 @@ SSD1309_Status_t SSD1309::setCOMpinsHWconfig(uint8_t CONF)
671671{
672672 uint8_t buff[2 ] = {
673673 SSD1309_CMD_setCOMpinsHWconfig,
674- (0x02 | (CONF & 0x30 ))
674+ (uint8_t )( 0x02 | (CONF & 0x30 ))
675675 };
676676 selectDriver ();
677677 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -683,7 +683,7 @@ SSD1309_Status_t SSD1309::setGPIO(uint8_t SET)
683683{
684684 uint8_t buff[2 ] = {
685685 SSD1309_CMD_setGPIO,
686- (SET & 0x03 )
686+ (uint8_t )( SET & 0x03 )
687687 };
688688 selectDriver ();
689689 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -721,7 +721,7 @@ SSD1309_Status_t SSD1309::setVCOMHdeselectLevel(uint8_t LVL)
721721{
722722 uint8_t buff[2 ] = {
723723 SSD1309_CMD_setVCOMHdeselectLevel,
724- (LVL & 0x3C )
724+ (uint8_t )( LVL & 0x3C )
725725 };
726726 selectDriver ();
727727 SSD1309_Status_t retval = writeBytes (buff, false , sizeof (buff));
@@ -869,7 +869,9 @@ SSD1309_Status_t SSD1309_Arduino_SPI::writeBytes(uint8_t * pdata, bool DATAcmd,
869869
870870SSD1309_Status_t SSD1309_Arduino_SPI::selectDriver ( void ){
871871 digitalWrite (_cs, LOW);
872+ return SSD1309_Nominal;
872873}
873874SSD1309_Status_t SSD1309_Arduino_SPI::deselectDriver ( void ){
874875 digitalWrite (_cs, HIGH);
876+ return SSD1309_Nominal;
875877}
0 commit comments