; generated by Component: ARM Compiler 5.05 update 2 (build 169) Tool: ArmCC [4d0f38]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\hsb2rgb_led.o --asm_dir=..\..\..\..\Build\Bootloader\MICO-Fire_F429\list_RVMDK\ --list_dir=..\..\..\..\Build\Bootloader\MICO-Fire_F429\list_RVMDK\ --depend=..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\hsb2rgb_led.d --cpu=Cortex-M4.fp --apcs=interwork --diag_suppress=9931,1,1293 -I..\..\..\..\Bootloader -I..\..\..\..\Board\fire_F429 -I..\..\..\..\include -I..\..\..\..\libraries\utilities -I..\..\..\..\libraries\utilities\json_c -I..\..\..\..\MICO\core -I..\..\..\..\MICO\security -I..\..\..\..\MICO\system -I..\..\..\..\MICO\system\command_console -I..\..\..\..\Platform\include -I..\..\..\..\Platform\Cortex-M4 -I..\..\..\..\Platform\Cortex-M4\CMSIS -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals\Libraries -I..\..\..\..\Platform\MCU\STM32F4xx\wlan_bus_driver -I..\..\..\..\Platform\Drivers\spi_flash -I..\..\..\..\Platform\Drivers -IG:\GIT_OSC\F429_OV2640_MICO_SDRAM\Projects\STM32F429\bootloader\RVMDK\RTE -ID:\work\keil5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -ID:\work\keil5\ARM\CMSIS\Include -ID:\work\keil5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0 -D__MICROLIB -D__UVISION_VERSION=516 -DSTM32F429xx -DUSE_STDPERIPH_DRIVER -DBOOTLOADER -DNO_MICO_RTOS -DHSE_VALUE=25000000 --omf_browse=..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\hsb2rgb_led.crf ..\..\..\..\Platform\Drivers\rgb_led\P9813\hsb2rgb_led.c]
                          THUMB

                          AREA ||i.H2R_HSBtoRGB||, CODE, READONLY, ALIGN=2

                  H2R_HSBtoRGB PROC
;;;43     
;;;44     static void H2R_HSBtoRGB(float hue, float sat, float bright, float *color) {
000000  b510              PUSH     {r4,lr}
000002  4604              MOV      r4,r0
000004  ed2d8b08          VPUSH    {d8-d11}
000008  eef08a41          VMOV.F32 s17,s2
00000c  eeb09a60          VMOV.F32 s18,s1
;;;45       // constrain all input variables to expected range
;;;46       hue = constrain(hue, 0, 360);
000010  ed9f1a58          VLDR     s2,|L1.372|
000014  eddfaa58          VLDR     s21,|L1.376|
000018  eef00a6a          VMOV.F32 s1,s21
00001c  f7fffffe          BL       constrain
000020  eeb08a40          VMOV.F32 s16,s0
;;;47       sat = constrain(sat, 0, 100);
000024  ed9fba55          VLDR     s22,|L1.380|
000028  eef00a6a          VMOV.F32 s1,s21
00002c  eeb00a49          VMOV.F32 s0,s18
000030  eeb01a4b          VMOV.F32 s2,s22
000034  f7fffffe          BL       constrain
000038  eeb0aa40          VMOV.F32 s20,s0
;;;48       bright = constrain(bright, 0, 100);
00003c  eeb01a4b          VMOV.F32 s2,s22
000040  eef00a6a          VMOV.F32 s1,s21
000044  eeb00a68          VMOV.F32 s0,s17
000048  f7fffffe          BL       constrain
00004c  eef01a40          VMOV.F32 s3,s0
;;;49       // define maximum value for RGB array elements
;;;50       float max_rgb_val = H2R_MAX_RGB_val;
000050  eddf0a4b          VLDR     s1,|L1.384|
;;;51       // convert saturation and brightness value to decimals and init r, g, b variables
;;;52       float sat_f = (float)sat / 100.0f;
000054  ee8a1a0b          VDIV.F32 s2,s20,s22
;;;53       float bright_f = (float)bright / 100.0f;
;;;54       float r, g, b;
;;;55       // If brightness is 0 then color is black (achromatic)
;;;56       // therefore, R, G and B values will all equal to 0
;;;57       if (bright <= 0) {
000058  eef51ac0          VCMPE.F32 s3,#0.0
00005c  ee810a8b          VDIV.F32 s0,s3,s22             ;53
000060  eef1fa10          VMRS     APSR_nzcv,FPSCR
000064  d805              BHI      |L1.114|
;;;58         color[0] = 0;
000066  edc4aa00          VSTR     s21,[r4,#0]
;;;59         color[1] = 0;
00006a  edc4aa01          VSTR     s21,[r4,#4]
;;;60         color[2] = 0;
00006e  edc4aa02          VSTR     s21,[r4,#8]
                  |L1.114|
;;;61       }
;;;62       // If saturation is 0 then color is gray (achromatic)
;;;63       // therefore, R, G and B values will all equal the current brightness
;;;64       if (sat <= 0) {
000072  eeb5aac0          VCMPE.F32 s20,#0.0
000076  eef1fa10          VMRS     APSR_nzcv,FPSCR
00007a  d80a              BHI      |L1.146|
;;;65         color[0] = bright_f * max_rgb_val;
00007c  ee200a20          VMUL.F32 s0,s0,s1
000080  ed840a00          VSTR     s0,[r4,#0]
;;;66         color[1] = bright_f * max_rgb_val;
000084  ed840a01          VSTR     s0,[r4,#4]
;;;67         color[2] = bright_f * max_rgb_val;
000088  ed840a02          VSTR     s0,[r4,#8]
                  |L1.140|
;;;68       }
;;;69       // if saturation and brightness are greater than 0 then calculate
;;;70       // R, G and B values based on the current hue and brightness
;;;71       else {
;;;72         if (hue >= 0 && hue < 120) {
;;;73           float hue_primary = 1.0f - ((float)hue / 120.0f);
;;;74           float hue_secondary = (float)hue / 120.0f;
;;;75           float sat_primary = (1.0f - hue_primary) * (1.0f - sat_f);
;;;76           float sat_secondary = (1.0f - hue_secondary) * (1.0f - sat_f);
;;;77           float sat_tertiary = 1.0f - sat_f;
;;;78           r = (bright_f * max_rgb_val) * (hue_primary + sat_primary);
;;;79           g = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary);
;;;80           b = (bright_f * max_rgb_val) * sat_tertiary;
;;;81         }
;;;82         else if (hue >= 120 && hue < 240) {
;;;83           float hue_primary = 1.0f - (((float)hue-120.0f) / 120.0f);
;;;84           float hue_secondary = ((float)hue-120.0f) / 120.0f;
;;;85           float sat_primary = (1.0f - hue_primary) * (1.0f - sat_f);
;;;86           float sat_secondary = (1.0f - hue_secondary) * (1.0f - sat_f);
;;;87           float sat_tertiary = 1.0f - sat_f;
;;;88           r = (bright_f * max_rgb_val) * sat_tertiary;
;;;89           g = (bright_f * max_rgb_val) * (hue_primary + sat_primary);
;;;90           b = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary);
;;;91         }
;;;92         else if (hue >= 240 && hue <= 360) {
;;;93           float hue_primary = 1.0f - (((float)hue-240.0f) / 120.0f);
;;;94           float hue_secondary = ((float)hue-240.0f) / 120.0f;
;;;95           float sat_primary = (1.0f - hue_primary) * (1.0f - sat_f);
;;;96           float sat_secondary = (1.0f - hue_secondary) * (1.0f - sat_f);
;;;97           float sat_tertiary = 1.0f - sat_f;
;;;98           r = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary);
;;;99           g = (bright_f * max_rgb_val) * sat_tertiary;
;;;100          b = (bright_f * max_rgb_val) * (hue_primary + sat_primary);
;;;101        }
;;;102        color[0] = r;
;;;103        color[1] = g;
;;;104        color[2] = b;
;;;105      }
;;;106      //  color[0] = Percent(color[0]);
;;;107      //  color[1] = Percent(color[1]);
;;;108      //  color[2] = Percent(color[2]);
;;;109    }
00008c  ecbd8b08          VPOP     {d8-d11}
000090  bd10              POP      {r4,pc}
                  |L1.146|
000092  eddf1a3c          VLDR     s3,|L1.388|
000096  eeb58ac0          VCMPE.F32 s16,#0.0              ;72
00009a  eef72a00          VMOV.F32 s5,#1.00000000        ;73
00009e  eef1fa10          VMRS     APSR_nzcv,FPSCR       ;72
0000a2  db1d              BLT      |L1.224|
0000a4  ee180a10          VMOV     r0,s16                ;72
0000a8  4937              LDR      r1,|L1.392|
0000aa  4288              CMP      r0,r1                 ;72
0000ac  da18              BGE      |L1.224|
0000ae  ee882a21          VDIV.F32 s4,s16,s3             ;73
0000b2  ee321ac1          VSUB.F32 s2,s5,s2              ;75
0000b6  ee200a20          VMUL.F32 s0,s0,s1              ;78
0000ba  ee608a01          VMUL.F32 s17,s0,s2             ;80
0000be  ee721ac2          VSUB.F32 s3,s5,s4              ;73
0000c2  ee323ae1          VSUB.F32 s6,s5,s3              ;75
0000c6  ee612a81          VMUL.F32 s5,s3,s2              ;76
0000ca  ee233a01          VMUL.F32 s6,s6,s2              ;75
0000ce  ee710a83          VADD.F32 s1,s3,s6              ;78
0000d2  ee209a20          VMUL.F32 s18,s0,s1             ;78
0000d6  ee720a22          VADD.F32 s1,s4,s5              ;79
0000da  ee609a20          VMUL.F32 s19,s0,s1             ;79
0000de  e043              B        |L1.360|
                  |L1.224|
0000e0  ee180a10          VMOV     r0,s16                ;82
0000e4  4928              LDR      r1,|L1.392|
0000e6  4249              RSBS     r1,r1,#0              ;82
0000e8  4408              ADD      r0,r0,r1              ;82
0000ea  f5b00f00          CMP      r0,#0x800000          ;82
0000ee  d218              BCS      |L1.290|
0000f0  ee383a61          VSUB.F32 s6,s16,s3             ;83
0000f4  ee321ac1          VSUB.F32 s2,s5,s2              ;85
0000f8  ee200a20          VMUL.F32 s0,s0,s1              ;88
0000fc  ee832a21          VDIV.F32 s4,s6,s3              ;83
000100  ee209a01          VMUL.F32 s18,s0,s2             ;88
000104  ee721ac2          VSUB.F32 s3,s5,s4              ;83
000108  ee323ae1          VSUB.F32 s6,s5,s3              ;85
00010c  ee612a81          VMUL.F32 s5,s3,s2              ;86
000110  ee233a01          VMUL.F32 s6,s6,s2              ;85
000114  ee710a83          VADD.F32 s1,s3,s6              ;89
000118  ee609a20          VMUL.F32 s19,s0,s1             ;89
00011c  ee720a22          VADD.F32 s1,s4,s5              ;90
000120  e020              B        |L1.356|
                  |L1.290|
000122  ee180a10          VMOV     r0,s16                ;92
000126  4919              LDR      r1,|L1.396|
000128  4408              ADD      r0,r0,r1              ;92
00012a  f5b00f88          CMP      r0,#0x440000          ;92
00012e  d81b              BHI      |L1.360|
000130  ee321ac1          VSUB.F32 s2,s5,s2              ;95
000134  ed9f2a16          VLDR     s4,|L1.400|
000138  ee200a20          VMUL.F32 s0,s0,s1              ;98
00013c  ee383a42          VSUB.F32 s6,s16,s4             ;93
000140  ee609a01          VMUL.F32 s19,s0,s2             ;99
000144  ee832a21          VDIV.F32 s4,s6,s3              ;93
000148  ee721ac2          VSUB.F32 s3,s5,s4              ;93
00014c  ee323ae1          VSUB.F32 s6,s5,s3              ;95
000150  ee632a01          VMUL.F32 s5,s6,s2              ;95
000154  ee213a81          VMUL.F32 s6,s3,s2              ;96
000158  ee720a03          VADD.F32 s1,s4,s6              ;98
00015c  ee209a20          VMUL.F32 s18,s0,s1             ;98
000160  ee710aa2          VADD.F32 s1,s3,s5              ;100
                  |L1.356|
000164  ee608a20          VMUL.F32 s17,s0,s1             ;100
                  |L1.360|
000168  edc48a02          VSTR     s17,[r4,#8]           ;104
00016c  ec849a02          VSTM     r4,{s18-s19}          ;104
000170  e78c              B        |L1.140|
;;;110    
                          ENDP

000172  0000              DCW      0x0000
                  |L1.372|
000174  43b40000          DCFS     0x43b40000 ; 360
                  |L1.376|
000178  00000000          DCFS     0x00000000 ; 0
                  |L1.380|
00017c  42c80000          DCFS     0x42c80000 ; 100
                  |L1.384|
000180  437f0000          DCFS     0x437f0000 ; 255
                  |L1.388|
000184  42f00000          DCFS     0x42f00000 ; 120
                  |L1.392|
                          DCD      0x42f00000
                  |L1.396|
                          DCD      0xbc900000
                  |L1.400|
000190  43700000          DCFS     0x43700000 ; 240

                          AREA ||i.constrain||, CODE, READONLY, ALIGN=1

                  constrain PROC
;;;31     
;;;32     static float constrain(float value, float min, float max){
000000  eeb40ac1          VCMPE.F32 s0,s2
;;;33       if(value >= max)
000004  eef1fa10          VMRS     APSR_nzcv,FPSCR
000008  db02              BLT      |L2.16|
;;;34         return max;
00000a  eeb00a41          VMOV.F32 s0,s2
                  |L2.14|
;;;35       if(value <=min )
;;;36         return min;
;;;37       return value;
;;;38     }
00000e  4770              BX       lr
                  |L2.16|
000010  eeb40ae0          VCMPE.F32 s0,s1                 ;35
000014  eef1fa10          VMRS     APSR_nzcv,FPSCR       ;35
000018  d8f9              BHI      |L2.14|
00001a  eeb00a60          VMOV.F32 s0,s1                 ;36
00001e  4770              BX       lr
;;;39     
                          ENDP


                          AREA ||i.hsb2rgb_led_close||, CODE, READONLY, ALIGN=1

                  hsb2rgb_led_close PROC
;;;146    
;;;147    void hsb2rgb_led_close(void)
000000  b510              PUSH     {r4,lr}
000002  f7fffffe          BL       rgb_led_init
000006  e8bd4010          POP      {r4,lr}
00000a  f7ffbffe          B.W      rgb_led_close
;;;148    {
;;;149      CloseLED_RGB();
;;;150    }
                          ENDP


                          AREA ||i.hsb2rgb_led_init||, CODE, READONLY, ALIGN=1

                  hsb2rgb_led_init PROC
;;;134    
;;;135    void hsb2rgb_led_init(void)
000000  f7ffbffe          B.W      rgb_led_init
;;;136    {
;;;137      rgb_led_init();
;;;138    }
;;;139    
                          ENDP


                          AREA ||i.hsb2rgb_led_open||, CODE, READONLY, ALIGN=1

                  hsb2rgb_led_open PROC
;;;139    
;;;140    void hsb2rgb_led_open(float hues, float saturation, float brightness)
000000  b5fe              PUSH     {r1-r7,lr}
;;;141    {
;;;142      float color[3] = {0};
000002  2000              MOVS     r0,#0
000004  9000              STR      r0,[sp,#0]
000006  9001              STR      r0,[sp,#4]
;;;143      H2R_HSBtoRGB(hues, saturation, brightness, color);
000008  9002              STR      r0,[sp,#8]
00000a  4668              MOV      r0,sp
00000c  f7fffffe          BL       H2R_HSBtoRGB
000010  ed9d0a02          VLDR     s0,[sp,#8]
000014  eebc0ac0          VCVT.U32.F32 s0,s0
000018  ee100a10          VMOV     r0,s0
00001c  ed9d0a01          VLDR     s0,[sp,#4]
000020  b2c5              UXTB     r5,r0
000022  eebc0ac0          VCVT.U32.F32 s0,s0
000026  ee100a10          VMOV     r0,s0
00002a  ed9d0a00          VLDR     s0,[sp,#0]
00002e  b2c4              UXTB     r4,r0
000030  eebc0ac0          VCVT.U32.F32 s0,s0
000034  ee100a10          VMOV     r0,s0
000038  b2c6              UXTB     r6,r0
00003a  f7fffffe          BL       rgb_led_init
00003e  462a              MOV      r2,r5
000040  4621              MOV      r1,r4
000042  4630              MOV      r0,r6
000044  f7fffffe          BL       rgb_led_open
;;;144      OpenLED_RGB(color);
;;;145    }
000048  bdfe              POP      {r1-r7,pc}
;;;146    
                          ENDP


;*** Start embedded assembler ***

#line 1 "..\\..\\..\\..\\Platform\\Drivers\\rgb_led\\P9813\\hsb2rgb_led.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___13_hsb2rgb_led_c_e2e5c41a____REV16|
#line 114 "..\\..\\..\\..\\Platform\\Cortex-M4\\CMSIS\\core_cmInstr.h"
|__asm___13_hsb2rgb_led_c_e2e5c41a____REV16| PROC
#line 115

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___13_hsb2rgb_led_c_e2e5c41a____REVSH|
#line 128
|__asm___13_hsb2rgb_led_c_e2e5c41a____REVSH| PROC
#line 129

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
